Class: Aws::S3::ObjectVersion::Collection

Inherits:
Resources::Collection show all
Defined in:
gems/aws-sdk-s3/lib/aws-sdk-s3/object_version.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_version.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. Required to permanently delete a versioned object if versioning is configured with MFA delete enabled.

  • :request_payer (String)

    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 in the Amazon S3 Developer Guide.

  • :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.



529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
# File 'gems/aws-sdk-s3/lib/aws-sdk-s3/object_version.rb', line 529

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.object_key,
        version_id: item.id
      }
    end
    batch[0].client.delete_objects(params)
  end
  nil
end