{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- 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_legalHold,
    putObjectLegalHold_versionId,
    putObjectLegalHold_requestPayer,
    putObjectLegalHold_contentMD5,
    putObjectLegalHold_expectedBucketOwner,
    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.Lens as Lens
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'
  { -- | Container element for the Legal Hold configuration you want to apply to
    -- the specified object.
    PutObjectLegalHold -> Maybe ObjectLockLegalHold
legalHold :: Prelude.Maybe ObjectLockLegalHold,
    -- | The version ID of the object that you want to place a Legal Hold on.
    PutObjectLegalHold -> Maybe ObjectVersionId
versionId :: Prelude.Maybe ObjectVersionId,
    PutObjectLegalHold -> Maybe RequestPayer
requestPayer :: Prelude.Maybe RequestPayer,
    -- | 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 will fail with an HTTP
    -- @403 (Access Denied)@ error.
    PutObjectLegalHold -> Maybe Text
expectedBucketOwner :: Prelude.Maybe Prelude.Text,
    -- | 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
(PutObjectLegalHold -> PutObjectLegalHold -> Bool)
-> (PutObjectLegalHold -> PutObjectLegalHold -> Bool)
-> Eq PutObjectLegalHold
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]
(Int -> ReadS PutObjectLegalHold)
-> ReadS [PutObjectLegalHold]
-> ReadPrec PutObjectLegalHold
-> ReadPrec [PutObjectLegalHold]
-> Read 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
(Int -> PutObjectLegalHold -> ShowS)
-> (PutObjectLegalHold -> String)
-> ([PutObjectLegalHold] -> ShowS)
-> Show PutObjectLegalHold
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. PutObjectLegalHold -> Rep PutObjectLegalHold x)
-> (forall x. Rep PutObjectLegalHold x -> PutObjectLegalHold)
-> Generic PutObjectLegalHold
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:
--
-- 'legalHold', 'putObjectLegalHold_legalHold' - Container element for the Legal Hold configuration you want to apply to
-- the specified object.
--
-- 'versionId', 'putObjectLegalHold_versionId' - The version ID of the object that you want to place a Legal Hold on.
--
-- 'requestPayer', 'putObjectLegalHold_requestPayer' - Undocumented member.
--
-- '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 will fail with an HTTP
-- @403 (Access Denied)@ error.
--
-- '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' :: Maybe ObjectLockLegalHold
-> Maybe ObjectVersionId
-> Maybe RequestPayer
-> Maybe Text
-> Maybe Text
-> BucketName
-> ObjectKey
-> PutObjectLegalHold
PutObjectLegalHold'
    { $sel:legalHold:PutObjectLegalHold' :: Maybe ObjectLockLegalHold
legalHold = Maybe ObjectLockLegalHold
forall a. Maybe a
Prelude.Nothing,
      $sel:versionId:PutObjectLegalHold' :: Maybe ObjectVersionId
versionId = Maybe ObjectVersionId
forall a. Maybe a
Prelude.Nothing,
      $sel:requestPayer:PutObjectLegalHold' :: Maybe RequestPayer
requestPayer = Maybe RequestPayer
forall a. Maybe a
Prelude.Nothing,
      $sel:contentMD5:PutObjectLegalHold' :: Maybe Text
contentMD5 = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:expectedBucketOwner:PutObjectLegalHold' :: Maybe Text
expectedBucketOwner = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:bucket:PutObjectLegalHold' :: BucketName
bucket = BucketName
pBucket_,
      $sel:key:PutObjectLegalHold' :: ObjectKey
key = ObjectKey
pKey_
    }

-- | 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 :: (Maybe ObjectLockLegalHold -> f (Maybe ObjectLockLegalHold))
-> PutObjectLegalHold -> f PutObjectLegalHold
putObjectLegalHold_legalHold = (PutObjectLegalHold -> Maybe ObjectLockLegalHold)
-> (PutObjectLegalHold
    -> Maybe ObjectLockLegalHold -> PutObjectLegalHold)
-> Lens
     PutObjectLegalHold
     PutObjectLegalHold
     (Maybe ObjectLockLegalHold)
     (Maybe ObjectLockLegalHold)
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)

-- | 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 :: (Maybe ObjectVersionId -> f (Maybe ObjectVersionId))
-> PutObjectLegalHold -> f PutObjectLegalHold
putObjectLegalHold_versionId = (PutObjectLegalHold -> Maybe ObjectVersionId)
-> (PutObjectLegalHold
    -> Maybe ObjectVersionId -> PutObjectLegalHold)
-> Lens
     PutObjectLegalHold
     PutObjectLegalHold
     (Maybe ObjectVersionId)
     (Maybe ObjectVersionId)
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)

-- | Undocumented member.
putObjectLegalHold_requestPayer :: Lens.Lens' PutObjectLegalHold (Prelude.Maybe RequestPayer)
putObjectLegalHold_requestPayer :: (Maybe RequestPayer -> f (Maybe RequestPayer))
-> PutObjectLegalHold -> f PutObjectLegalHold
putObjectLegalHold_requestPayer = (PutObjectLegalHold -> Maybe RequestPayer)
-> (PutObjectLegalHold -> Maybe RequestPayer -> PutObjectLegalHold)
-> Lens
     PutObjectLegalHold
     PutObjectLegalHold
     (Maybe RequestPayer)
     (Maybe 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 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 :: (Maybe Text -> f (Maybe Text))
-> PutObjectLegalHold -> f PutObjectLegalHold
putObjectLegalHold_contentMD5 = (PutObjectLegalHold -> Maybe Text)
-> (PutObjectLegalHold -> Maybe Text -> PutObjectLegalHold)
-> Lens
     PutObjectLegalHold PutObjectLegalHold (Maybe Text) (Maybe Text)
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 will fail with an HTTP
-- @403 (Access Denied)@ error.
putObjectLegalHold_expectedBucketOwner :: Lens.Lens' PutObjectLegalHold (Prelude.Maybe Prelude.Text)
putObjectLegalHold_expectedBucketOwner :: (Maybe Text -> f (Maybe Text))
-> PutObjectLegalHold -> f PutObjectLegalHold
putObjectLegalHold_expectedBucketOwner = (PutObjectLegalHold -> Maybe Text)
-> (PutObjectLegalHold -> Maybe Text -> PutObjectLegalHold)
-> Lens
     PutObjectLegalHold PutObjectLegalHold (Maybe Text) (Maybe Text)
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)

-- | 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 :: (BucketName -> f BucketName)
-> PutObjectLegalHold -> f PutObjectLegalHold
putObjectLegalHold_bucket = (PutObjectLegalHold -> BucketName)
-> (PutObjectLegalHold -> BucketName -> PutObjectLegalHold)
-> Lens PutObjectLegalHold PutObjectLegalHold BucketName BucketName
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 :: (ObjectKey -> f ObjectKey)
-> PutObjectLegalHold -> f PutObjectLegalHold
putObjectLegalHold_key = (PutObjectLegalHold -> ObjectKey)
-> (PutObjectLegalHold -> ObjectKey -> PutObjectLegalHold)
-> Lens PutObjectLegalHold PutObjectLegalHold ObjectKey ObjectKey
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 :: PutObjectLegalHold -> Request PutObjectLegalHold
request =
    Request PutObjectLegalHold -> Request PutObjectLegalHold
forall a. Request a -> Request a
Request.s3vhost
      (Request PutObjectLegalHold -> Request PutObjectLegalHold)
-> (PutObjectLegalHold -> Request PutObjectLegalHold)
-> PutObjectLegalHold
-> Request PutObjectLegalHold
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Service -> PutObjectLegalHold -> Request PutObjectLegalHold
forall a. (ToRequest a, ToElement a) => Service -> a -> Request a
Request.putXML Service
defaultService
  response :: Logger
-> Service
-> Proxy PutObjectLegalHold
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutObjectLegalHold)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse PutObjectLegalHold))
-> Logger
-> Service
-> Proxy PutObjectLegalHold
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutObjectLegalHold)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Maybe RequestCharged -> Int -> PutObjectLegalHoldResponse
PutObjectLegalHoldResponse'
            (Maybe RequestCharged -> Int -> PutObjectLegalHoldResponse)
-> Either String (Maybe RequestCharged)
-> Either String (Int -> PutObjectLegalHoldResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (ResponseHeaders
h ResponseHeaders
-> HeaderName -> Either String (Maybe RequestCharged)
forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String (Maybe a)
Core..#? HeaderName
"x-amz-request-charged")
            Either String (Int -> PutObjectLegalHoldResponse)
-> Either String Int -> Either String PutObjectLegalHoldResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable PutObjectLegalHold

instance Prelude.NFData PutObjectLegalHold

instance Core.ToElement PutObjectLegalHold where
  toElement :: PutObjectLegalHold -> Element
toElement PutObjectLegalHold' {Maybe Text
Maybe ObjectVersionId
Maybe ObjectLockLegalHold
Maybe RequestPayer
ObjectKey
BucketName
key :: ObjectKey
bucket :: BucketName
expectedBucketOwner :: Maybe Text
contentMD5 :: Maybe Text
requestPayer :: Maybe RequestPayer
versionId :: Maybe ObjectVersionId
legalHold :: Maybe ObjectLockLegalHold
$sel:key:PutObjectLegalHold' :: PutObjectLegalHold -> ObjectKey
$sel:bucket:PutObjectLegalHold' :: PutObjectLegalHold -> BucketName
$sel:expectedBucketOwner:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe Text
$sel:contentMD5:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe Text
$sel:requestPayer:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe RequestPayer
$sel:versionId:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe ObjectVersionId
$sel:legalHold:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe ObjectLockLegalHold
..} =
    Name -> Maybe ObjectLockLegalHold -> Element
forall a. ToXML a => Name -> a -> Element
Core.mkElement
      Name
"{http://s3.amazonaws.com/doc/2006-03-01/}LegalHold"
      Maybe ObjectLockLegalHold
legalHold

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

instance Core.ToPath PutObjectLegalHold where
  toPath :: PutObjectLegalHold -> ByteString
toPath PutObjectLegalHold' {Maybe Text
Maybe ObjectVersionId
Maybe ObjectLockLegalHold
Maybe RequestPayer
ObjectKey
BucketName
key :: ObjectKey
bucket :: BucketName
expectedBucketOwner :: Maybe Text
contentMD5 :: Maybe Text
requestPayer :: Maybe RequestPayer
versionId :: Maybe ObjectVersionId
legalHold :: Maybe ObjectLockLegalHold
$sel:key:PutObjectLegalHold' :: PutObjectLegalHold -> ObjectKey
$sel:bucket:PutObjectLegalHold' :: PutObjectLegalHold -> BucketName
$sel:expectedBucketOwner:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe Text
$sel:contentMD5:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe Text
$sel:requestPayer:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe RequestPayer
$sel:versionId:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe ObjectVersionId
$sel:legalHold:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe ObjectLockLegalHold
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/", BucketName -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS BucketName
bucket, ByteString
"/", ObjectKey -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS ObjectKey
key]

instance Core.ToQuery PutObjectLegalHold where
  toQuery :: PutObjectLegalHold -> QueryString
toQuery PutObjectLegalHold' {Maybe Text
Maybe ObjectVersionId
Maybe ObjectLockLegalHold
Maybe RequestPayer
ObjectKey
BucketName
key :: ObjectKey
bucket :: BucketName
expectedBucketOwner :: Maybe Text
contentMD5 :: Maybe Text
requestPayer :: Maybe RequestPayer
versionId :: Maybe ObjectVersionId
legalHold :: Maybe ObjectLockLegalHold
$sel:key:PutObjectLegalHold' :: PutObjectLegalHold -> ObjectKey
$sel:bucket:PutObjectLegalHold' :: PutObjectLegalHold -> BucketName
$sel:expectedBucketOwner:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe Text
$sel:contentMD5:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe Text
$sel:requestPayer:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe RequestPayer
$sel:versionId:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe ObjectVersionId
$sel:legalHold:PutObjectLegalHold' :: PutObjectLegalHold -> Maybe ObjectLockLegalHold
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"versionId" ByteString -> Maybe ObjectVersionId -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: 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
(PutObjectLegalHoldResponse -> PutObjectLegalHoldResponse -> Bool)
-> (PutObjectLegalHoldResponse
    -> PutObjectLegalHoldResponse -> Bool)
-> Eq PutObjectLegalHoldResponse
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]
(Int -> ReadS PutObjectLegalHoldResponse)
-> ReadS [PutObjectLegalHoldResponse]
-> ReadPrec PutObjectLegalHoldResponse
-> ReadPrec [PutObjectLegalHoldResponse]
-> Read 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
(Int -> PutObjectLegalHoldResponse -> ShowS)
-> (PutObjectLegalHoldResponse -> String)
-> ([PutObjectLegalHoldResponse] -> ShowS)
-> Show PutObjectLegalHoldResponse
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.
 PutObjectLegalHoldResponse -> Rep PutObjectLegalHoldResponse x)
-> (forall x.
    Rep PutObjectLegalHoldResponse x -> PutObjectLegalHoldResponse)
-> Generic PutObjectLegalHoldResponse
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' :: Maybe RequestCharged -> Int -> PutObjectLegalHoldResponse
PutObjectLegalHoldResponse'
    { $sel:requestCharged:PutObjectLegalHoldResponse' :: Maybe RequestCharged
requestCharged =
        Maybe 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 :: (Maybe RequestCharged -> f (Maybe RequestCharged))
-> PutObjectLegalHoldResponse -> f PutObjectLegalHoldResponse
putObjectLegalHoldResponse_requestCharged = (PutObjectLegalHoldResponse -> Maybe RequestCharged)
-> (PutObjectLegalHoldResponse
    -> Maybe RequestCharged -> PutObjectLegalHoldResponse)
-> Lens
     PutObjectLegalHoldResponse
     PutObjectLegalHoldResponse
     (Maybe RequestCharged)
     (Maybe 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 :: (Int -> f Int)
-> PutObjectLegalHoldResponse -> f PutObjectLegalHoldResponse
putObjectLegalHoldResponse_httpStatus = (PutObjectLegalHoldResponse -> Int)
-> (PutObjectLegalHoldResponse
    -> Int -> PutObjectLegalHoldResponse)
-> Lens
     PutObjectLegalHoldResponse PutObjectLegalHoldResponse Int Int
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