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

Class: Aws::S3::Object::Collection

Inherits:
Resources::Collection show all
Defined in:
gems/aws-sdk-s3/lib/aws-sdk-s3/object.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


object.batch_delete!({
  mfa: "MFA",
  request_payer: "requester", # accepts requester
})

Parameters:

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

Options Hash (options):

  • :mfa (String)

    The concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device.

  • :request_payer (String)

    Confirms that the requester knows that she or he will be charged for the request. Bucket owners need not specify this parameter in their requests. Documentation on downloading objects from requester pays buckets can be found at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html



1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
# File 'gems/aws-sdk-s3/lib/aws-sdk-s3/object.rb', line 1098

def batch_delete!(options = {})
  batch_enum.each do |batch|
    params = Aws::Util.copy_hash(options)
    params[:bucket] = batch[0].bucket_name
    params[:delete] ||= {}
    params[:delete][:objects] ||= []
    batch.each do |item|
      params[:delete][:objects] << {
        key: item.key
      }
    end
    batch[0].client.delete_objects(params)
  end
  nil
end