Class DeleteObjectRequest
- java.lang.Object
-
- com.amazonaws.AmazonWebServiceRequest
-
- com.amazonaws.services.s3.model.DeleteObjectRequest
-
- All Implemented Interfaces:
ReadLimitInfo
,Serializable
,Cloneable
public class DeleteObjectRequest extends AmazonWebServiceRequest implements Serializable
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.
-
-
Field Summary
-
Fields inherited from class com.amazonaws.AmazonWebServiceRequest
NOOP
-
-
Constructor Summary
Constructors Constructor Description DeleteObjectRequest(String bucketName, String key)
Constructs a newDeleteObjectRequest
, specifying the object's bucket name and key.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getBucketName()
Gets the name of the Amazon S3 bucket containing the object to delete.String
getKey()
Gets the key of the object to delete.boolean
isRequesterPays()
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
setKey(String key)
Sets the key of the object to delete.void
setRequesterPays(boolean isRequesterPays)
Used for conducting this operation from a Requester Pays Bucket.DeleteObjectRequest
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.DeleteObjectRequest
withKey(String key)
Sets the key of the object to delete and returns this object, enabling additional method calls to be chained together.DeleteObjectRequest
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 Detail
-
DeleteObjectRequest
public DeleteObjectRequest(String bucketName, String key)
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 Detail
-
getBucketName
public String 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(String)
-
setBucketName
public void setBucketName(String bucketName)
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:
getBucketName()
-
withBucketName
public DeleteObjectRequest 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.- 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
public String getKey()
Gets the key of the object to delete.- Returns:
- The key of the object to delete.
- See Also:
setKey(String)
-
setKey
public void setKey(String key)
Sets the key of the object to delete.- Parameters:
key
- The key of the object to delete.- See Also:
getKey()
-
withKey
public DeleteObjectRequest withKey(String key)
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
public DeleteObjectRequest withRequesterPays(boolean isRequesterPays)
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.
-
-