Class DeleteObjectRequest
- All Implemented Interfaces:
ReadLimitInfo
,Serializable
,Cloneable
Provides options for deleting a specified object in a specified bucket. Once deleted, the object can only be restored if versioning was enabled when the object was deleted.
Note: If deleting 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
ConstructorsConstructorDescriptionDeleteObjectRequest
(String bucketName, String key) Constructs a newDeleteObjectRequest
, specifying the object's bucket name and key. -
Method Summary
Modifier and TypeMethodDescriptionGets the name of the Amazon S3 bucket containing the object to delete.getKey()
Gets the key of the object to delete.boolean
Returns true if the user has enabled Requester Pays option when conducting this operation from Requester Pays Bucket; else false.void
setBucketName
(String bucketName) Sets the name of the Amazon S3 bucket containing the object to delete.void
Sets the key of the object to delete.void
setRequesterPays
(boolean isRequesterPays) Used for conducting this operation from a Requester Pays Bucket.withBucketName
(String bucketName) Sets the name of the Amazon S3 bucket containing the object to delete and returns this object, enabling additional method calls to be chained together.Sets the key of the object to delete and returns this object, enabling additional method calls to be chained together.withRequesterPays
(boolean isRequesterPays) Used for conducting this operation from a Requester Pays Bucket.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
-
DeleteObjectRequest
Constructs a newDeleteObjectRequest
, specifying the object's bucket name and key.- Parameters:
bucketName
- The name of the Amazon S3 bucket containing the object to delete.key
- The key of the object to delete.
-
-
Method Details
-
getBucketName
Gets the name of the Amazon S3 bucket containing the object to delete.- Returns:
- The name of the Amazon S3 bucket containing the object to delete.
- See Also:
-
setBucketName
Sets the name of the Amazon S3 bucket containing the object to delete.- Parameters:
bucketName
- The name of the Amazon S3 bucket containing the object to delete.- See Also:
-
withBucketName
Sets the name of the Amazon S3 bucket containing the object to delete and returns this object, enabling additional method calls to be chained together.- Parameters:
bucketName
- The name of the Amazon S3 bucket containing the object to delete.- Returns:
- The updated
DeleteObjectRequest
object, enabling additional method calls to be chained together.
-
getKey
Gets the key of the object to delete.- Returns:
- The key of the object to delete.
- See Also:
-
setKey
Sets the key of the object to delete.- Parameters:
key
- The key of the object to delete.- See Also:
-
withKey
Sets the key of the object to delete and returns this object, enabling additional method calls to be chained together.- Parameters:
key
- The key of the object to delete.- Returns:
- The updated
DeleteObjectRequest
object, enabling additional method calls to chained together.
-
isRequesterPays
public boolean isRequesterPays()Returns true if the user has enabled Requester Pays option when conducting this operation from Requester Pays Bucket; else false.If a bucket is enabled for Requester Pays, then any attempt to upload or download an object from it without Requester Pays enabled will result in a 403 error and the bucket owner will be charged for the request.
Enabling Requester Pays disables the ability to have anonymous access to this bucket
- Returns:
- true if the user has enabled Requester Pays option for conducting this operation from Requester Pays Bucket.
-
setRequesterPays
public void setRequesterPays(boolean isRequesterPays) Used for conducting this operation from a Requester Pays Bucket. If set the requester is charged for requests from the bucket.If a bucket is enabled for Requester Pays, then any attempt to upload or download an object from it without Requester Pays enabled will result in a 403 error and the bucket owner will be charged for the request.
Enabling Requester Pays disables the ability to have anonymous access to this bucket.
- Parameters:
isRequesterPays
- Enable Requester Pays option for the operation.
-
withRequesterPays
Used for conducting this operation from a Requester Pays Bucket. If set the requester is charged for requests from the bucket. It returns this updated DeleteObjectRequest object so that additional method calls can be chained together.If a bucket is enabled for Requester Pays, then any attempt to upload or download an object from it without Requester Pays enabled will result in a 403 error and the bucket owner will be charged for the request.
Enabling Requester Pays disables the ability to have anonymous access to this bucket.
- Parameters:
isRequesterPays
- Enable Requester Pays option for the operation.- Returns:
- The updated DeleteObjectRequest object.
-