Class DeleteObjectsRequest
Container for the parameters to the DeleteObjects operation. This action enables you to delete multiple objects from a bucket using a single HTTP request. If you know the object keys that you want to delete, then this action provides a suitable alternative to sending individual delete requests, reducing per-request overhead.
The request contains a list of up to 1000 keys that you want to delete. In the XML, you provide the object key names, and optionally, version IDs if you want to delete a specific version of the object from a versioning-enabled bucket. For each key, Amazon S3 performs a delete action and returns the result of that delete, success, or failure, in the response. Note that if the object specified in the request is not found, Amazon S3 returns the result as deleted.
The action supports two modes for the response: verbose and quiet. By default, the action uses verbose mode in which the response includes the result of deletion of each key in your request. In quiet mode the response includes only keys where the delete action encountered an error. For a successful deletion, the action does not return any information about the delete in the response body.
When performing this action on an MFA Delete enabled bucket, that attempts to delete any versioned objects, you must include an MFA token. If you do not provide one, the entire request will fail, even if there are non-versioned objects you are trying to delete. If you provide an invalid token, whether there are versioned keys in the request or not, the entire Multi-Object Delete request will fail. For information about MFA Delete, see MFA Delete.
Finally, the Content-MD5 header is required for all Multi-Object Delete requests. Amazon S3 uses the header value to ensure that your request body has not been altered in transit.
The following operations are related to
DeleteObjects
:
public class DeleteObjectsRequest : AmazonWebServiceRequest
- Inheritance
-
DeleteObjectsRequest
Constructors
DeleteObjectsRequest()
public DeleteObjectsRequest()
Properties
BucketName
Gets and sets the property BucketName.
The bucket name containing the objects to delete.
When using this action with an access point, you must direct requests to the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see Using access points in the Amazon S3 User Guide.
When you use this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form
AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com
.
When you use this action with S3 on Outposts through the Amazon Web Services SDKs,
you provide the Outposts access point ARN in place of the bucket name. For more information
about S3 on Outposts ARNs, see What
is S3 on Outposts in the Amazon S3 User Guide.
public string BucketName { get; set; }
Property Value
BypassGovernanceRetention
Gets and sets the property BypassGovernanceRetention.
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.
public bool BypassGovernanceRetention { get; set; }
Property Value
ChecksumAlgorithm
Gets and sets the property ChecksumAlgorithm.
Indicates the algorithm used to create the checksum for the object. Amazon S3 will fail the request with a 400 error if there is no checksum associated with the object. For more information, see Checking object integrity in the Amazon S3 User Guide.
public ChecksumAlgorithm ChecksumAlgorithm { get; set; }
Property Value
ExpectedBucketOwner
Gets and sets the property ExpectedBucketOwner.
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.
public string ExpectedBucketOwner { get; set; }
Property Value
MfaCodes
The MfaCodes Tuple associates the Serial Number and the current Token/Code displayed on the Multi-Factor Authentication device associated with your AWS Account.
public MfaCodes MfaCodes { get; set; }
Property Value
Remarks
This is a required property for this request if:
- EnableMfaDelete was configured on the bucket
containing this object's version.
- You are deleting an object's version
Objects
List of object keys to delete.
public List<KeyVersion> Objects { get; set; }
Property Value
Quiet
Toggles between Quiet and Verbose mode for the operation. If set to true (Quiet mode), the response includes only those keys for objects on which the delete operation failed.
public bool Quiet { get; set; }
Property Value
Remarks
By default this property is false and keys for both successful deletes and failures are returned in the response.
RequestPayer
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.
public RequestPayer RequestPayer { get; set; }
Property Value
Methods
AddKey(string)
Add a key to the set of keys of objects to be deleted.
public void AddKey(string key)
Parameters
key
stringObject key
AddKey(string, string)
Add a key and a version to be deleted.
public void AddKey(string key, string version)