libZSservicesZSamazonka-s3ZSamazonka-s3
Copyright(c) 2013-2021 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay <brendan.g.hay+amazonka@gmail.com>
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellNone

Amazonka.S3.DeleteObject

Description

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

Creating a Request

data DeleteObject Source #

See: newDeleteObject smart constructor.

Constructors

DeleteObject' 

Fields

  • versionId :: Maybe ObjectVersionId

    VersionId used to reference a specific version of the object.

  • mfa :: Maybe Text

    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.

  • requestPayer :: Maybe RequestPayer
     
  • bypassGovernanceRetention :: Maybe Bool

    Indicates whether S3 Object Lock should bypass Governance-mode restrictions to process this operation. To use this header, you must have the s3:PutBucketPublicAccessBlock permission.

  • expectedBucketOwner :: Maybe Text

    The account ID of the expected bucket owner. If the bucket is owned by a different account, the request will fail with an HTTP 403 (Access Denied) error.

  • bucket :: BucketName

    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 using 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 S3 on Outposts in the Amazon S3 User Guide.

  • key :: ObjectKey

    Key name of the object to delete.

Instances

Instances details
Eq DeleteObject Source # 
Instance details

Defined in Amazonka.S3.DeleteObject

Read DeleteObject Source # 
Instance details

Defined in Amazonka.S3.DeleteObject

Show DeleteObject Source # 
Instance details

Defined in Amazonka.S3.DeleteObject

Generic DeleteObject Source # 
Instance details

Defined in Amazonka.S3.DeleteObject

Associated Types

type Rep DeleteObject :: Type -> Type #

NFData DeleteObject Source # 
Instance details

Defined in Amazonka.S3.DeleteObject

Methods

rnf :: DeleteObject -> () #

Hashable DeleteObject Source # 
Instance details

Defined in Amazonka.S3.DeleteObject

AWSRequest DeleteObject Source # 
Instance details

Defined in Amazonka.S3.DeleteObject

Associated Types

type AWSResponse DeleteObject #

ToHeaders DeleteObject Source # 
Instance details

Defined in Amazonka.S3.DeleteObject

ToPath DeleteObject Source # 
Instance details

Defined in Amazonka.S3.DeleteObject

ToQuery DeleteObject Source # 
Instance details

Defined in Amazonka.S3.DeleteObject

type Rep DeleteObject Source # 
Instance details

Defined in Amazonka.S3.DeleteObject

type AWSResponse DeleteObject Source # 
Instance details

Defined in Amazonka.S3.DeleteObject

newDeleteObject Source #

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:versionId:DeleteObject', deleteObject_versionId - VersionId used to reference a specific version of the object.

$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.

$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:PutBucketPublicAccessBlock 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 will fail with an HTTP 403 (Access Denied) error.

$sel:bucket: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 using 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 S3 on Outposts in the Amazon S3 User Guide.

$sel:key:DeleteObject', deleteObject_key - Key name of the object to delete.

Request Lenses

deleteObject_versionId :: Lens' DeleteObject (Maybe ObjectVersionId) Source #

VersionId used to reference a specific version of the object.

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_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:PutBucketPublicAccessBlock 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 will fail with an HTTP 403 (Access Denied) error.

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 using 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 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.

Constructors

DeleteObjectResponse' 

Fields

Instances

Instances details
Eq DeleteObjectResponse Source # 
Instance details

Defined in Amazonka.S3.DeleteObject

Read DeleteObjectResponse Source # 
Instance details

Defined in Amazonka.S3.DeleteObject

Show DeleteObjectResponse Source # 
Instance details

Defined in Amazonka.S3.DeleteObject

Generic DeleteObjectResponse Source # 
Instance details

Defined in Amazonka.S3.DeleteObject

Associated Types

type Rep DeleteObjectResponse :: Type -> Type #

NFData DeleteObjectResponse Source # 
Instance details

Defined in Amazonka.S3.DeleteObject

Methods

rnf :: DeleteObjectResponse -> () #

type Rep DeleteObjectResponse Source # 
Instance details

Defined in Amazonka.S3.DeleteObject

type Rep DeleteObjectResponse = D1 ('MetaData "DeleteObjectResponse" "Amazonka.S3.DeleteObject" "libZSservicesZSamazonka-s3ZSamazonka-s3" 'False) (C1 ('MetaCons "DeleteObjectResponse'" 'PrefixI 'True) ((S1 ('MetaSel ('Just "requestCharged") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe RequestCharged)) :*: S1 ('MetaSel ('Just "versionId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe ObjectVersionId))) :*: (S1 ('MetaSel ('Just "deleteMarker") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Bool)) :*: S1 ('MetaSel ('Just "httpStatus") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int))))

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:

$sel:requestCharged:DeleteObjectResponse', deleteObjectResponse_requestCharged - Undocumented member.

$sel:versionId:DeleteObject', deleteObjectResponse_versionId - Returns the version ID of the delete marker created as a result of the DELETE operation.

$sel:deleteMarker:DeleteObjectResponse', deleteObjectResponse_deleteMarker - Specifies whether the versioned object that was permanently deleted was (true) or was not (false) a delete marker.

$sel:httpStatus:DeleteObjectResponse', deleteObjectResponse_httpStatus - The response's http status code.

Response Lenses

deleteObjectResponse_versionId :: Lens' DeleteObjectResponse (Maybe ObjectVersionId) Source #

Returns the version ID of the delete marker created as a result of the DELETE operation.

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.