You are viewing documentation for version 3 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: Aws::EC2::Tag::Collection

Inherits:
Resources::Collection show all
Defined in:
gems/aws-sdk-ec2/lib/aws-sdk-ec2/tag.rb

Batch Actions collapse

Methods inherited from Resources::Collection

#each, #first, #limit, #size

Instance Method Details

#batch_delete!(options = {}) ⇒ void

This method returns an undefined value.

Examples:

Request syntax with placeholder values


tag.batch_delete!({
  dry_run: false,
})

Parameters:

  • options ({}) (defaults to: {})

Options Hash (options):

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.



198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/tag.rb', line 198

def batch_delete!(options = {})
  batch_enum.each do |batch|
    params = Aws::Util.copy_hash(options)
    params[:resources] ||= []
    params[:tags] ||= []
    batch.each do |item|
      params[:resources] << {
        resource_id: item.resource_id
      }
      params[:tags] << {
        key: item.key,
        value: item.value
      }
    end
    batch[0].client.delete_tags(params)
  end
  nil
end