Class: Aws::S3::ObjectSummary::Collection

Inherits:
Resources::Collection
  • Object
show all
Defined in:
lib/aws-sdk-s3/object_summary.rb

Batch Actions collapse

Instance Method Details

#batch_delete!(options = {}) ⇒ void

This method returns an undefined value.

Examples:

Request syntax with placeholder values


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

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 docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html

  • :bypass_governance_retention (Boolean)

    Specifies whether you want to delete this object even if it has a Governance-type Object Lock in place. You must have sufficient permissions to perform this operation.



999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
# File 'lib/aws-sdk-s3/object_summary.rb', line 999

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