Sha256: aa28c5ad09ab84215d872b508e663c4d176fbb98b8f6c1c2abb047a57c327fb4

Contents?: true

Size: 1.86 KB

Versions: 48

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::Compute::AWS::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

48 entries across 46 versions & 5 rubygems

Version Path
fog-aws-3.1.0 lib/fog/aws/requests/elb/describe_tags.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-aws-2.0.1/lib/fog/aws/requests/elb/describe_tags.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-aws-2.0.1/lib/fog/aws/requests/elb/describe_tags.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-aws-2.0.1/lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-3.0.0 lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-2.0.1 lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-2.0.0 lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-1.4.1 lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-1.4.0 lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-1.3.0 lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-1.2.1 lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-1.2.0 lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-1.1.0 lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-1.0.0 lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-0.13.0 lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-0.12.0 lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-0.11.0 lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-0.10.0 lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-0.9.4 lib/fog/aws/requests/elb/describe_tags.rb
fog-aws-0.9.3 lib/fog/aws/requests/elb/describe_tags.rb