Sha256: 92e9ae5f7a10bb855ba7c29037656130e0f499a6e29848bcfc0e3a886aec277e

Contents?: true

Size: 1.05 KB

Versions: 39

Compression:

Stored size: 1.05 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
          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

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

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
fog-aws-3.30.0 lib/fog/aws/models/elb/load_balancers.rb
fog-aws-3.29.0 lib/fog/aws/models/elb/load_balancers.rb
fog-aws-3.28.0 lib/fog/aws/models/elb/load_balancers.rb
fog-aws-3.27.0 lib/fog/aws/models/elb/load_balancers.rb
fog-aws-3.26.0 lib/fog/aws/models/elb/load_balancers.rb
fog-aws-3.25.0 lib/fog/aws/models/elb/load_balancers.rb
fog-aws-3.24.0 lib/fog/aws/models/elb/load_balancers.rb
fog-aws-3.23.0 lib/fog/aws/models/elb/load_balancers.rb
fog-aws-3.22.0 lib/fog/aws/models/elb/load_balancers.rb
fog-aws-3.21.1 lib/fog/aws/models/elb/load_balancers.rb
fog-aws-3.21.0 lib/fog/aws/models/elb/load_balancers.rb
fog-aws-3.20.0 lib/fog/aws/models/elb/load_balancers.rb
fog-aws-3.19.0 lib/fog/aws/models/elb/load_balancers.rb
fog-aws-3.18.0 lib/fog/aws/models/elb/load_balancers.rb
fog-aws-3.17.0 lib/fog/aws/models/elb/load_balancers.rb
fog-aws-3.16.0 lib/fog/aws/models/elb/load_balancers.rb
fog-aws-3.15.0 lib/fog/aws/models/elb/load_balancers.rb
fog-aws-3.14.0 lib/fog/aws/models/elb/load_balancers.rb
fog-aws-3.13.0 lib/fog/aws/models/elb/load_balancers.rb
fog-aws-3.12.0 lib/fog/aws/models/elb/load_balancers.rb