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

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

Instance Method Summary collapse

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
  until finished
    data = service.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
# File 'lib/fog/aws/models/elb/load_balancers.rb', line 26

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