Sha256: 3e5319948958412d51749e8e6fdae0259cfaa3ff188e7e5ae684ee80d17dafa4

Contents?: true

Size: 1.49 KB

Versions: 72

Compression:

Stored size: 1.49 KB

Contents

module Fog
  module AWS
    class RDS
      class Real

        # adds tags to a database instance
        # http://docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_AddTagsToResource.html
        # ==== Parameters
        # * rds_id <~String> - name of the RDS instance whose tags are to be retrieved
        # * tags <~Hash> A Hash of (String) key-value pairs
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        def add_tags_to_resource(rds_id, tags)
          keys    = tags.keys.sort
          values  = keys.map {|key| tags[key]}
          request({
              'Action'        => 'AddTagsToResource',
              'ResourceName'  => "arn:aws:rds:#{@region}:#{owner_id}:db:#{rds_id}",
              :parser         => Fog::Parsers::AWS::RDS::Base.new,
            }.merge(Fog::AWS.indexed_param('Tags.member.%d.Key', keys)).
              merge(Fog::AWS.indexed_param('Tags.member.%d.Value', values)))
        end

      end

      class Mock

        def add_tags_to_resource(rds_id, tags)
          response = Excon::Response.new
          if server = self.data[:servers][rds_id]
            self.data[:tags][rds_id].merge! tags
            response.status = 200
            response.body = {
              "ResponseMetadata"=>{ "RequestId"=> Fog::AWS::Mock.request_id }
            }
            response
          else
            raise Fog::AWS::RDS::NotFound.new("DBInstance #{rds_id} not found")
          end
        end

      end
    end
  end
end

Version data entries

72 entries across 72 versions & 9 rubygems

Version Path
fog-1.22.0 lib/fog/aws/requests/rds/add_tags_to_resource.rb
fog-1.21.0 lib/fog/aws/requests/rds/add_tags_to_resource.rb
fog-maestrodev-1.20.0.20140305101839 lib/fog/aws/requests/rds/add_tags_to_resource.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/aws/requests/rds/add_tags_to_resource.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/aws/requests/rds/add_tags_to_resource.rb
fog-1.20.0 lib/fog/aws/requests/rds/add_tags_to_resource.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/aws/requests/rds/add_tags_to_resource.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/aws/requests/rds/add_tags_to_resource.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/aws/requests/rds/add_tags_to_resource.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/aws/requests/rds/add_tags_to_resource.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/aws/requests/rds/add_tags_to_resource.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/aws/requests/rds/add_tags_to_resource.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/aws/requests/rds/add_tags_to_resource.rb
fog-1.19.0 lib/fog/aws/requests/rds/add_tags_to_resource.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/aws/requests/rds/add_tags_to_resource.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/aws/requests/rds/add_tags_to_resource.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/aws/requests/rds/add_tags_to_resource.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/aws/requests/rds/add_tags_to_resource.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/aws/requests/rds/add_tags_to_resource.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/aws/requests/rds/add_tags_to_resource.rb