Sha256: 971f6c5f1941d04b16ceb472502eba57dd6daf091b29fa77643c792291283494

Contents?: true

Size: 1.86 KB

Versions: 36

Compression:

Stored size: 1.86 KB

Contents

module Fog
  module AWS
    class ELB
      class Real

        require 'fog/aws/parsers/elb/tag_list_parser'

        # returns a Hash of tags for a load balancer
        # http://docs.aws.amazon.com/ElasticLoadBalancing/latest/APIReference/API_DescribeTags.html
        # ==== Parameters
        # * elb_id <~String> - name(s) of the ELB instance whose tags are to be retrieved (allows 1-20 of them)
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        def describe_tags(elb_ids)
          request({
              'Action' => 'DescribeTags',
              :parser  => Fog::Parsers::AWS::ELB::TagListParser.new
            }.merge(Fog::AWS.indexed_param('LoadBalancerNames.member.%d', elb_ids))
          )
        end
        # def describe_tags(filters = {})
        #   params = Fog::AWS.indexed_filters(filters)
        #   request({
        #     'Action'    => 'DescribeTags',
        #     :idempotent => true,
        #     :parser     => Fog::Parsers::AWS::Compute::DescribeTags.new
        #   }.merge!(params))
        # end

      end

      class Mock

        def describe_tags(elb_id)
          response = Excon::Response.new

          if server = self.data[:load_balancers][elb_id]
            response.status = 200
            ##{"DescribeTagsResult"=>{"LoadBalancers"=>[{"Tags"=>{"Name"=>"2esakowski-test-opsworks-elb"}, "LoadBalancerName"=>"esakowski-test-opsworks"}]}}
            response.body = {"DescribeTagsResult"=>{"LoadBalancers"=>[{"Tags"=>self.data[:tags][elb_id], "LoadBalancerName"=>elb_id}]}}

#            response.body = {
#              "DescribeTagsResult" =>
#               {"TagDescriptions" => self.data[:tags][elb_id]}
#            }
            response
          else
            raise Fog::AWS::ELB::NotFound.new("Elastic load balancer #{elb_id} not found")
          end
        end

      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
fog-aws-3.10.0 lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-3.9.0 lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-3.8.0 lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-3.7.0 lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-3.6.7 lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-3.6.6 lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-3.6.5 lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-3.6.4 lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-3.6.3 lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-3.6.2 lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-3.5.2 lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-3.5.1 lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-3.5.0 lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-3.4.0 lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-3.3.0 lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-3.2.0 lib/fog/aws/requests/elb/describe_tags.rb