public class DeleteVersionRequest extends GenericRequest
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
OSS.setBucketVersioning(SetBucketVersioningRequest)
.
Note: When attempting to delete an object that does not exist, OSS 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. |
Modifier and Type | Method and Description |
---|---|
String |
getVersionId()
Gets the version ID uniquely identifying which version of the object
to delete.
|
void |
setVersionId(String versionId)
Sets the version ID uniquely identifying which version of the
object to delete.
|
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. |
getBucketName, getKey, getRequestPayer, setBucketName, setKey, setRequestPayer, withBucketName, withKey, withRequestPayer
addAdditionalHeaderName, addHeader, addParameter, getAdditionalHeaderNames, getEndpoint, getHeaders, getParameters, getProgressListener, isLogEnabled, setAdditionalHeaderNames, setEndpoint, setHeaders, setLogEnabled, setParameters, setProgressListener, withProgressListener
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.public String getVersionId()
getVersionId
in class GenericRequest
setVersionId(String)
,
withVersionId(String)
public void setVersionId(String versionId)
setVersionId
in class GenericRequest
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.withVersionId
in class GenericRequest
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)
Copyright © 2023. All Rights Reserved.