{-# 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.PutObjectLockConfiguration
-- 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)
--
-- Places an Object Lock configuration on the specified bucket. The rule
-- specified in the Object Lock configuration will be applied by default to
-- every new object placed in the specified bucket. For more information,
-- see
-- <https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html Locking Objects>.
--
-- -   The @DefaultRetention@ settings require both a mode and a period.
--
-- -   The @DefaultRetention@ period can be either @Days@ or @Years@ but
--     you must select one. You cannot specify @Days@ and @Years@ at the
--     same time.
--
-- -   You can only enable Object Lock for new buckets. If you want to turn
--     on Object Lock for an existing bucket, contact Amazon Web Services
--     Support.
module Amazonka.S3.PutObjectLockConfiguration
  ( -- * Creating a Request
    PutObjectLockConfiguration (..),
    newPutObjectLockConfiguration,

    -- * Request Lenses
    putObjectLockConfiguration_token,
    putObjectLockConfiguration_objectLockConfiguration,
    putObjectLockConfiguration_requestPayer,
    putObjectLockConfiguration_contentMD5,
    putObjectLockConfiguration_expectedBucketOwner,
    putObjectLockConfiguration_bucket,

    -- * Destructuring the Response
    PutObjectLockConfigurationResponse (..),
    newPutObjectLockConfigurationResponse,

    -- * Response Lenses
    putObjectLockConfigurationResponse_requestCharged,
    putObjectLockConfigurationResponse_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:/ 'newPutObjectLockConfiguration' smart constructor.
data PutObjectLockConfiguration = PutObjectLockConfiguration'
  { -- | A token to allow Object Lock to be enabled for an existing bucket.
    PutObjectLockConfiguration -> Maybe Text
token :: Prelude.Maybe Prelude.Text,
    -- | The Object Lock configuration that you want to apply to the specified
    -- bucket.
    PutObjectLockConfiguration -> Maybe ObjectLockConfiguration
objectLockConfiguration :: Prelude.Maybe ObjectLockConfiguration,
    PutObjectLockConfiguration -> 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.
    PutObjectLockConfiguration -> 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.
    PutObjectLockConfiguration -> Maybe Text
expectedBucketOwner :: Prelude.Maybe Prelude.Text,
    -- | The bucket whose Object Lock configuration you want to create or
    -- replace.
    PutObjectLockConfiguration -> BucketName
bucket :: BucketName
  }
  deriving (PutObjectLockConfiguration -> PutObjectLockConfiguration -> Bool
(PutObjectLockConfiguration -> PutObjectLockConfiguration -> Bool)
-> (PutObjectLockConfiguration
    -> PutObjectLockConfiguration -> Bool)
-> Eq PutObjectLockConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutObjectLockConfiguration -> PutObjectLockConfiguration -> Bool
$c/= :: PutObjectLockConfiguration -> PutObjectLockConfiguration -> Bool
== :: PutObjectLockConfiguration -> PutObjectLockConfiguration -> Bool
$c== :: PutObjectLockConfiguration -> PutObjectLockConfiguration -> Bool
Prelude.Eq, ReadPrec [PutObjectLockConfiguration]
ReadPrec PutObjectLockConfiguration
Int -> ReadS PutObjectLockConfiguration
ReadS [PutObjectLockConfiguration]
(Int -> ReadS PutObjectLockConfiguration)
-> ReadS [PutObjectLockConfiguration]
-> ReadPrec PutObjectLockConfiguration
-> ReadPrec [PutObjectLockConfiguration]
-> Read PutObjectLockConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutObjectLockConfiguration]
$creadListPrec :: ReadPrec [PutObjectLockConfiguration]
readPrec :: ReadPrec PutObjectLockConfiguration
$creadPrec :: ReadPrec PutObjectLockConfiguration
readList :: ReadS [PutObjectLockConfiguration]
$creadList :: ReadS [PutObjectLockConfiguration]
readsPrec :: Int -> ReadS PutObjectLockConfiguration
$creadsPrec :: Int -> ReadS PutObjectLockConfiguration
Prelude.Read, Int -> PutObjectLockConfiguration -> ShowS
[PutObjectLockConfiguration] -> ShowS
PutObjectLockConfiguration -> String
(Int -> PutObjectLockConfiguration -> ShowS)
-> (PutObjectLockConfiguration -> String)
-> ([PutObjectLockConfiguration] -> ShowS)
-> Show PutObjectLockConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutObjectLockConfiguration] -> ShowS
$cshowList :: [PutObjectLockConfiguration] -> ShowS
show :: PutObjectLockConfiguration -> String
$cshow :: PutObjectLockConfiguration -> String
showsPrec :: Int -> PutObjectLockConfiguration -> ShowS
$cshowsPrec :: Int -> PutObjectLockConfiguration -> ShowS
Prelude.Show, (forall x.
 PutObjectLockConfiguration -> Rep PutObjectLockConfiguration x)
-> (forall x.
    Rep PutObjectLockConfiguration x -> PutObjectLockConfiguration)
-> Generic PutObjectLockConfiguration
forall x.
Rep PutObjectLockConfiguration x -> PutObjectLockConfiguration
forall x.
PutObjectLockConfiguration -> Rep PutObjectLockConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutObjectLockConfiguration x -> PutObjectLockConfiguration
$cfrom :: forall x.
PutObjectLockConfiguration -> Rep PutObjectLockConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'PutObjectLockConfiguration' 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:
--
-- 'token', 'putObjectLockConfiguration_token' - A token to allow Object Lock to be enabled for an existing bucket.
--
-- 'objectLockConfiguration', 'putObjectLockConfiguration_objectLockConfiguration' - The Object Lock configuration that you want to apply to the specified
-- bucket.
--
-- 'requestPayer', 'putObjectLockConfiguration_requestPayer' - Undocumented member.
--
-- 'contentMD5', 'putObjectLockConfiguration_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', 'putObjectLockConfiguration_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', 'putObjectLockConfiguration_bucket' - The bucket whose Object Lock configuration you want to create or
-- replace.
newPutObjectLockConfiguration ::
  -- | 'bucket'
  BucketName ->
  PutObjectLockConfiguration
newPutObjectLockConfiguration :: BucketName -> PutObjectLockConfiguration
newPutObjectLockConfiguration BucketName
pBucket_ =
  PutObjectLockConfiguration' :: Maybe Text
-> Maybe ObjectLockConfiguration
-> Maybe RequestPayer
-> Maybe Text
-> Maybe Text
-> BucketName
-> PutObjectLockConfiguration
PutObjectLockConfiguration'
    { $sel:token:PutObjectLockConfiguration' :: Maybe Text
token =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:objectLockConfiguration:PutObjectLockConfiguration' :: Maybe ObjectLockConfiguration
objectLockConfiguration = Maybe ObjectLockConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:requestPayer:PutObjectLockConfiguration' :: Maybe RequestPayer
requestPayer = Maybe RequestPayer
forall a. Maybe a
Prelude.Nothing,
      $sel:contentMD5:PutObjectLockConfiguration' :: Maybe Text
contentMD5 = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:expectedBucketOwner:PutObjectLockConfiguration' :: Maybe Text
expectedBucketOwner = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:bucket:PutObjectLockConfiguration' :: BucketName
bucket = BucketName
pBucket_
    }

-- | A token to allow Object Lock to be enabled for an existing bucket.
putObjectLockConfiguration_token :: Lens.Lens' PutObjectLockConfiguration (Prelude.Maybe Prelude.Text)
putObjectLockConfiguration_token :: (Maybe Text -> f (Maybe Text))
-> PutObjectLockConfiguration -> f PutObjectLockConfiguration
putObjectLockConfiguration_token = (PutObjectLockConfiguration -> Maybe Text)
-> (PutObjectLockConfiguration
    -> Maybe Text -> PutObjectLockConfiguration)
-> Lens
     PutObjectLockConfiguration
     PutObjectLockConfiguration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutObjectLockConfiguration' {Maybe Text
token :: Maybe Text
$sel:token:PutObjectLockConfiguration' :: PutObjectLockConfiguration -> Maybe Text
token} -> Maybe Text
token) (\s :: PutObjectLockConfiguration
s@PutObjectLockConfiguration' {} Maybe Text
a -> PutObjectLockConfiguration
s {$sel:token:PutObjectLockConfiguration' :: Maybe Text
token = Maybe Text
a} :: PutObjectLockConfiguration)

-- | The Object Lock configuration that you want to apply to the specified
-- bucket.
putObjectLockConfiguration_objectLockConfiguration :: Lens.Lens' PutObjectLockConfiguration (Prelude.Maybe ObjectLockConfiguration)
putObjectLockConfiguration_objectLockConfiguration :: (Maybe ObjectLockConfiguration
 -> f (Maybe ObjectLockConfiguration))
-> PutObjectLockConfiguration -> f PutObjectLockConfiguration
putObjectLockConfiguration_objectLockConfiguration = (PutObjectLockConfiguration -> Maybe ObjectLockConfiguration)
-> (PutObjectLockConfiguration
    -> Maybe ObjectLockConfiguration -> PutObjectLockConfiguration)
-> Lens
     PutObjectLockConfiguration
     PutObjectLockConfiguration
     (Maybe ObjectLockConfiguration)
     (Maybe ObjectLockConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutObjectLockConfiguration' {Maybe ObjectLockConfiguration
objectLockConfiguration :: Maybe ObjectLockConfiguration
$sel:objectLockConfiguration:PutObjectLockConfiguration' :: PutObjectLockConfiguration -> Maybe ObjectLockConfiguration
objectLockConfiguration} -> Maybe ObjectLockConfiguration
objectLockConfiguration) (\s :: PutObjectLockConfiguration
s@PutObjectLockConfiguration' {} Maybe ObjectLockConfiguration
a -> PutObjectLockConfiguration
s {$sel:objectLockConfiguration:PutObjectLockConfiguration' :: Maybe ObjectLockConfiguration
objectLockConfiguration = Maybe ObjectLockConfiguration
a} :: PutObjectLockConfiguration)

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

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

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

-- | The bucket whose Object Lock configuration you want to create or
-- replace.
putObjectLockConfiguration_bucket :: Lens.Lens' PutObjectLockConfiguration BucketName
putObjectLockConfiguration_bucket :: (BucketName -> f BucketName)
-> PutObjectLockConfiguration -> f PutObjectLockConfiguration
putObjectLockConfiguration_bucket = (PutObjectLockConfiguration -> BucketName)
-> (PutObjectLockConfiguration
    -> BucketName -> PutObjectLockConfiguration)
-> Lens
     PutObjectLockConfiguration
     PutObjectLockConfiguration
     BucketName
     BucketName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutObjectLockConfiguration' {BucketName
bucket :: BucketName
$sel:bucket:PutObjectLockConfiguration' :: PutObjectLockConfiguration -> BucketName
bucket} -> BucketName
bucket) (\s :: PutObjectLockConfiguration
s@PutObjectLockConfiguration' {} BucketName
a -> PutObjectLockConfiguration
s {$sel:bucket:PutObjectLockConfiguration' :: BucketName
bucket = BucketName
a} :: PutObjectLockConfiguration)

instance Core.AWSRequest PutObjectLockConfiguration where
  type
    AWSResponse PutObjectLockConfiguration =
      PutObjectLockConfigurationResponse
  request :: PutObjectLockConfiguration -> Request PutObjectLockConfiguration
request =
    Request PutObjectLockConfiguration
-> Request PutObjectLockConfiguration
forall a. Request a -> Request a
Request.s3vhost
      (Request PutObjectLockConfiguration
 -> Request PutObjectLockConfiguration)
-> (PutObjectLockConfiguration
    -> Request PutObjectLockConfiguration)
-> PutObjectLockConfiguration
-> Request PutObjectLockConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Service
-> PutObjectLockConfiguration -> Request PutObjectLockConfiguration
forall a. (ToRequest a, ToElement a) => Service -> a -> Request a
Request.putXML Service
defaultService
  response :: Logger
-> Service
-> Proxy PutObjectLockConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutObjectLockConfiguration)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse PutObjectLockConfiguration))
-> Logger
-> Service
-> Proxy PutObjectLockConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutObjectLockConfiguration)))
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 -> PutObjectLockConfigurationResponse
PutObjectLockConfigurationResponse'
            (Maybe RequestCharged -> Int -> PutObjectLockConfigurationResponse)
-> Either String (Maybe RequestCharged)
-> Either String (Int -> PutObjectLockConfigurationResponse)
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 -> PutObjectLockConfigurationResponse)
-> Either String Int
-> Either String PutObjectLockConfigurationResponse
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 PutObjectLockConfiguration

instance Prelude.NFData PutObjectLockConfiguration

instance Core.ToElement PutObjectLockConfiguration where
  toElement :: PutObjectLockConfiguration -> Element
toElement PutObjectLockConfiguration' {Maybe Text
Maybe ObjectLockConfiguration
Maybe RequestPayer
BucketName
bucket :: BucketName
expectedBucketOwner :: Maybe Text
contentMD5 :: Maybe Text
requestPayer :: Maybe RequestPayer
objectLockConfiguration :: Maybe ObjectLockConfiguration
token :: Maybe Text
$sel:bucket:PutObjectLockConfiguration' :: PutObjectLockConfiguration -> BucketName
$sel:expectedBucketOwner:PutObjectLockConfiguration' :: PutObjectLockConfiguration -> Maybe Text
$sel:contentMD5:PutObjectLockConfiguration' :: PutObjectLockConfiguration -> Maybe Text
$sel:requestPayer:PutObjectLockConfiguration' :: PutObjectLockConfiguration -> Maybe RequestPayer
$sel:objectLockConfiguration:PutObjectLockConfiguration' :: PutObjectLockConfiguration -> Maybe ObjectLockConfiguration
$sel:token:PutObjectLockConfiguration' :: PutObjectLockConfiguration -> Maybe Text
..} =
    Name -> Maybe ObjectLockConfiguration -> Element
forall a. ToXML a => Name -> a -> Element
Core.mkElement
      Name
"{http://s3.amazonaws.com/doc/2006-03-01/}ObjectLockConfiguration"
      Maybe ObjectLockConfiguration
objectLockConfiguration

instance Core.ToHeaders PutObjectLockConfiguration where
  toHeaders :: PutObjectLockConfiguration -> ResponseHeaders
toHeaders PutObjectLockConfiguration' {Maybe Text
Maybe ObjectLockConfiguration
Maybe RequestPayer
BucketName
bucket :: BucketName
expectedBucketOwner :: Maybe Text
contentMD5 :: Maybe Text
requestPayer :: Maybe RequestPayer
objectLockConfiguration :: Maybe ObjectLockConfiguration
token :: Maybe Text
$sel:bucket:PutObjectLockConfiguration' :: PutObjectLockConfiguration -> BucketName
$sel:expectedBucketOwner:PutObjectLockConfiguration' :: PutObjectLockConfiguration -> Maybe Text
$sel:contentMD5:PutObjectLockConfiguration' :: PutObjectLockConfiguration -> Maybe Text
$sel:requestPayer:PutObjectLockConfiguration' :: PutObjectLockConfiguration -> Maybe RequestPayer
$sel:objectLockConfiguration:PutObjectLockConfiguration' :: PutObjectLockConfiguration -> Maybe ObjectLockConfiguration
$sel:token:PutObjectLockConfiguration' :: PutObjectLockConfiguration -> Maybe Text
..} =
    [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"x-amz-bucket-object-lock-token" HeaderName -> Maybe Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe Text
token,
        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 PutObjectLockConfiguration where
  toPath :: PutObjectLockConfiguration -> ByteString
toPath PutObjectLockConfiguration' {Maybe Text
Maybe ObjectLockConfiguration
Maybe RequestPayer
BucketName
bucket :: BucketName
expectedBucketOwner :: Maybe Text
contentMD5 :: Maybe Text
requestPayer :: Maybe RequestPayer
objectLockConfiguration :: Maybe ObjectLockConfiguration
token :: Maybe Text
$sel:bucket:PutObjectLockConfiguration' :: PutObjectLockConfiguration -> BucketName
$sel:expectedBucketOwner:PutObjectLockConfiguration' :: PutObjectLockConfiguration -> Maybe Text
$sel:contentMD5:PutObjectLockConfiguration' :: PutObjectLockConfiguration -> Maybe Text
$sel:requestPayer:PutObjectLockConfiguration' :: PutObjectLockConfiguration -> Maybe RequestPayer
$sel:objectLockConfiguration:PutObjectLockConfiguration' :: PutObjectLockConfiguration -> Maybe ObjectLockConfiguration
$sel:token:PutObjectLockConfiguration' :: PutObjectLockConfiguration -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/", BucketName -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS BucketName
bucket]

instance Core.ToQuery PutObjectLockConfiguration where
  toQuery :: PutObjectLockConfiguration -> QueryString
toQuery =
    QueryString -> PutObjectLockConfiguration -> QueryString
forall a b. a -> b -> a
Prelude.const ([QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [QueryString
"object-lock"])

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

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

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

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

instance
  Prelude.NFData
    PutObjectLockConfigurationResponse