{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.S3.DeleteObject
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- 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
-- <https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMFADelete.html Using MFA Delete>.
-- To see sample requests that use versioning, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectDELETE.html#ExampleVersionObjectDelete Sample Request>.
--
-- You can delete objects by explicitly calling DELETE Object or configure
-- its lifecycle
-- (<https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketLifecycle.html 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@:
--
-- -   <https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html PutObject>
module Amazonka.S3.DeleteObject
  ( -- * Creating a Request
    DeleteObject (..),
    newDeleteObject,

    -- * Request Lenses
    deleteObject_bypassGovernanceRetention,
    deleteObject_expectedBucketOwner,
    deleteObject_mfa,
    deleteObject_requestPayer,
    deleteObject_versionId,
    deleteObject_bucket,
    deleteObject_key,

    -- * Destructuring the Response
    DeleteObjectResponse (..),
    newDeleteObjectResponse,

    -- * Response Lenses
    deleteObjectResponse_deleteMarker,
    deleteObjectResponse_requestCharged,
    deleteObjectResponse_versionId,
    deleteObjectResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.S3.Types

-- | /See:/ 'newDeleteObject' smart constructor.
data DeleteObject = DeleteObject'
  { -- | 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 -> Maybe Bool
bypassGovernanceRetention :: Prelude.Maybe Prelude.Bool,
    -- | 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 -> Maybe Text
expectedBucketOwner :: Prelude.Maybe Prelude.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.
    DeleteObject -> Maybe Text
mfa :: Prelude.Maybe Prelude.Text,
    DeleteObject -> Maybe RequestPayer
requestPayer :: Prelude.Maybe RequestPayer,
    -- | VersionId used to reference a specific version of the object.
    DeleteObject -> Maybe ObjectVersionId
versionId :: Prelude.Maybe ObjectVersionId,
    -- | 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
    -- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html 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
    -- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html Using Amazon S3 on Outposts>
    -- in the /Amazon S3 User Guide/.
    DeleteObject -> BucketName
bucket :: BucketName,
    -- | Key name of the object to delete.
    DeleteObject -> ObjectKey
key :: ObjectKey
  }
  deriving (DeleteObject -> DeleteObject -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteObject -> DeleteObject -> Bool
$c/= :: DeleteObject -> DeleteObject -> Bool
== :: DeleteObject -> DeleteObject -> Bool
$c== :: DeleteObject -> DeleteObject -> Bool
Prelude.Eq, ReadPrec [DeleteObject]
ReadPrec DeleteObject
Int -> ReadS DeleteObject
ReadS [DeleteObject]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteObject]
$creadListPrec :: ReadPrec [DeleteObject]
readPrec :: ReadPrec DeleteObject
$creadPrec :: ReadPrec DeleteObject
readList :: ReadS [DeleteObject]
$creadList :: ReadS [DeleteObject]
readsPrec :: Int -> ReadS DeleteObject
$creadsPrec :: Int -> ReadS DeleteObject
Prelude.Read, Int -> DeleteObject -> ShowS
[DeleteObject] -> ShowS
DeleteObject -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteObject] -> ShowS
$cshowList :: [DeleteObject] -> ShowS
show :: DeleteObject -> String
$cshow :: DeleteObject -> String
showsPrec :: Int -> DeleteObject -> ShowS
$cshowsPrec :: Int -> DeleteObject -> ShowS
Prelude.Show, forall x. Rep DeleteObject x -> DeleteObject
forall x. DeleteObject -> Rep DeleteObject x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteObject x -> DeleteObject
$cfrom :: forall x. DeleteObject -> Rep DeleteObject x
Prelude.Generic)

-- |
-- Create a value of 'DeleteObject' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'bypassGovernanceRetention', '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.
--
-- 'expectedBucketOwner', '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).
--
-- 'mfa', '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.
--
-- 'requestPayer', 'deleteObject_requestPayer' - Undocumented member.
--
-- 'versionId', 'deleteObject_versionId' - VersionId used to reference a specific version of the object.
--
-- 'bucket', '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
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html 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
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html Using Amazon S3 on Outposts>
-- in the /Amazon S3 User Guide/.
--
-- 'key', 'deleteObject_key' - Key name of the object to delete.
newDeleteObject ::
  -- | 'bucket'
  BucketName ->
  -- | 'key'
  ObjectKey ->
  DeleteObject
newDeleteObject :: BucketName -> ObjectKey -> DeleteObject
newDeleteObject BucketName
pBucket_ ObjectKey
pKey_ =
  DeleteObject'
    { $sel:bypassGovernanceRetention:DeleteObject' :: Maybe Bool
bypassGovernanceRetention =
        forall a. Maybe a
Prelude.Nothing,
      $sel:expectedBucketOwner:DeleteObject' :: Maybe Text
expectedBucketOwner = forall a. Maybe a
Prelude.Nothing,
      $sel:mfa:DeleteObject' :: Maybe Text
mfa = forall a. Maybe a
Prelude.Nothing,
      $sel:requestPayer:DeleteObject' :: Maybe RequestPayer
requestPayer = forall a. Maybe a
Prelude.Nothing,
      $sel:versionId:DeleteObject' :: Maybe ObjectVersionId
versionId = forall a. Maybe a
Prelude.Nothing,
      $sel:bucket:DeleteObject' :: BucketName
bucket = BucketName
pBucket_,
      $sel:key:DeleteObject' :: ObjectKey
key = ObjectKey
pKey_
    }

-- | 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_bypassGovernanceRetention :: Lens.Lens' DeleteObject (Prelude.Maybe Prelude.Bool)
deleteObject_bypassGovernanceRetention :: Lens' DeleteObject (Maybe Bool)
deleteObject_bypassGovernanceRetention = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteObject' {Maybe Bool
bypassGovernanceRetention :: Maybe Bool
$sel:bypassGovernanceRetention:DeleteObject' :: DeleteObject -> Maybe Bool
bypassGovernanceRetention} -> Maybe Bool
bypassGovernanceRetention) (\s :: DeleteObject
s@DeleteObject' {} Maybe Bool
a -> DeleteObject
s {$sel:bypassGovernanceRetention:DeleteObject' :: Maybe Bool
bypassGovernanceRetention = Maybe Bool
a} :: DeleteObject)

-- | 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_expectedBucketOwner :: Lens.Lens' DeleteObject (Prelude.Maybe Prelude.Text)
deleteObject_expectedBucketOwner :: Lens' DeleteObject (Maybe Text)
deleteObject_expectedBucketOwner = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteObject' {Maybe Text
expectedBucketOwner :: Maybe Text
$sel:expectedBucketOwner:DeleteObject' :: DeleteObject -> Maybe Text
expectedBucketOwner} -> Maybe Text
expectedBucketOwner) (\s :: DeleteObject
s@DeleteObject' {} Maybe Text
a -> DeleteObject
s {$sel:expectedBucketOwner:DeleteObject' :: Maybe Text
expectedBucketOwner = Maybe Text
a} :: DeleteObject)

-- | 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_mfa :: Lens.Lens' DeleteObject (Prelude.Maybe Prelude.Text)
deleteObject_mfa :: Lens' DeleteObject (Maybe Text)
deleteObject_mfa = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteObject' {Maybe Text
mfa :: Maybe Text
$sel:mfa:DeleteObject' :: DeleteObject -> Maybe Text
mfa} -> Maybe Text
mfa) (\s :: DeleteObject
s@DeleteObject' {} Maybe Text
a -> DeleteObject
s {$sel:mfa:DeleteObject' :: Maybe Text
mfa = Maybe Text
a} :: DeleteObject)

-- | Undocumented member.
deleteObject_requestPayer :: Lens.Lens' DeleteObject (Prelude.Maybe RequestPayer)
deleteObject_requestPayer :: Lens' DeleteObject (Maybe RequestPayer)
deleteObject_requestPayer = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteObject' {Maybe RequestPayer
requestPayer :: Maybe RequestPayer
$sel:requestPayer:DeleteObject' :: DeleteObject -> Maybe RequestPayer
requestPayer} -> Maybe RequestPayer
requestPayer) (\s :: DeleteObject
s@DeleteObject' {} Maybe RequestPayer
a -> DeleteObject
s {$sel:requestPayer:DeleteObject' :: Maybe RequestPayer
requestPayer = Maybe RequestPayer
a} :: DeleteObject)

-- | VersionId used to reference a specific version of the object.
deleteObject_versionId :: Lens.Lens' DeleteObject (Prelude.Maybe ObjectVersionId)
deleteObject_versionId :: Lens' DeleteObject (Maybe ObjectVersionId)
deleteObject_versionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteObject' {Maybe ObjectVersionId
versionId :: Maybe ObjectVersionId
$sel:versionId:DeleteObject' :: DeleteObject -> Maybe ObjectVersionId
versionId} -> Maybe ObjectVersionId
versionId) (\s :: DeleteObject
s@DeleteObject' {} Maybe ObjectVersionId
a -> DeleteObject
s {$sel:versionId:DeleteObject' :: Maybe ObjectVersionId
versionId = Maybe ObjectVersionId
a} :: DeleteObject)

-- | 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
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html 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
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html Using Amazon S3 on Outposts>
-- in the /Amazon S3 User Guide/.
deleteObject_bucket :: Lens.Lens' DeleteObject BucketName
deleteObject_bucket :: Lens' DeleteObject BucketName
deleteObject_bucket = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteObject' {BucketName
bucket :: BucketName
$sel:bucket:DeleteObject' :: DeleteObject -> BucketName
bucket} -> BucketName
bucket) (\s :: DeleteObject
s@DeleteObject' {} BucketName
a -> DeleteObject
s {$sel:bucket:DeleteObject' :: BucketName
bucket = BucketName
a} :: DeleteObject)

-- | Key name of the object to delete.
deleteObject_key :: Lens.Lens' DeleteObject ObjectKey
deleteObject_key :: Lens' DeleteObject ObjectKey
deleteObject_key = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteObject' {ObjectKey
key :: ObjectKey
$sel:key:DeleteObject' :: DeleteObject -> ObjectKey
key} -> ObjectKey
key) (\s :: DeleteObject
s@DeleteObject' {} ObjectKey
a -> DeleteObject
s {$sel:key:DeleteObject' :: ObjectKey
key = ObjectKey
a} :: DeleteObject)

instance Core.AWSRequest DeleteObject where
  type AWSResponse DeleteObject = DeleteObjectResponse
  request :: (Service -> Service) -> DeleteObject -> Request DeleteObject
request Service -> Service
overrides =
    forall a. Request a -> Request a
Request.s3vhost
      forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. ToRequest a => Service -> a -> Request a
Request.delete (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteObject
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteObject)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Maybe Bool
-> Maybe RequestCharged
-> Maybe ObjectVersionId
-> Int
-> DeleteObjectResponse
DeleteObjectResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (ResponseHeaders
h forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String (Maybe a)
Data..#? HeaderName
"x-amz-delete-marker")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (ResponseHeaders
h forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String (Maybe a)
Data..#? HeaderName
"x-amz-request-charged")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (ResponseHeaders
h forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String (Maybe a)
Data..#? HeaderName
"x-amz-version-id")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteObject where
  hashWithSalt :: Int -> DeleteObject -> Int
hashWithSalt Int
_salt DeleteObject' {Maybe Bool
Maybe Text
Maybe ObjectVersionId
Maybe RequestPayer
ObjectKey
BucketName
key :: ObjectKey
bucket :: BucketName
versionId :: Maybe ObjectVersionId
requestPayer :: Maybe RequestPayer
mfa :: Maybe Text
expectedBucketOwner :: Maybe Text
bypassGovernanceRetention :: Maybe Bool
$sel:key:DeleteObject' :: DeleteObject -> ObjectKey
$sel:bucket:DeleteObject' :: DeleteObject -> BucketName
$sel:versionId:DeleteObject' :: DeleteObject -> Maybe ObjectVersionId
$sel:requestPayer:DeleteObject' :: DeleteObject -> Maybe RequestPayer
$sel:mfa:DeleteObject' :: DeleteObject -> Maybe Text
$sel:expectedBucketOwner:DeleteObject' :: DeleteObject -> Maybe Text
$sel:bypassGovernanceRetention:DeleteObject' :: DeleteObject -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
bypassGovernanceRetention
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
expectedBucketOwner
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
mfa
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RequestPayer
requestPayer
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ObjectVersionId
versionId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` BucketName
bucket
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ObjectKey
key

instance Prelude.NFData DeleteObject where
  rnf :: DeleteObject -> ()
rnf DeleteObject' {Maybe Bool
Maybe Text
Maybe ObjectVersionId
Maybe RequestPayer
ObjectKey
BucketName
key :: ObjectKey
bucket :: BucketName
versionId :: Maybe ObjectVersionId
requestPayer :: Maybe RequestPayer
mfa :: Maybe Text
expectedBucketOwner :: Maybe Text
bypassGovernanceRetention :: Maybe Bool
$sel:key:DeleteObject' :: DeleteObject -> ObjectKey
$sel:bucket:DeleteObject' :: DeleteObject -> BucketName
$sel:versionId:DeleteObject' :: DeleteObject -> Maybe ObjectVersionId
$sel:requestPayer:DeleteObject' :: DeleteObject -> Maybe RequestPayer
$sel:mfa:DeleteObject' :: DeleteObject -> Maybe Text
$sel:expectedBucketOwner:DeleteObject' :: DeleteObject -> Maybe Text
$sel:bypassGovernanceRetention:DeleteObject' :: DeleteObject -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
bypassGovernanceRetention
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
expectedBucketOwner
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
mfa
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RequestPayer
requestPayer
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ObjectVersionId
versionId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf BucketName
bucket
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ObjectKey
key

instance Data.ToHeaders DeleteObject where
  toHeaders :: DeleteObject -> ResponseHeaders
toHeaders DeleteObject' {Maybe Bool
Maybe Text
Maybe ObjectVersionId
Maybe RequestPayer
ObjectKey
BucketName
key :: ObjectKey
bucket :: BucketName
versionId :: Maybe ObjectVersionId
requestPayer :: Maybe RequestPayer
mfa :: Maybe Text
expectedBucketOwner :: Maybe Text
bypassGovernanceRetention :: Maybe Bool
$sel:key:DeleteObject' :: DeleteObject -> ObjectKey
$sel:bucket:DeleteObject' :: DeleteObject -> BucketName
$sel:versionId:DeleteObject' :: DeleteObject -> Maybe ObjectVersionId
$sel:requestPayer:DeleteObject' :: DeleteObject -> Maybe RequestPayer
$sel:mfa:DeleteObject' :: DeleteObject -> Maybe Text
$sel:expectedBucketOwner:DeleteObject' :: DeleteObject -> Maybe Text
$sel:bypassGovernanceRetention:DeleteObject' :: DeleteObject -> Maybe Bool
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"x-amz-bypass-governance-retention"
          forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Maybe Bool
bypassGovernanceRetention,
        HeaderName
"x-amz-expected-bucket-owner"
          forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Maybe Text
expectedBucketOwner,
        HeaderName
"x-amz-mfa" forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Maybe Text
mfa,
        HeaderName
"x-amz-request-payer" forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Maybe RequestPayer
requestPayer
      ]

instance Data.ToPath DeleteObject where
  toPath :: DeleteObject -> ByteString
toPath DeleteObject' {Maybe Bool
Maybe Text
Maybe ObjectVersionId
Maybe RequestPayer
ObjectKey
BucketName
key :: ObjectKey
bucket :: BucketName
versionId :: Maybe ObjectVersionId
requestPayer :: Maybe RequestPayer
mfa :: Maybe Text
expectedBucketOwner :: Maybe Text
bypassGovernanceRetention :: Maybe Bool
$sel:key:DeleteObject' :: DeleteObject -> ObjectKey
$sel:bucket:DeleteObject' :: DeleteObject -> BucketName
$sel:versionId:DeleteObject' :: DeleteObject -> Maybe ObjectVersionId
$sel:requestPayer:DeleteObject' :: DeleteObject -> Maybe RequestPayer
$sel:mfa:DeleteObject' :: DeleteObject -> Maybe Text
$sel:expectedBucketOwner:DeleteObject' :: DeleteObject -> Maybe Text
$sel:bypassGovernanceRetention:DeleteObject' :: DeleteObject -> Maybe Bool
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/", forall a. ToByteString a => a -> ByteString
Data.toBS BucketName
bucket, ByteString
"/", forall a. ToByteString a => a -> ByteString
Data.toBS ObjectKey
key]

instance Data.ToQuery DeleteObject where
  toQuery :: DeleteObject -> QueryString
toQuery DeleteObject' {Maybe Bool
Maybe Text
Maybe ObjectVersionId
Maybe RequestPayer
ObjectKey
BucketName
key :: ObjectKey
bucket :: BucketName
versionId :: Maybe ObjectVersionId
requestPayer :: Maybe RequestPayer
mfa :: Maybe Text
expectedBucketOwner :: Maybe Text
bypassGovernanceRetention :: Maybe Bool
$sel:key:DeleteObject' :: DeleteObject -> ObjectKey
$sel:bucket:DeleteObject' :: DeleteObject -> BucketName
$sel:versionId:DeleteObject' :: DeleteObject -> Maybe ObjectVersionId
$sel:requestPayer:DeleteObject' :: DeleteObject -> Maybe RequestPayer
$sel:mfa:DeleteObject' :: DeleteObject -> Maybe Text
$sel:expectedBucketOwner:DeleteObject' :: DeleteObject -> Maybe Text
$sel:bypassGovernanceRetention:DeleteObject' :: DeleteObject -> Maybe Bool
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"versionId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe ObjectVersionId
versionId]

-- | /See:/ 'newDeleteObjectResponse' smart constructor.
data DeleteObjectResponse = DeleteObjectResponse'
  { -- | Specifies whether the versioned object that was permanently deleted was
    -- (true) or was not (false) a delete marker.
    DeleteObjectResponse -> Maybe Bool
deleteMarker :: Prelude.Maybe Prelude.Bool,
    DeleteObjectResponse -> Maybe RequestCharged
requestCharged :: Prelude.Maybe RequestCharged,
    -- | Returns the version ID of the delete marker created as a result of the
    -- DELETE operation.
    DeleteObjectResponse -> Maybe ObjectVersionId
versionId :: Prelude.Maybe ObjectVersionId,
    -- | The response's http status code.
    DeleteObjectResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteObjectResponse -> DeleteObjectResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteObjectResponse -> DeleteObjectResponse -> Bool
$c/= :: DeleteObjectResponse -> DeleteObjectResponse -> Bool
== :: DeleteObjectResponse -> DeleteObjectResponse -> Bool
$c== :: DeleteObjectResponse -> DeleteObjectResponse -> Bool
Prelude.Eq, ReadPrec [DeleteObjectResponse]
ReadPrec DeleteObjectResponse
Int -> ReadS DeleteObjectResponse
ReadS [DeleteObjectResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteObjectResponse]
$creadListPrec :: ReadPrec [DeleteObjectResponse]
readPrec :: ReadPrec DeleteObjectResponse
$creadPrec :: ReadPrec DeleteObjectResponse
readList :: ReadS [DeleteObjectResponse]
$creadList :: ReadS [DeleteObjectResponse]
readsPrec :: Int -> ReadS DeleteObjectResponse
$creadsPrec :: Int -> ReadS DeleteObjectResponse
Prelude.Read, Int -> DeleteObjectResponse -> ShowS
[DeleteObjectResponse] -> ShowS
DeleteObjectResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteObjectResponse] -> ShowS
$cshowList :: [DeleteObjectResponse] -> ShowS
show :: DeleteObjectResponse -> String
$cshow :: DeleteObjectResponse -> String
showsPrec :: Int -> DeleteObjectResponse -> ShowS
$cshowsPrec :: Int -> DeleteObjectResponse -> ShowS
Prelude.Show, forall x. Rep DeleteObjectResponse x -> DeleteObjectResponse
forall x. DeleteObjectResponse -> Rep DeleteObjectResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteObjectResponse x -> DeleteObjectResponse
$cfrom :: forall x. DeleteObjectResponse -> Rep DeleteObjectResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteObjectResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'deleteMarker', 'deleteObjectResponse_deleteMarker' - Specifies whether the versioned object that was permanently deleted was
-- (true) or was not (false) a delete marker.
--
-- 'requestCharged', 'deleteObjectResponse_requestCharged' - Undocumented member.
--
-- 'versionId', 'deleteObjectResponse_versionId' - Returns the version ID of the delete marker created as a result of the
-- DELETE operation.
--
-- 'httpStatus', 'deleteObjectResponse_httpStatus' - The response's http status code.
newDeleteObjectResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteObjectResponse
newDeleteObjectResponse :: Int -> DeleteObjectResponse
newDeleteObjectResponse Int
pHttpStatus_ =
  DeleteObjectResponse'
    { $sel:deleteMarker:DeleteObjectResponse' :: Maybe Bool
deleteMarker =
        forall a. Maybe a
Prelude.Nothing,
      $sel:requestCharged:DeleteObjectResponse' :: Maybe RequestCharged
requestCharged = forall a. Maybe a
Prelude.Nothing,
      $sel:versionId:DeleteObjectResponse' :: Maybe ObjectVersionId
versionId = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteObjectResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Specifies whether the versioned object that was permanently deleted was
-- (true) or was not (false) a delete marker.
deleteObjectResponse_deleteMarker :: Lens.Lens' DeleteObjectResponse (Prelude.Maybe Prelude.Bool)
deleteObjectResponse_deleteMarker :: Lens' DeleteObjectResponse (Maybe Bool)
deleteObjectResponse_deleteMarker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteObjectResponse' {Maybe Bool
deleteMarker :: Maybe Bool
$sel:deleteMarker:DeleteObjectResponse' :: DeleteObjectResponse -> Maybe Bool
deleteMarker} -> Maybe Bool
deleteMarker) (\s :: DeleteObjectResponse
s@DeleteObjectResponse' {} Maybe Bool
a -> DeleteObjectResponse
s {$sel:deleteMarker:DeleteObjectResponse' :: Maybe Bool
deleteMarker = Maybe Bool
a} :: DeleteObjectResponse)

-- | Undocumented member.
deleteObjectResponse_requestCharged :: Lens.Lens' DeleteObjectResponse (Prelude.Maybe RequestCharged)
deleteObjectResponse_requestCharged :: Lens' DeleteObjectResponse (Maybe RequestCharged)
deleteObjectResponse_requestCharged = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteObjectResponse' {Maybe RequestCharged
requestCharged :: Maybe RequestCharged
$sel:requestCharged:DeleteObjectResponse' :: DeleteObjectResponse -> Maybe RequestCharged
requestCharged} -> Maybe RequestCharged
requestCharged) (\s :: DeleteObjectResponse
s@DeleteObjectResponse' {} Maybe RequestCharged
a -> DeleteObjectResponse
s {$sel:requestCharged:DeleteObjectResponse' :: Maybe RequestCharged
requestCharged = Maybe RequestCharged
a} :: DeleteObjectResponse)

-- | Returns the version ID of the delete marker created as a result of the
-- DELETE operation.
deleteObjectResponse_versionId :: Lens.Lens' DeleteObjectResponse (Prelude.Maybe ObjectVersionId)
deleteObjectResponse_versionId :: Lens' DeleteObjectResponse (Maybe ObjectVersionId)
deleteObjectResponse_versionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteObjectResponse' {Maybe ObjectVersionId
versionId :: Maybe ObjectVersionId
$sel:versionId:DeleteObjectResponse' :: DeleteObjectResponse -> Maybe ObjectVersionId
versionId} -> Maybe ObjectVersionId
versionId) (\s :: DeleteObjectResponse
s@DeleteObjectResponse' {} Maybe ObjectVersionId
a -> DeleteObjectResponse
s {$sel:versionId:DeleteObjectResponse' :: Maybe ObjectVersionId
versionId = Maybe ObjectVersionId
a} :: DeleteObjectResponse)

-- | The response's http status code.
deleteObjectResponse_httpStatus :: Lens.Lens' DeleteObjectResponse Prelude.Int
deleteObjectResponse_httpStatus :: Lens' DeleteObjectResponse Int
deleteObjectResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteObjectResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteObjectResponse' :: DeleteObjectResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteObjectResponse
s@DeleteObjectResponse' {} Int
a -> DeleteObjectResponse
s {$sel:httpStatus:DeleteObjectResponse' :: Int
httpStatus = Int
a} :: DeleteObjectResponse)

instance Prelude.NFData DeleteObjectResponse where
  rnf :: DeleteObjectResponse -> ()
rnf DeleteObjectResponse' {Int
Maybe Bool
Maybe ObjectVersionId
Maybe RequestCharged
httpStatus :: Int
versionId :: Maybe ObjectVersionId
requestCharged :: Maybe RequestCharged
deleteMarker :: Maybe Bool
$sel:httpStatus:DeleteObjectResponse' :: DeleteObjectResponse -> Int
$sel:versionId:DeleteObjectResponse' :: DeleteObjectResponse -> Maybe ObjectVersionId
$sel:requestCharged:DeleteObjectResponse' :: DeleteObjectResponse -> Maybe RequestCharged
$sel:deleteMarker:DeleteObjectResponse' :: DeleteObjectResponse -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
deleteMarker
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RequestCharged
requestCharged
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ObjectVersionId
versionId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus