mirror of
https://github.com/fog/fog-aws.git
synced 2022-11-09 13:50:52 -05:00
initial import
* take the liberty of correcting Aws naming
This commit is contained in:
parent
095fa8763f
commit
d48d376e9c
1261 changed files with 72105 additions and 5 deletions
37
lib/fog/aws/models/elb/load_balancers.rb
Normal file
37
lib/fog/aws/models/elb/load_balancers.rb
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
require 'fog/aws/models/elb/load_balancer'
|
||||
module Fog
|
||||
module AWS
|
||||
class ELB
|
||||
class LoadBalancers < Fog::Collection
|
||||
model Fog::AWS::ELB::LoadBalancer
|
||||
|
||||
# Creates a new load balancer
|
||||
def initialize(attributes={})
|
||||
super
|
||||
end
|
||||
|
||||
def all
|
||||
result = []
|
||||
marker = nil
|
||||
finished = false
|
||||
while !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
|
||||
|
||||
def get(identity)
|
||||
if identity
|
||||
data = service.describe_load_balancers('LoadBalancerNames' => identity).body['DescribeLoadBalancersResult']['LoadBalancerDescriptions'].first
|
||||
new(data)
|
||||
end
|
||||
rescue Fog::AWS::ELB::NotFound
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue