Method: Fog::Compute::AWS::Real#delete_tags

Defined in:
lib/fog/compute/requests/aws/delete_tags.rb

#delete_tags(resources, tags) ⇒ Object

Remove tags from resources

Parameters

  • resources<~String> - One or more resources to remove tags from

  • tags<~String> - hash of key value tag pairs to remove

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘requestId’<~String> - Id of request

      • ‘return’<~Boolean> - success?

Amazon API Reference



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/fog/compute/requests/aws/delete_tags.rb', line 21

def delete_tags(resources, tags)
  resources = [*resources]
  params = {}
  params.merge!(Fog::AWS.indexed_param('ResourceId', resources))

  # can not rely on indexed_param because nil values should be omitted
  tags.keys.each_with_index do |key, index|
    index += 1 # should start at 1 instead of 0
    params.merge!("Tag.#{index}.Key" => key)
    unless tags[key].nil?
      params.merge("Tag.#{index}.Value" => tags[key])
    end
  end

  request({
    'Action'            => 'DeleteTags',
    :parser             => Fog::Parsers::Compute::AWS::Basic.new
  }.merge!(params))
end