Class DeleteVersionRequest
- All Implemented Interfaces:
ReadLimitInfo
,Serializable
,Cloneable
Provides options for deleting a specific version of an object in the specified bucket. Once deleted, there is no method to restore or undelete an object version. This is the only way to permanently delete object versions that are protected by versioning.
Because deleting an object version is permanent and irreversible, it is a privileged operation that only the owner of the bucket containing the version may perform.
An owner can only delete a version of an object if the owner has enabled versioning for
their bucket.
For more information about enabling versioning for a bucket, see
AmazonS3.setBucketVersioningConfiguration(SetBucketVersioningConfigurationRequest)
.
Note: When attempting to delete an object that does not exist, Amazon S3 returns a success message, not an error message.
- See Also:
-
Field Summary
Fields inherited from class com.amazonaws.AmazonWebServiceRequest
NOOP
-
Constructor Summary
ConstructorsConstructorDescriptionDeleteVersionRequest
(String bucketName, String key, String versionId) Constructs a newDeleteVersionRequest
object, ready to be executed to delete the version identified by the specified version ID, in the specified bucket and key.DeleteVersionRequest
(String bucketName, String key, String versionId, MultiFactorAuthentication mfa) Constructs a newDeleteVersionRequest
object, ready to be executed to delete the version identified by the specified version ID, in the specified bucket and key, with the specified Multi-Factor Authentication (MFA) information. -
Method Summary
Modifier and TypeMethodDescriptionGets the name of the Amazon S3 bucket containing the version to delete.getKey()
Gets the key of the version to delete.getMfa()
Gets the optional Multi-Factor Authentication information included with this request.Gets the version ID uniquely identifying which version of the object to delete.void
setBucketName
(String bucketName) Sets the name of the Amazon S3 bucket containing the version to delete.void
Sets the key of the version to delete.void
Sets the optional Multi-Factor Authentication information to include with this request.void
setVersionId
(String versionId) Sets the version ID uniquely identifying which version of the object to delete.withBucketName
(String bucketName) Sets the name of the Amazon S3 bucket containing the version to delete.Sets the key of the version to delete Returns thisDeleteVersionRequest
, enabling additional method calls to be chained together.Sets the optional Multi-Factor Authentication information to include with this request Returns thisDeleteVersionRequest
, enabling additional method calls to be chained together.withVersionId
(String versionId) Sets the version ID uniquely identifying which version of the object to delete Returns thisDeleteVersionRequest
, enabling additional method calls to be chained together.Methods inherited from class com.amazonaws.AmazonWebServiceRequest
clone, copyBaseTo, getCloneRoot, getCloneSource, getCustomQueryParameters, getCustomRequestHeaders, getGeneralProgressListener, getReadLimit, getRequestClientOptions, getRequestCredentials, getRequestCredentialsProvider, getRequestMetricCollector, getSdkClientExecutionTimeout, getSdkRequestTimeout, putCustomQueryParameter, putCustomRequestHeader, setGeneralProgressListener, setRequestCredentials, setRequestCredentialsProvider, setRequestMetricCollector, setSdkClientExecutionTimeout, setSdkRequestTimeout, withGeneralProgressListener, withRequestMetricCollector, withSdkClientExecutionTimeout, withSdkRequestTimeout
-
Constructor Details
-
DeleteVersionRequest
Constructs a newDeleteVersionRequest
object, ready to be executed to delete the version identified by the specified version ID, in the specified bucket and key.- Parameters:
bucketName
- The name of the bucket containing the version to delete.key
- The key of the object version to delete.versionId
- The version ID identifying the version to delete.- See Also:
-
DeleteVersionRequest
public DeleteVersionRequest(String bucketName, String key, String versionId, MultiFactorAuthentication mfa) Constructs a newDeleteVersionRequest
object, ready to be executed to delete the version identified by the specified version ID, in the specified bucket and key, with the specified Multi-Factor Authentication (MFA) information. Multi-Factor Authentication is required when the MFA Delete option has been enabled for a bucket's versioning configuration. SeeBucketVersioningConfiguration
for more details on MFA Delete.- Parameters:
bucketName
- The name of the bucket containing the version to delete.key
- The key of the object version to delete.versionId
- The version ID uniquely identifying the version to delete.mfa
- The Multi-Factor Authentication information to include in this request.- See Also:
-
-
Method Details
-
getBucketName
Gets the name of the Amazon S3 bucket containing the version to delete.- Returns:
- The name of the Amazon S3 bucket containing the version to delete.
- See Also:
-
setBucketName
Sets the name of the Amazon S3 bucket containing the version to delete.- Parameters:
bucketName
- The name of the Amazon S3 bucket containing the version to delete.- See Also:
-
withBucketName
Sets the name of the Amazon S3 bucket containing the version to delete. Returns thisDeleteVersionRequest
, enabling additional method calls to be chained together.- Parameters:
bucketName
- The name of the Amazon S3 bucket containing the version to delete.- Returns:
- The updated
DeleteVersionRequest
object, enabling additional method calls to be chained together. - See Also:
-
getKey
Gets the key of the version to delete.- Returns:
- The key of the version to delete.
- See Also:
-
setKey
Sets the key of the version to delete.- Parameters:
key
- The key of the version to delete.- See Also:
-
withKey
Sets the key of the version to delete Returns thisDeleteVersionRequest
, enabling additional method calls to be chained together.- Parameters:
key
- The key of the version to delete.- Returns:
- This
DeleteVersionRequest
, enabling additional method calls to be chained together. - See Also:
-
getVersionId
Gets the version ID uniquely identifying which version of the object to delete.- Returns:
- The version ID uniquely identifying which version of the object to delete.
- See Also:
-
setVersionId
Sets the version ID uniquely identifying which version of the object to delete.- Parameters:
versionId
- The version ID uniquely identifying which version of the object to delete.- See Also:
-
withVersionId
Sets the version ID uniquely identifying which version of the object to delete Returns thisDeleteVersionRequest
, enabling additional method calls to be chained together.- Parameters:
versionId
- The version ID uniquely identifying which version of the object to delete.- Returns:
- This
DeleteVersionRequest
, enabling additional method calls to be chained together. - See Also:
-
getMfa
Gets the optional Multi-Factor Authentication information included with this request.
Multi-Factor Authentication is required when deleting an object version from a bucket which has MFADelete enabled in its bucket versioning configuration.
See
BucketVersioningConfiguration.setMfaDeleteEnabled(Boolean)
for more information on MFADelete.- Returns:
- The optional Multi-Factor Authentication information included with this request.
- See Also:
-
setMfa
Sets the optional Multi-Factor Authentication information to include with this request.
Multi-Factor Authentication is required when deleting an object version from a bucket which has MFADelete enabled in its bucket versioning configuration.
See
BucketVersioningConfiguration.setMfaDeleteEnabled(Boolean)
for more information on MFADelete.- Parameters:
mfa
- The optional Multi-Factor Authentication information to include with this request.- See Also:
-
withMfa
Sets the optional Multi-Factor Authentication information to include with this request Returns this
DeleteVersionRequest
, enabling additional method calls to be chained together.Multi-Factor Authentication is required when deleting an object version from a bucket which has MFADelete enabled in its bucket versioning configuration
See
BucketVersioningConfiguration.setMfaDeleteEnabled(Boolean)
for more information on MFADelete.- Parameters:
mfa
- The optional Multi-Factor Authentication information to include with this request.- Returns:
- This
DeleteVersionRequest
, enabling additional method calls to be chained together. - See Also:
-