Sha256: 9193e962e782cda714164ebdde39d59c5ec4fe7d876629b18a23ed8f044e5d9f

Contents?: true

Size: 1.06 KB

Versions: 13

Compression:

Stored size: 1.06 KB

Contents

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 = 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

        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

      end
    end
  end
end

Version data entries

13 entries across 13 versions & 7 rubygems

Version Path
fog-nirvanix-1.8.2 lib/fog/aws/models/elb/load_balancers.rb
fog-nirvanix-1.8.1 lib/fog/aws/models/elb/load_balancers.rb
fog-parser-fix-1.6.1 lib/fog/aws/models/elb/load_balancers.rb
fog-test-again-1.6.0 lib/fog/aws/models/elb/load_balancers.rb
fog-parser-fix-1.6.0 lib/fog/aws/models/elb/load_balancers.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/aws/models/elb/load_balancers.rb
fog-sgonyea-1.8.1 lib/fog/aws/models/elb/load_balancers.rb
fog-1.8.0 lib/fog/aws/models/elb/load_balancers.rb
fog-maestrodev-1.7.0.20121114190951 lib/fog/aws/models/elb/load_balancers.rb
fog-1.7.0 lib/fog/aws/models/elb/load_balancers.rb
fog-1.6.0 lib/fog/aws/models/elb/load_balancers.rb
fog-1.5.0 lib/fog/aws/models/elb/load_balancers.rb
fog-1.4.0 lib/fog/aws/models/elb/load_balancers.rb