Copyright | (c) 2013-2023 Brendan Hay |
---|---|
License | Mozilla Public License, v. 2.0. |
Maintainer | Brendan Hay |
Stability | auto-generated |
Portability | non-portable (GHC extensions) |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Removes the null version (if there is one) of an object and inserts a delete marker, which becomes the latest version of the object. If there isn't a null version, Amazon S3 does not remove any objects but will still respond that the command was successful.
To remove a specific version, you must be the bucket owner and you must
use the version Id subresource. Using this subresource permanently
deletes the version. If the object deleted is a delete marker, Amazon S3
sets the response header, x-amz-delete-marker
, to true.
If the object you want to delete is in a bucket where the bucket
versioning configuration is MFA Delete enabled, you must include the
x-amz-mfa
request header in the DELETE versionId
request. Requests
that include x-amz-mfa
must use HTTPS.
For more information about MFA Delete, see Using MFA Delete. To see sample requests that use versioning, see Sample Request.
You can delete objects by explicitly calling DELETE Object or configure
its lifecycle
(PutBucketLifecycle)
to enable Amazon S3 to remove them for you. If you want to block users
or accounts from removing or deleting objects from your bucket, you must
deny them the s3:DeleteObject
, s3:DeleteObjectVersion
, and
s3:PutLifeCycleConfiguration
actions.
The following action is related to DeleteObject
:
Synopsis
- data DeleteObject = DeleteObject' {}
- newDeleteObject :: BucketName -> ObjectKey -> DeleteObject
- deleteObject_bypassGovernanceRetention :: Lens' DeleteObject (Maybe Bool)
- deleteObject_expectedBucketOwner :: Lens' DeleteObject (Maybe Text)
- deleteObject_mfa :: Lens' DeleteObject (Maybe Text)
- deleteObject_requestPayer :: Lens' DeleteObject (Maybe RequestPayer)
- deleteObject_versionId :: Lens' DeleteObject (Maybe ObjectVersionId)
- deleteObject_bucket :: Lens' DeleteObject BucketName
- deleteObject_key :: Lens' DeleteObject ObjectKey
- data DeleteObjectResponse = DeleteObjectResponse' {}
- newDeleteObjectResponse :: Int -> DeleteObjectResponse
- deleteObjectResponse_deleteMarker :: Lens' DeleteObjectResponse (Maybe Bool)
- deleteObjectResponse_requestCharged :: Lens' DeleteObjectResponse (Maybe RequestCharged)
- deleteObjectResponse_versionId :: Lens' DeleteObjectResponse (Maybe ObjectVersionId)
- deleteObjectResponse_httpStatus :: Lens' DeleteObjectResponse Int
Creating a Request
data DeleteObject Source #
See: newDeleteObject
smart constructor.
DeleteObject' | |
|
Instances
Create a value of DeleteObject
with all optional fields omitted.
Use generic-lens or optics to modify other optional fields.
The following record fields are available, with the corresponding lenses provided for backwards compatibility:
$sel:bypassGovernanceRetention:DeleteObject'
, deleteObject_bypassGovernanceRetention
- Indicates whether S3 Object Lock should bypass Governance-mode
restrictions to process this operation. To use this header, you must
have the s3:BypassGovernanceRetention
permission.
$sel:expectedBucketOwner:DeleteObject'
, deleteObject_expectedBucketOwner
- The account ID of the expected bucket owner. If the bucket is owned by a
different account, the request fails with the HTTP status code
403 Forbidden
(access denied).
$sel:mfa:DeleteObject'
, deleteObject_mfa
- The concatenation of the authentication device's serial number, a
space, and the value that is displayed on your authentication device.
Required to permanently delete a versioned object if versioning is
configured with MFA delete enabled.
$sel:requestPayer:DeleteObject'
, deleteObject_requestPayer
- Undocumented member.
DeleteObject
, deleteObject_versionId
- VersionId used to reference a specific version of the object.
DeleteObject
, deleteObject_bucket
- The bucket name of the bucket containing the object.
When using this action with an access point, you must direct requests to the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see Using access points in the Amazon S3 User Guide.
When using this action with Amazon S3 on Outposts, you must direct
requests to the S3 on Outposts hostname. The S3 on Outposts hostname
takes the form
AccessPointName
-
AccountId
.
outpostID
.s3-outposts.
Region
.amazonaws.com
.
When using this action with S3 on Outposts through the Amazon Web
Services SDKs, you provide the Outposts bucket ARN in place of the
bucket name. For more information about S3 on Outposts ARNs, see
Using Amazon S3 on Outposts
in the Amazon S3 User Guide.
DeleteObject
, deleteObject_key
- Key name of the object to delete.
Request Lenses
deleteObject_bypassGovernanceRetention :: Lens' DeleteObject (Maybe Bool) Source #
Indicates whether S3 Object Lock should bypass Governance-mode
restrictions to process this operation. To use this header, you must
have the s3:BypassGovernanceRetention
permission.
deleteObject_expectedBucketOwner :: Lens' DeleteObject (Maybe Text) Source #
The account ID of the expected bucket owner. If the bucket is owned by a
different account, the request fails with the HTTP status code
403 Forbidden
(access denied).
deleteObject_mfa :: Lens' DeleteObject (Maybe Text) Source #
The concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device. Required to permanently delete a versioned object if versioning is configured with MFA delete enabled.
deleteObject_requestPayer :: Lens' DeleteObject (Maybe RequestPayer) Source #
Undocumented member.
deleteObject_versionId :: Lens' DeleteObject (Maybe ObjectVersionId) Source #
VersionId used to reference a specific version of the object.
deleteObject_bucket :: Lens' DeleteObject BucketName Source #
The bucket name of the bucket containing the object.
When using this action with an access point, you must direct requests to the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see Using access points in the Amazon S3 User Guide.
When using this action with Amazon S3 on Outposts, you must direct
requests to the S3 on Outposts hostname. The S3 on Outposts hostname
takes the form
AccessPointName
-
AccountId
.
outpostID
.s3-outposts.
Region
.amazonaws.com
.
When using this action with S3 on Outposts through the Amazon Web
Services SDKs, you provide the Outposts bucket ARN in place of the
bucket name. For more information about S3 on Outposts ARNs, see
Using Amazon S3 on Outposts
in the Amazon S3 User Guide.
deleteObject_key :: Lens' DeleteObject ObjectKey Source #
Key name of the object to delete.
Destructuring the Response
data DeleteObjectResponse Source #
See: newDeleteObjectResponse
smart constructor.
DeleteObjectResponse' | |
|
Instances
newDeleteObjectResponse Source #
Create a value of DeleteObjectResponse
with all optional fields omitted.
Use generic-lens or optics to modify other optional fields.
The following record fields are available, with the corresponding lenses provided for backwards compatibility:
DeleteObjectResponse
, deleteObjectResponse_deleteMarker
- Specifies whether the versioned object that was permanently deleted was
(true) or was not (false) a delete marker.
$sel:requestCharged:DeleteObjectResponse'
, deleteObjectResponse_requestCharged
- Undocumented member.
DeleteObject
, deleteObjectResponse_versionId
- Returns the version ID of the delete marker created as a result of the
DELETE operation.
$sel:httpStatus:DeleteObjectResponse'
, deleteObjectResponse_httpStatus
- The response's http status code.
Response Lenses
deleteObjectResponse_deleteMarker :: Lens' DeleteObjectResponse (Maybe Bool) Source #
Specifies whether the versioned object that was permanently deleted was (true) or was not (false) a delete marker.
deleteObjectResponse_requestCharged :: Lens' DeleteObjectResponse (Maybe RequestCharged) Source #
Undocumented member.
deleteObjectResponse_versionId :: Lens' DeleteObjectResponse (Maybe ObjectVersionId) Source #
Returns the version ID of the delete marker created as a result of the DELETE operation.
deleteObjectResponse_httpStatus :: Lens' DeleteObjectResponse Int Source #
The response's http status code.