Class: Fog::AWS::ELB::LoadBalancers

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/aws/models/elb/load_balancers.rb

Instance Attribute Summary

Attributes inherited from Collection

#connection

Instance Method Summary collapse

Methods inherited from Collection

#clear, #create, #destroy, #inspect, #load, model, #model, #new, #reload, #table, #to_json

Methods included from Fog::Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Fog::Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one

Constructor Details

#initialize(attributes = {}) ⇒ LoadBalancers

Creates a new load balancer



9
10
11
# File 'lib/fog/aws/models/elb/load_balancers.rb', line 9

def initialize(attributes={})
  super
end

Instance Method Details

#allObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/fog/aws/models/elb/load_balancers.rb', line 13

def all
  result = []
  marker = nil
  finished = false
  while !finished
    data = connection.describe_load_balancers('Marker' => marker).body
    result.concat(data['DescribeLoadBalancersResult']['LoadBalancerDescriptions'])
    marker = data['DescribeLoadBalancersResult']['NextMarker']
    finished = marker.nil?
  end
  load(result) # data is an array of attribute hashes
end

#get(identity) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/fog/aws/models/elb/load_balancers.rb', line 26

def get(identity)
  if identity
    data = connection.describe_load_balancers('LoadBalancerNames' => identity).body['DescribeLoadBalancersResult']['LoadBalancerDescriptions'].first
    new(data)
  end
rescue Fog::AWS::ELB::NotFound
  nil
end