public class DeleteVersionRequest extends AmazonWebServiceRequest implements Serializable
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.
NOOP
Constructor and Description |
---|
DeleteVersionRequest(String bucketName,
String key,
String versionId)
Constructs a new
DeleteVersionRequest 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 new
DeleteVersionRequest 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. |
Modifier and Type | Method and Description |
---|---|
String |
getBucketName()
Gets the name of the Amazon S3 bucket containing the version to
delete.
|
boolean |
getBypassGovernanceRetention()
Specifies whether you want to delete this object even if it has a Governance-type Object Lock in place.
|
String |
getKey()
Gets the key of the version to delete.
|
MultiFactorAuthentication |
getMfa()
Gets the optional Multi-Factor Authentication information included
with this request.
|
String |
getVersionId()
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 |
setBypassGovernanceRetention(boolean bypassGovernanceRetention)
Specifies whether you want to delete this object even if it has a Governance-type Object Lock in place.
|
void |
setKey(String key)
Sets the key of the version to delete.
|
void |
setMfa(MultiFactorAuthentication mfa)
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.
|
DeleteVersionRequest |
withBucketName(String bucketName)
Sets the name of the Amazon S3 bucket containing the version to delete.
|
DeleteVersionRequest |
withBypassGovernanceRetention(boolean bypassGovernanceRetention)
Specifies whether you want to delete this object even if it has a Governance-type Object Lock in place.
|
DeleteVersionRequest |
withKey(String key)
Sets the key of the version to delete
Returns this
DeleteVersionRequest , enabling additional method
calls to be chained together. |
DeleteVersionRequest |
withMfa(MultiFactorAuthentication mfa)
Sets the optional Multi-Factor Authentication information to include with
this request
Returns this
DeleteVersionRequest , enabling additional method
calls to be chained together. |
DeleteVersionRequest |
withVersionId(String versionId)
Sets the version ID uniquely identifying which version of the object to
delete
Returns this
DeleteVersionRequest , enabling additional method
calls to be chained together. |
addHandlerContext, clone, getCloneRoot, getCloneSource, getCustomQueryParameters, getCustomRequestHeaders, getGeneralProgressListener, getHandlerContext, getReadLimit, getRequestClientOptions, getRequestCredentials, getRequestCredentialsProvider, getRequestMetricCollector, getSdkClientExecutionTimeout, getSdkRequestTimeout, putCustomQueryParameter, putCustomRequestHeader, setGeneralProgressListener, setRequestCredentials, setRequestCredentialsProvider, setRequestMetricCollector, setSdkClientExecutionTimeout, setSdkRequestTimeout, withGeneralProgressListener, withRequestCredentialsProvider, withRequestMetricCollector, withSdkClientExecutionTimeout, withSdkRequestTimeout
public DeleteVersionRequest(String bucketName, String key, String versionId)
DeleteVersionRequest
object,
ready to be executed to
delete the version identified by the specified version ID, in the
specified bucket and key.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.DeleteVersionRequest(String, String, String, MultiFactorAuthentication)
public DeleteVersionRequest(String bucketName, String key, String versionId, MultiFactorAuthentication mfa)
DeleteVersionRequest
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.
See BucketVersioningConfiguration
for more details on MFA
Delete.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.DeleteVersionRequest(String, String, String)
public String getBucketName()
setBucketName(String)
,
withBucketName(String)
public void setBucketName(String bucketName)
bucketName
- The name of the Amazon S3 bucket containing the version to
delete.getBucketName()
,
withBucketName(String)
public DeleteVersionRequest withBucketName(String bucketName)
DeleteVersionRequest
, enabling additional method
calls to be chained together.bucketName
- The name of the Amazon S3 bucket containing the version to
delete.DeleteVersionRequest
object,
enabling additional method
calls to be chained together.getBucketName()
,
setBucketName(String)
public String getKey()
setKey(String)
,
withKey(String)
public void setKey(String key)
key
- The key of the version to delete.getKey()
,
withKey(String)
public DeleteVersionRequest withKey(String key)
DeleteVersionRequest
, enabling additional method
calls to be chained together.key
- The key of the version to delete.DeleteVersionRequest
, enabling additional method
calls to be chained together.getKey()
,
setKey(String)
public String getVersionId()
setVersionId(String)
,
withVersionId(String)
public void setVersionId(String versionId)
versionId
- The version ID uniquely identifying which version of
the object to delete.getVersionId()
,
withVersionId(String)
public DeleteVersionRequest withVersionId(String versionId)
DeleteVersionRequest
, enabling additional method
calls to be chained together.versionId
- The version ID uniquely identifying which version of the
object to delete.DeleteVersionRequest
, enabling additional method
calls to be chained together.getVersionId()
,
setVersionId(String)
public MultiFactorAuthentication 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.
setMfa(MultiFactorAuthentication)
,
withMfa(MultiFactorAuthentication)
public void setMfa(MultiFactorAuthentication mfa)
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.
mfa
- The optional Multi-Factor Authentication information to
include with this request.getMfa()
,
withMfa(MultiFactorAuthentication)
public DeleteVersionRequest withMfa(MultiFactorAuthentication mfa)
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.
mfa
- The optional Multi-Factor Authentication information to
include with this request.DeleteVersionRequest
, enabling additional method
calls to be chained together.getMfa()
,
withMfa(MultiFactorAuthentication)
public boolean getBypassGovernanceRetention()
public DeleteVersionRequest withBypassGovernanceRetention(boolean bypassGovernanceRetention)
public void setBypassGovernanceRetention(boolean bypassGovernanceRetention)