class Aws::S3::ObjectSummary::Collection

Public Instance Methods

batch_delete!(options = {}) click to toggle source

@example Request syntax with placeholder values

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

@param options ({}) @option options [String] :mfa

The concatenation of the authentication device's serial number, a
space, and the value that is displayed on your authentication device.
Required to permanently delete a versioned object if versioning is
configured with MFA delete enabled.

@option options [String] :request_payer

Confirms that the requester knows that they will be charged for the
request. Bucket owners need not specify this parameter in their
requests. For information about downloading objects from requester
pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
in the *Amazon S3 User Guide*.

[1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html

@option options [Boolean] :bypass_governance_retention

Specifies whether you want to delete this object even if it has a
Governance-type Object Lock in place. To use this header, you must
have the `s3:PutBucketPublicAccessBlock` permission.

@option options [String] :expected_bucket_owner

The account ID of the expected bucket owner. If the bucket is owned by
a different account, the request will fail with an HTTP `403 (Access
Denied)` error.

@return [void]

# File lib/aws-sdk-s3/object_summary.rb, line 1346
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