{-# 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.PutObjectLegalHold
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Applies a legal hold configuration to the specified object. For more
-- information, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html Locking Objects>.
--
-- This action is not supported by Amazon S3 on Outposts.
module Amazonka.S3.PutObjectLegalHold
  ( -- * Creating a Request
    PutObjectLegalHold (..),
    newPutObjectLegalHold,

    -- * Request Lenses
    putObjectLegalHold_checksumAlgorithm,
    putObjectLegalHold_contentMD5,
    putObjectLegalHold_expectedBucketOwner,
    putObjectLegalHold_legalHold,
    putObjectLegalHold_requestPayer,
    putObjectLegalHold_versionId,
    putObjectLegalHold_bucket,
    putObjectLegalHold_key,

    -- * Destructuring the Response
    PutObjectLegalHoldResponse (..),
    newPutObjectLegalHoldResponse,

    -- * Response Lenses
    putObjectLegalHoldResponse_requestCharged,
    putObjectLegalHoldResponse_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:/ 'newPutObjectLegalHold' smart constructor.
data PutObjectLegalHold = PutObjectLegalHold'
  { -- | Indicates the algorithm used to create the checksum for the object when
    -- using the SDK. This header will not provide any additional functionality
    -- if not using the SDK. When sending this header, there must be a
    -- corresponding @x-amz-checksum@ or @x-amz-trailer@ header sent.
    -- Otherwise, Amazon S3 fails the request with the HTTP status code
    -- @400 Bad Request@. For more information, see
    -- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html Checking object integrity>
    -- in the /Amazon S3 User Guide/.
    --
    -- If you provide an individual checksum, Amazon S3 ignores any provided
    -- @ChecksumAlgorithm@ parameter.
    PutObjectLegalHold -> Maybe ChecksumAlgorithm
checksumAlgorithm :: Prelude.Maybe ChecksumAlgorithm,
    -- | The MD5 hash for the request body.
    --
    -- For requests made using the Amazon Web Services Command Line Interface
    -- (CLI) or Amazon Web Services SDKs, this field is calculated
    -- automatically.
    PutObjectLegalHold -> Maybe Text
contentMD5 :: Prelude.Maybe Prelude.Text,
    -- | 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).
    PutObjectLegalHold -> Maybe Text
expectedBucketOwner :: Prelude.Maybe Prelude.Text,
    -- | Container element for the legal hold configuration you want to apply to
    -- the specified object.
    PutObjectLegalHold -> Maybe ObjectLockLegalHold
legalHold :: Prelude.Maybe ObjectLockLegalHold,
    PutObjectLegalHold -> Maybe RequestPayer
requestPayer :: Prelude.Maybe RequestPayer,
    -- | The version ID of the object that you want to place a legal hold on.
    PutObjectLegalHold -> Maybe ObjectVersionId
versionId :: Prelude.Maybe ObjectVersionId,
    -- | The bucket name containing the object that you want to place a legal
    -- hold on.
    --
    -- 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/.
    PutObjectLegalHold -> BucketName
bucket :: BucketName,
    -- | The key name for the object that you want to place a legal hold on.
    PutObjectLegalHold -> ObjectKey
key :: ObjectKey
  }
  deriving (PutObjectLegalHold -> PutObjectLegalHold -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutObjectLegalHold -> PutObjectLegalHold -> Bool
$c/= :: PutObjectLegalHold -> PutObjectLegalHold -> Bool
== :: PutObjectLegalHold -> PutObjectLegalHold -> Bool
$c== :: PutObjectLegalHold -> PutObjectLegalHold -> Bool
Prelude.Eq, ReadPrec [PutObjectLegalHold]
ReadPrec PutObjectLegalHold
Int -> ReadS PutObjectLegalHold
ReadS [PutObjectLegalHold]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutObjectLegalHold]
$creadListPrec :: ReadPrec [PutObjectLegalHold]
readPrec :: ReadPrec PutObjectLegalHold
$creadPrec :: ReadPrec PutObjectLegalHold
readList :: ReadS [PutObjectLegalHold]
$creadList :: ReadS [PutObjectLegalHold]
readsPrec :: Int -> ReadS PutObjectLegalHold
$creadsPrec :: Int -> ReadS PutObjectLegalHold
Prelude.Read, Int -> PutObjectLegalHold -> ShowS
[PutObjectLegalHold] -> ShowS
PutObjectLegalHold -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutObjectLegalHold] -> ShowS
$cshowList :: [PutObjectLegalHold] -> ShowS
show :: PutObjectLegalHold -> String
$cshow :: PutObjectLegalHold -> String
showsPrec :: Int -> PutObjectLegalHold -> ShowS
$cshowsPrec :: Int -> PutObjectLegalHold -> ShowS
Prelude.Show, forall x. Rep PutObjectLegalHold x -> PutObjectLegalHold
forall x. PutObjectLegalHold -> Rep PutObjectLegalHold x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutObjectLegalHold x -> PutObjectLegalHold
$cfrom :: forall x. PutObjectLegalHold -> Rep PutObjectLegalHold x
Prelude.Generic)

-- |
-- Create a value of 'PutObjectLegalHold' 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:
--
-- 'checksumAlgorithm', 'putObjectLegalHold_checksumAlgorithm' - Indicates the algorithm used to create the checksum for the object when
-- using the SDK. This header will not provide any additional functionality
-- if not using the SDK. When sending this header, there must be a
-- corresponding @x-amz-checksum@ or @x-amz-trailer@ header sent.
-- Otherwise, Amazon S3 fails the request with the HTTP status code
-- @400 Bad Request@. For more information, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html Checking object integrity>
-- in the /Amazon S3 User Guide/.
--
-- If you provide an individual checksum, Amazon S3 ignores any provided
-- @ChecksumAlgorithm@ parameter.
--
-- 'contentMD5', 'putObjectLegalHold_contentMD5' - The MD5 hash for the request body.
--
-- For requests made using the Amazon Web Services Command Line Interface
-- (CLI) or Amazon Web Services SDKs, this field is calculated
-- automatically.
--
-- 'expectedBucketOwner', 'putObjectLegalHold_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).
--
-- 'legalHold', 'putObjectLegalHold_legalHold' - Container element for the legal hold configuration you want to apply to
-- the specified object.
--
-- 'requestPayer', 'putObjectLegalHold_requestPayer' - Undocumented member.
--
-- 'versionId', 'putObjectLegalHold_versionId' - The version ID of the object that you want to place a legal hold on.
--
-- 'bucket', 'putObjectLegalHold_bucket' - The bucket name containing the object that you want to place a legal
-- hold on.
--
-- 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/.
--
-- 'key', 'putObjectLegalHold_key' - The key name for the object that you want to place a legal hold on.
newPutObjectLegalHold ::
  -- | 'bucket'
  BucketName ->
  -- | 'key'
  ObjectKey ->
  PutObjectLegalHold
newPutObjectLegalHold :: BucketName -> ObjectKey -> PutObjectLegalHold
newPutObjectLegalHold BucketName
pBucket_ ObjectKey
pKey_ =
  PutObjectLegalHold'
    { $sel:checksumAlgorithm:PutObjectLegalHold' :: Maybe ChecksumAlgorithm
checksumAlgorithm =
        forall a. Maybe a
Prelude.Nothing,
      $sel:contentMD5:PutObjectLegalHold' :: Maybe Text
contentMD5 = forall a. Maybe a
Prelude.Nothing,
      $sel:expectedBucketOwner:PutObjectLegalHold' :: Maybe Text
expectedBucketOwner = forall a. Maybe a
Prelude.Nothing,
      $sel:legalHold:PutObjectLegalHold' :: Maybe ObjectLockLegalHold
legalHold = forall a. Maybe a
Prelude.Nothing,
      $sel:requestPayer:PutObjectLegalHold' :: Maybe RequestPayer
requestPayer = forall a. Maybe a
Prelude.Nothing,
      $sel:versionId:PutObjectLegalHold' :: Maybe ObjectVersionId
versionId = forall a. Maybe a
Prelude.Nothing,
      $sel:bucket:PutObjectLegalHold' :: BucketName
bucket = BucketName
pBucket_,
      $sel:key:PutObjectLegalHold' :: ObjectKey
key = ObjectKey
pKey_
    }

-- | Indicates the algorithm used to create the checksum for the object when
-- using the SDK. This header will not provide any additional functionality
-- if not using the SDK. When sending this header, there must be a
-- corresponding @x-amz-checksum@ or @x-amz-trailer@ header sent.
-- Otherwise, Amazon S3 fails the request with the HTTP status code
-- @400 Bad Request@. For more information, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html Checking object integrity>
-- in the /Amazon S3 User Guide/.
--
-- If you provide an individual checksum, Amazon S3 ignores any provided
-- @ChecksumAlgorithm@ parameter.
putObjectLegalHold_checksumAlgorithm :: Lens.Lens' PutObjectLegalHold (Prelude.Maybe ChecksumAlgorithm)
putObjectLegalHold_checksumAlgorithm :: Lens' PutObjectLegalHold (Maybe ChecksumAlgorithm)
putObjectLegalHold_checksumAlgorithm = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutObjectLegalHold' {Maybe ChecksumAlgorithm
checksumAlgorithm :: Maybe ChecksumAlgorithm
$sel:checksumAlgorithm:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe ChecksumAlgorithm
checksumAlgorithm} -> Maybe ChecksumAlgorithm
checksumAlgorithm) (\s :: PutObjectLegalHold
s@PutObjectLegalHold' {} Maybe ChecksumAlgorithm
a -> PutObjectLegalHold
s {$sel:checksumAlgorithm:PutObjectLegalHold' :: Maybe ChecksumAlgorithm
checksumAlgorithm = Maybe ChecksumAlgorithm
a} :: PutObjectLegalHold)

-- | The MD5 hash for the request body.
--
-- For requests made using the Amazon Web Services Command Line Interface
-- (CLI) or Amazon Web Services SDKs, this field is calculated
-- automatically.
putObjectLegalHold_contentMD5 :: Lens.Lens' PutObjectLegalHold (Prelude.Maybe Prelude.Text)
putObjectLegalHold_contentMD5 :: Lens' PutObjectLegalHold (Maybe Text)
putObjectLegalHold_contentMD5 = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutObjectLegalHold' {Maybe Text
contentMD5 :: Maybe Text
$sel:contentMD5:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe Text
contentMD5} -> Maybe Text
contentMD5) (\s :: PutObjectLegalHold
s@PutObjectLegalHold' {} Maybe Text
a -> PutObjectLegalHold
s {$sel:contentMD5:PutObjectLegalHold' :: Maybe Text
contentMD5 = Maybe Text
a} :: PutObjectLegalHold)

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

-- | Container element for the legal hold configuration you want to apply to
-- the specified object.
putObjectLegalHold_legalHold :: Lens.Lens' PutObjectLegalHold (Prelude.Maybe ObjectLockLegalHold)
putObjectLegalHold_legalHold :: Lens' PutObjectLegalHold (Maybe ObjectLockLegalHold)
putObjectLegalHold_legalHold = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutObjectLegalHold' {Maybe ObjectLockLegalHold
legalHold :: Maybe ObjectLockLegalHold
$sel:legalHold:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe ObjectLockLegalHold
legalHold} -> Maybe ObjectLockLegalHold
legalHold) (\s :: PutObjectLegalHold
s@PutObjectLegalHold' {} Maybe ObjectLockLegalHold
a -> PutObjectLegalHold
s {$sel:legalHold:PutObjectLegalHold' :: Maybe ObjectLockLegalHold
legalHold = Maybe ObjectLockLegalHold
a} :: PutObjectLegalHold)

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

-- | The version ID of the object that you want to place a legal hold on.
putObjectLegalHold_versionId :: Lens.Lens' PutObjectLegalHold (Prelude.Maybe ObjectVersionId)
putObjectLegalHold_versionId :: Lens' PutObjectLegalHold (Maybe ObjectVersionId)
putObjectLegalHold_versionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutObjectLegalHold' {Maybe ObjectVersionId
versionId :: Maybe ObjectVersionId
$sel:versionId:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe ObjectVersionId
versionId} -> Maybe ObjectVersionId
versionId) (\s :: PutObjectLegalHold
s@PutObjectLegalHold' {} Maybe ObjectVersionId
a -> PutObjectLegalHold
s {$sel:versionId:PutObjectLegalHold' :: Maybe ObjectVersionId
versionId = Maybe ObjectVersionId
a} :: PutObjectLegalHold)

-- | The bucket name containing the object that you want to place a legal
-- hold on.
--
-- 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/.
putObjectLegalHold_bucket :: Lens.Lens' PutObjectLegalHold BucketName
putObjectLegalHold_bucket :: Lens' PutObjectLegalHold BucketName
putObjectLegalHold_bucket = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutObjectLegalHold' {BucketName
bucket :: BucketName
$sel:bucket:PutObjectLegalHold' :: PutObjectLegalHold -> BucketName
bucket} -> BucketName
bucket) (\s :: PutObjectLegalHold
s@PutObjectLegalHold' {} BucketName
a -> PutObjectLegalHold
s {$sel:bucket:PutObjectLegalHold' :: BucketName
bucket = BucketName
a} :: PutObjectLegalHold)

-- | The key name for the object that you want to place a legal hold on.
putObjectLegalHold_key :: Lens.Lens' PutObjectLegalHold ObjectKey
putObjectLegalHold_key :: Lens' PutObjectLegalHold ObjectKey
putObjectLegalHold_key = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutObjectLegalHold' {ObjectKey
key :: ObjectKey
$sel:key:PutObjectLegalHold' :: PutObjectLegalHold -> ObjectKey
key} -> ObjectKey
key) (\s :: PutObjectLegalHold
s@PutObjectLegalHold' {} ObjectKey
a -> PutObjectLegalHold
s {$sel:key:PutObjectLegalHold' :: ObjectKey
key = ObjectKey
a} :: PutObjectLegalHold)

instance Core.AWSRequest PutObjectLegalHold where
  type
    AWSResponse PutObjectLegalHold =
      PutObjectLegalHoldResponse
  request :: (Service -> Service)
-> PutObjectLegalHold -> Request PutObjectLegalHold
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, ToElement a) => Service -> a -> Request a
Request.putXML (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy PutObjectLegalHold
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutObjectLegalHold)))
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 RequestCharged -> Int -> PutObjectLegalHoldResponse
PutObjectLegalHoldResponse'
            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-request-charged")
            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 PutObjectLegalHold where
  hashWithSalt :: Int -> PutObjectLegalHold -> Int
hashWithSalt Int
_salt PutObjectLegalHold' {Maybe Text
Maybe ObjectVersionId
Maybe ChecksumAlgorithm
Maybe ObjectLockLegalHold
Maybe RequestPayer
ObjectKey
BucketName
key :: ObjectKey
bucket :: BucketName
versionId :: Maybe ObjectVersionId
requestPayer :: Maybe RequestPayer
legalHold :: Maybe ObjectLockLegalHold
expectedBucketOwner :: Maybe Text
contentMD5 :: Maybe Text
checksumAlgorithm :: Maybe ChecksumAlgorithm
$sel:key:PutObjectLegalHold' :: PutObjectLegalHold -> ObjectKey
$sel:bucket:PutObjectLegalHold' :: PutObjectLegalHold -> BucketName
$sel:versionId:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe ObjectVersionId
$sel:requestPayer:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe RequestPayer
$sel:legalHold:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe ObjectLockLegalHold
$sel:expectedBucketOwner:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe Text
$sel:contentMD5:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe Text
$sel:checksumAlgorithm:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe ChecksumAlgorithm
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ChecksumAlgorithm
checksumAlgorithm
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
contentMD5
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
expectedBucketOwner
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ObjectLockLegalHold
legalHold
      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 PutObjectLegalHold where
  rnf :: PutObjectLegalHold -> ()
rnf PutObjectLegalHold' {Maybe Text
Maybe ObjectVersionId
Maybe ChecksumAlgorithm
Maybe ObjectLockLegalHold
Maybe RequestPayer
ObjectKey
BucketName
key :: ObjectKey
bucket :: BucketName
versionId :: Maybe ObjectVersionId
requestPayer :: Maybe RequestPayer
legalHold :: Maybe ObjectLockLegalHold
expectedBucketOwner :: Maybe Text
contentMD5 :: Maybe Text
checksumAlgorithm :: Maybe ChecksumAlgorithm
$sel:key:PutObjectLegalHold' :: PutObjectLegalHold -> ObjectKey
$sel:bucket:PutObjectLegalHold' :: PutObjectLegalHold -> BucketName
$sel:versionId:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe ObjectVersionId
$sel:requestPayer:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe RequestPayer
$sel:legalHold:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe ObjectLockLegalHold
$sel:expectedBucketOwner:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe Text
$sel:contentMD5:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe Text
$sel:checksumAlgorithm:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe ChecksumAlgorithm
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ChecksumAlgorithm
checksumAlgorithm
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
contentMD5
      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 ObjectLockLegalHold
legalHold
      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.ToElement PutObjectLegalHold where
  toElement :: PutObjectLegalHold -> Element
toElement PutObjectLegalHold' {Maybe Text
Maybe ObjectVersionId
Maybe ChecksumAlgorithm
Maybe ObjectLockLegalHold
Maybe RequestPayer
ObjectKey
BucketName
key :: ObjectKey
bucket :: BucketName
versionId :: Maybe ObjectVersionId
requestPayer :: Maybe RequestPayer
legalHold :: Maybe ObjectLockLegalHold
expectedBucketOwner :: Maybe Text
contentMD5 :: Maybe Text
checksumAlgorithm :: Maybe ChecksumAlgorithm
$sel:key:PutObjectLegalHold' :: PutObjectLegalHold -> ObjectKey
$sel:bucket:PutObjectLegalHold' :: PutObjectLegalHold -> BucketName
$sel:versionId:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe ObjectVersionId
$sel:requestPayer:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe RequestPayer
$sel:legalHold:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe ObjectLockLegalHold
$sel:expectedBucketOwner:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe Text
$sel:contentMD5:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe Text
$sel:checksumAlgorithm:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe ChecksumAlgorithm
..} =
    forall a. ToXML a => Name -> a -> Element
Data.mkElement
      Name
"{http://s3.amazonaws.com/doc/2006-03-01/}LegalHold"
      Maybe ObjectLockLegalHold
legalHold

instance Data.ToHeaders PutObjectLegalHold where
  toHeaders :: PutObjectLegalHold -> ResponseHeaders
toHeaders PutObjectLegalHold' {Maybe Text
Maybe ObjectVersionId
Maybe ChecksumAlgorithm
Maybe ObjectLockLegalHold
Maybe RequestPayer
ObjectKey
BucketName
key :: ObjectKey
bucket :: BucketName
versionId :: Maybe ObjectVersionId
requestPayer :: Maybe RequestPayer
legalHold :: Maybe ObjectLockLegalHold
expectedBucketOwner :: Maybe Text
contentMD5 :: Maybe Text
checksumAlgorithm :: Maybe ChecksumAlgorithm
$sel:key:PutObjectLegalHold' :: PutObjectLegalHold -> ObjectKey
$sel:bucket:PutObjectLegalHold' :: PutObjectLegalHold -> BucketName
$sel:versionId:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe ObjectVersionId
$sel:requestPayer:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe RequestPayer
$sel:legalHold:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe ObjectLockLegalHold
$sel:expectedBucketOwner:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe Text
$sel:contentMD5:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe Text
$sel:checksumAlgorithm:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe ChecksumAlgorithm
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"x-amz-sdk-checksum-algorithm"
          forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Maybe ChecksumAlgorithm
checksumAlgorithm,
        HeaderName
"Content-MD5" forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Maybe Text
contentMD5,
        HeaderName
"x-amz-expected-bucket-owner"
          forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Maybe Text
expectedBucketOwner,
        HeaderName
"x-amz-request-payer" forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Maybe RequestPayer
requestPayer
      ]

instance Data.ToPath PutObjectLegalHold where
  toPath :: PutObjectLegalHold -> ByteString
toPath PutObjectLegalHold' {Maybe Text
Maybe ObjectVersionId
Maybe ChecksumAlgorithm
Maybe ObjectLockLegalHold
Maybe RequestPayer
ObjectKey
BucketName
key :: ObjectKey
bucket :: BucketName
versionId :: Maybe ObjectVersionId
requestPayer :: Maybe RequestPayer
legalHold :: Maybe ObjectLockLegalHold
expectedBucketOwner :: Maybe Text
contentMD5 :: Maybe Text
checksumAlgorithm :: Maybe ChecksumAlgorithm
$sel:key:PutObjectLegalHold' :: PutObjectLegalHold -> ObjectKey
$sel:bucket:PutObjectLegalHold' :: PutObjectLegalHold -> BucketName
$sel:versionId:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe ObjectVersionId
$sel:requestPayer:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe RequestPayer
$sel:legalHold:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe ObjectLockLegalHold
$sel:expectedBucketOwner:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe Text
$sel:contentMD5:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe Text
$sel:checksumAlgorithm:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe ChecksumAlgorithm
..} =
    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 PutObjectLegalHold where
  toQuery :: PutObjectLegalHold -> QueryString
toQuery PutObjectLegalHold' {Maybe Text
Maybe ObjectVersionId
Maybe ChecksumAlgorithm
Maybe ObjectLockLegalHold
Maybe RequestPayer
ObjectKey
BucketName
key :: ObjectKey
bucket :: BucketName
versionId :: Maybe ObjectVersionId
requestPayer :: Maybe RequestPayer
legalHold :: Maybe ObjectLockLegalHold
expectedBucketOwner :: Maybe Text
contentMD5 :: Maybe Text
checksumAlgorithm :: Maybe ChecksumAlgorithm
$sel:key:PutObjectLegalHold' :: PutObjectLegalHold -> ObjectKey
$sel:bucket:PutObjectLegalHold' :: PutObjectLegalHold -> BucketName
$sel:versionId:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe ObjectVersionId
$sel:requestPayer:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe RequestPayer
$sel:legalHold:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe ObjectLockLegalHold
$sel:expectedBucketOwner:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe Text
$sel:contentMD5:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe Text
$sel:checksumAlgorithm:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe ChecksumAlgorithm
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"versionId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe ObjectVersionId
versionId, QueryString
"legal-hold"]

-- | /See:/ 'newPutObjectLegalHoldResponse' smart constructor.
data PutObjectLegalHoldResponse = PutObjectLegalHoldResponse'
  { PutObjectLegalHoldResponse -> Maybe RequestCharged
requestCharged :: Prelude.Maybe RequestCharged,
    -- | The response's http status code.
    PutObjectLegalHoldResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (PutObjectLegalHoldResponse -> PutObjectLegalHoldResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutObjectLegalHoldResponse -> PutObjectLegalHoldResponse -> Bool
$c/= :: PutObjectLegalHoldResponse -> PutObjectLegalHoldResponse -> Bool
== :: PutObjectLegalHoldResponse -> PutObjectLegalHoldResponse -> Bool
$c== :: PutObjectLegalHoldResponse -> PutObjectLegalHoldResponse -> Bool
Prelude.Eq, ReadPrec [PutObjectLegalHoldResponse]
ReadPrec PutObjectLegalHoldResponse
Int -> ReadS PutObjectLegalHoldResponse
ReadS [PutObjectLegalHoldResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutObjectLegalHoldResponse]
$creadListPrec :: ReadPrec [PutObjectLegalHoldResponse]
readPrec :: ReadPrec PutObjectLegalHoldResponse
$creadPrec :: ReadPrec PutObjectLegalHoldResponse
readList :: ReadS [PutObjectLegalHoldResponse]
$creadList :: ReadS [PutObjectLegalHoldResponse]
readsPrec :: Int -> ReadS PutObjectLegalHoldResponse
$creadsPrec :: Int -> ReadS PutObjectLegalHoldResponse
Prelude.Read, Int -> PutObjectLegalHoldResponse -> ShowS
[PutObjectLegalHoldResponse] -> ShowS
PutObjectLegalHoldResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutObjectLegalHoldResponse] -> ShowS
$cshowList :: [PutObjectLegalHoldResponse] -> ShowS
show :: PutObjectLegalHoldResponse -> String
$cshow :: PutObjectLegalHoldResponse -> String
showsPrec :: Int -> PutObjectLegalHoldResponse -> ShowS
$cshowsPrec :: Int -> PutObjectLegalHoldResponse -> ShowS
Prelude.Show, forall x.
Rep PutObjectLegalHoldResponse x -> PutObjectLegalHoldResponse
forall x.
PutObjectLegalHoldResponse -> Rep PutObjectLegalHoldResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutObjectLegalHoldResponse x -> PutObjectLegalHoldResponse
$cfrom :: forall x.
PutObjectLegalHoldResponse -> Rep PutObjectLegalHoldResponse x
Prelude.Generic)

-- |
-- Create a value of 'PutObjectLegalHoldResponse' 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:
--
-- 'requestCharged', 'putObjectLegalHoldResponse_requestCharged' - Undocumented member.
--
-- 'httpStatus', 'putObjectLegalHoldResponse_httpStatus' - The response's http status code.
newPutObjectLegalHoldResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  PutObjectLegalHoldResponse
newPutObjectLegalHoldResponse :: Int -> PutObjectLegalHoldResponse
newPutObjectLegalHoldResponse Int
pHttpStatus_ =
  PutObjectLegalHoldResponse'
    { $sel:requestCharged:PutObjectLegalHoldResponse' :: Maybe RequestCharged
requestCharged =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:PutObjectLegalHoldResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

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

instance Prelude.NFData PutObjectLegalHoldResponse where
  rnf :: PutObjectLegalHoldResponse -> ()
rnf PutObjectLegalHoldResponse' {Int
Maybe RequestCharged
httpStatus :: Int
requestCharged :: Maybe RequestCharged
$sel:httpStatus:PutObjectLegalHoldResponse' :: PutObjectLegalHoldResponse -> Int
$sel:requestCharged:PutObjectLegalHoldResponse' :: PutObjectLegalHoldResponse -> Maybe RequestCharged
..} =
    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 Int
httpStatus