{-# 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.PutBucketPolicy
-- 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 an Amazon S3 bucket policy to an Amazon S3 bucket. If you are
-- using an identity other than the root user of the Amazon Web Services
-- account that owns the bucket, the calling identity must have the
-- @PutBucketPolicy@ permissions on the specified bucket and belong to the
-- bucket owner\'s account in order to use this operation.
--
-- If you don\'t have @PutBucketPolicy@ permissions, Amazon S3 returns a
-- @403 Access Denied@ error. If you have the correct permissions, but
-- you\'re not using an identity that belongs to the bucket owner\'s
-- account, Amazon S3 returns a @405 Method Not Allowed@ error.
--
-- As a security precaution, the root user of the Amazon Web Services
-- account that owns a bucket can always use this operation, even if the
-- policy explicitly denies the root user the ability to perform this
-- action.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/example-bucket-policies.html Bucket policy examples>.
--
-- The following operations are related to @PutBucketPolicy@:
--
-- -   <https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucket.html CreateBucket>
--
-- -   <https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucket.html DeleteBucket>
module Amazonka.S3.PutBucketPolicy
  ( -- * Creating a Request
    PutBucketPolicy (..),
    newPutBucketPolicy,

    -- * Request Lenses
    putBucketPolicy_checksumAlgorithm,
    putBucketPolicy_confirmRemoveSelfBucketAccess,
    putBucketPolicy_contentMD5,
    putBucketPolicy_expectedBucketOwner,
    putBucketPolicy_bucket,
    putBucketPolicy_policy,

    -- * Destructuring the Response
    PutBucketPolicyResponse (..),
    newPutBucketPolicyResponse,
  )
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:/ 'newPutBucketPolicy' smart constructor.
data PutBucketPolicy = PutBucketPolicy'
  { -- | 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.
    PutBucketPolicy -> Maybe ChecksumAlgorithm
checksumAlgorithm :: Prelude.Maybe ChecksumAlgorithm,
    -- | Set this parameter to true to confirm that you want to remove your
    -- permissions to change this bucket policy in the future.
    PutBucketPolicy -> Maybe Bool
confirmRemoveSelfBucketAccess :: Prelude.Maybe Prelude.Bool,
    -- | The MD5 hash of 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.
    PutBucketPolicy -> 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).
    PutBucketPolicy -> Maybe Text
expectedBucketOwner :: Prelude.Maybe Prelude.Text,
    -- | The name of the bucket.
    PutBucketPolicy -> BucketName
bucket :: BucketName,
    -- | The bucket policy as a JSON document.
    PutBucketPolicy -> ByteString
policy :: Prelude.ByteString
  }
  deriving (PutBucketPolicy -> PutBucketPolicy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutBucketPolicy -> PutBucketPolicy -> Bool
$c/= :: PutBucketPolicy -> PutBucketPolicy -> Bool
== :: PutBucketPolicy -> PutBucketPolicy -> Bool
$c== :: PutBucketPolicy -> PutBucketPolicy -> Bool
Prelude.Eq, Int -> PutBucketPolicy -> ShowS
[PutBucketPolicy] -> ShowS
PutBucketPolicy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutBucketPolicy] -> ShowS
$cshowList :: [PutBucketPolicy] -> ShowS
show :: PutBucketPolicy -> String
$cshow :: PutBucketPolicy -> String
showsPrec :: Int -> PutBucketPolicy -> ShowS
$cshowsPrec :: Int -> PutBucketPolicy -> ShowS
Prelude.Show, forall x. Rep PutBucketPolicy x -> PutBucketPolicy
forall x. PutBucketPolicy -> Rep PutBucketPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutBucketPolicy x -> PutBucketPolicy
$cfrom :: forall x. PutBucketPolicy -> Rep PutBucketPolicy x
Prelude.Generic)

-- |
-- Create a value of 'PutBucketPolicy' 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', 'putBucketPolicy_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.
--
-- 'confirmRemoveSelfBucketAccess', 'putBucketPolicy_confirmRemoveSelfBucketAccess' - Set this parameter to true to confirm that you want to remove your
-- permissions to change this bucket policy in the future.
--
-- 'contentMD5', 'putBucketPolicy_contentMD5' - The MD5 hash of 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', 'putBucketPolicy_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).
--
-- 'bucket', 'putBucketPolicy_bucket' - The name of the bucket.
--
-- 'policy', 'putBucketPolicy_policy' - The bucket policy as a JSON document.
newPutBucketPolicy ::
  -- | 'bucket'
  BucketName ->
  -- | 'policy'
  Prelude.ByteString ->
  PutBucketPolicy
newPutBucketPolicy :: BucketName -> ByteString -> PutBucketPolicy
newPutBucketPolicy BucketName
pBucket_ ByteString
pPolicy_ =
  PutBucketPolicy'
    { $sel:checksumAlgorithm:PutBucketPolicy' :: Maybe ChecksumAlgorithm
checksumAlgorithm =
        forall a. Maybe a
Prelude.Nothing,
      $sel:confirmRemoveSelfBucketAccess:PutBucketPolicy' :: Maybe Bool
confirmRemoveSelfBucketAccess = forall a. Maybe a
Prelude.Nothing,
      $sel:contentMD5:PutBucketPolicy' :: Maybe Text
contentMD5 = forall a. Maybe a
Prelude.Nothing,
      $sel:expectedBucketOwner:PutBucketPolicy' :: Maybe Text
expectedBucketOwner = forall a. Maybe a
Prelude.Nothing,
      $sel:bucket:PutBucketPolicy' :: BucketName
bucket = BucketName
pBucket_,
      $sel:policy:PutBucketPolicy' :: ByteString
policy = ByteString
pPolicy_
    }

-- | 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.
putBucketPolicy_checksumAlgorithm :: Lens.Lens' PutBucketPolicy (Prelude.Maybe ChecksumAlgorithm)
putBucketPolicy_checksumAlgorithm :: Lens' PutBucketPolicy (Maybe ChecksumAlgorithm)
putBucketPolicy_checksumAlgorithm = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutBucketPolicy' {Maybe ChecksumAlgorithm
checksumAlgorithm :: Maybe ChecksumAlgorithm
$sel:checksumAlgorithm:PutBucketPolicy' :: PutBucketPolicy -> Maybe ChecksumAlgorithm
checksumAlgorithm} -> Maybe ChecksumAlgorithm
checksumAlgorithm) (\s :: PutBucketPolicy
s@PutBucketPolicy' {} Maybe ChecksumAlgorithm
a -> PutBucketPolicy
s {$sel:checksumAlgorithm:PutBucketPolicy' :: Maybe ChecksumAlgorithm
checksumAlgorithm = Maybe ChecksumAlgorithm
a} :: PutBucketPolicy)

-- | Set this parameter to true to confirm that you want to remove your
-- permissions to change this bucket policy in the future.
putBucketPolicy_confirmRemoveSelfBucketAccess :: Lens.Lens' PutBucketPolicy (Prelude.Maybe Prelude.Bool)
putBucketPolicy_confirmRemoveSelfBucketAccess :: Lens' PutBucketPolicy (Maybe Bool)
putBucketPolicy_confirmRemoveSelfBucketAccess = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutBucketPolicy' {Maybe Bool
confirmRemoveSelfBucketAccess :: Maybe Bool
$sel:confirmRemoveSelfBucketAccess:PutBucketPolicy' :: PutBucketPolicy -> Maybe Bool
confirmRemoveSelfBucketAccess} -> Maybe Bool
confirmRemoveSelfBucketAccess) (\s :: PutBucketPolicy
s@PutBucketPolicy' {} Maybe Bool
a -> PutBucketPolicy
s {$sel:confirmRemoveSelfBucketAccess:PutBucketPolicy' :: Maybe Bool
confirmRemoveSelfBucketAccess = Maybe Bool
a} :: PutBucketPolicy)

-- | The MD5 hash of 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.
putBucketPolicy_contentMD5 :: Lens.Lens' PutBucketPolicy (Prelude.Maybe Prelude.Text)
putBucketPolicy_contentMD5 :: Lens' PutBucketPolicy (Maybe Text)
putBucketPolicy_contentMD5 = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutBucketPolicy' {Maybe Text
contentMD5 :: Maybe Text
$sel:contentMD5:PutBucketPolicy' :: PutBucketPolicy -> Maybe Text
contentMD5} -> Maybe Text
contentMD5) (\s :: PutBucketPolicy
s@PutBucketPolicy' {} Maybe Text
a -> PutBucketPolicy
s {$sel:contentMD5:PutBucketPolicy' :: Maybe Text
contentMD5 = Maybe Text
a} :: PutBucketPolicy)

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

-- | The name of the bucket.
putBucketPolicy_bucket :: Lens.Lens' PutBucketPolicy BucketName
putBucketPolicy_bucket :: Lens' PutBucketPolicy BucketName
putBucketPolicy_bucket = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutBucketPolicy' {BucketName
bucket :: BucketName
$sel:bucket:PutBucketPolicy' :: PutBucketPolicy -> BucketName
bucket} -> BucketName
bucket) (\s :: PutBucketPolicy
s@PutBucketPolicy' {} BucketName
a -> PutBucketPolicy
s {$sel:bucket:PutBucketPolicy' :: BucketName
bucket = BucketName
a} :: PutBucketPolicy)

-- | The bucket policy as a JSON document.
putBucketPolicy_policy :: Lens.Lens' PutBucketPolicy Prelude.ByteString
putBucketPolicy_policy :: Lens' PutBucketPolicy ByteString
putBucketPolicy_policy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutBucketPolicy' {ByteString
policy :: ByteString
$sel:policy:PutBucketPolicy' :: PutBucketPolicy -> ByteString
policy} -> ByteString
policy) (\s :: PutBucketPolicy
s@PutBucketPolicy' {} ByteString
a -> PutBucketPolicy
s {$sel:policy:PutBucketPolicy' :: ByteString
policy = ByteString
a} :: PutBucketPolicy)

instance Core.AWSRequest PutBucketPolicy where
  type
    AWSResponse PutBucketPolicy =
      PutBucketPolicyResponse
  request :: (Service -> Service) -> PutBucketPolicy -> Request PutBucketPolicy
request Service -> Service
overrides =
    forall a. Request a -> Request a
Request.contentMD5Header
      forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Request a -> Request a
Request.s3vhost
      forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. (ToRequest a, ToBody a) => Service -> a -> Request a
Request.putBody (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy PutBucketPolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutBucketPolicy)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull PutBucketPolicyResponse
PutBucketPolicyResponse'

instance Prelude.Hashable PutBucketPolicy where
  hashWithSalt :: Int -> PutBucketPolicy -> Int
hashWithSalt Int
_salt PutBucketPolicy' {Maybe Bool
Maybe Text
Maybe ChecksumAlgorithm
ByteString
BucketName
policy :: ByteString
bucket :: BucketName
expectedBucketOwner :: Maybe Text
contentMD5 :: Maybe Text
confirmRemoveSelfBucketAccess :: Maybe Bool
checksumAlgorithm :: Maybe ChecksumAlgorithm
$sel:policy:PutBucketPolicy' :: PutBucketPolicy -> ByteString
$sel:bucket:PutBucketPolicy' :: PutBucketPolicy -> BucketName
$sel:expectedBucketOwner:PutBucketPolicy' :: PutBucketPolicy -> Maybe Text
$sel:contentMD5:PutBucketPolicy' :: PutBucketPolicy -> Maybe Text
$sel:confirmRemoveSelfBucketAccess:PutBucketPolicy' :: PutBucketPolicy -> Maybe Bool
$sel:checksumAlgorithm:PutBucketPolicy' :: PutBucketPolicy -> 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 Bool
confirmRemoveSelfBucketAccess
      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` BucketName
bucket
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ByteString
policy

instance Prelude.NFData PutBucketPolicy where
  rnf :: PutBucketPolicy -> ()
rnf PutBucketPolicy' {Maybe Bool
Maybe Text
Maybe ChecksumAlgorithm
ByteString
BucketName
policy :: ByteString
bucket :: BucketName
expectedBucketOwner :: Maybe Text
contentMD5 :: Maybe Text
confirmRemoveSelfBucketAccess :: Maybe Bool
checksumAlgorithm :: Maybe ChecksumAlgorithm
$sel:policy:PutBucketPolicy' :: PutBucketPolicy -> ByteString
$sel:bucket:PutBucketPolicy' :: PutBucketPolicy -> BucketName
$sel:expectedBucketOwner:PutBucketPolicy' :: PutBucketPolicy -> Maybe Text
$sel:contentMD5:PutBucketPolicy' :: PutBucketPolicy -> Maybe Text
$sel:confirmRemoveSelfBucketAccess:PutBucketPolicy' :: PutBucketPolicy -> Maybe Bool
$sel:checksumAlgorithm:PutBucketPolicy' :: PutBucketPolicy -> 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 Bool
confirmRemoveSelfBucketAccess
      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 BucketName
bucket
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ByteString
policy

instance Data.ToBody PutBucketPolicy where
  toBody :: PutBucketPolicy -> RequestBody
toBody PutBucketPolicy' {Maybe Bool
Maybe Text
Maybe ChecksumAlgorithm
ByteString
BucketName
policy :: ByteString
bucket :: BucketName
expectedBucketOwner :: Maybe Text
contentMD5 :: Maybe Text
confirmRemoveSelfBucketAccess :: Maybe Bool
checksumAlgorithm :: Maybe ChecksumAlgorithm
$sel:policy:PutBucketPolicy' :: PutBucketPolicy -> ByteString
$sel:bucket:PutBucketPolicy' :: PutBucketPolicy -> BucketName
$sel:expectedBucketOwner:PutBucketPolicy' :: PutBucketPolicy -> Maybe Text
$sel:contentMD5:PutBucketPolicy' :: PutBucketPolicy -> Maybe Text
$sel:confirmRemoveSelfBucketAccess:PutBucketPolicy' :: PutBucketPolicy -> Maybe Bool
$sel:checksumAlgorithm:PutBucketPolicy' :: PutBucketPolicy -> Maybe ChecksumAlgorithm
..} = forall a. ToBody a => a -> RequestBody
Data.toBody ByteString
policy

instance Data.ToHeaders PutBucketPolicy where
  toHeaders :: PutBucketPolicy -> [Header]
toHeaders PutBucketPolicy' {Maybe Bool
Maybe Text
Maybe ChecksumAlgorithm
ByteString
BucketName
policy :: ByteString
bucket :: BucketName
expectedBucketOwner :: Maybe Text
contentMD5 :: Maybe Text
confirmRemoveSelfBucketAccess :: Maybe Bool
checksumAlgorithm :: Maybe ChecksumAlgorithm
$sel:policy:PutBucketPolicy' :: PutBucketPolicy -> ByteString
$sel:bucket:PutBucketPolicy' :: PutBucketPolicy -> BucketName
$sel:expectedBucketOwner:PutBucketPolicy' :: PutBucketPolicy -> Maybe Text
$sel:contentMD5:PutBucketPolicy' :: PutBucketPolicy -> Maybe Text
$sel:confirmRemoveSelfBucketAccess:PutBucketPolicy' :: PutBucketPolicy -> Maybe Bool
$sel:checksumAlgorithm:PutBucketPolicy' :: PutBucketPolicy -> Maybe ChecksumAlgorithm
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"x-amz-sdk-checksum-algorithm"
          forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# Maybe ChecksumAlgorithm
checksumAlgorithm,
        HeaderName
"x-amz-confirm-remove-self-bucket-access"
          forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# Maybe Bool
confirmRemoveSelfBucketAccess,
        HeaderName
"Content-MD5" forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# Maybe Text
contentMD5,
        HeaderName
"x-amz-expected-bucket-owner"
          forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# Maybe Text
expectedBucketOwner
      ]

instance Data.ToPath PutBucketPolicy where
  toPath :: PutBucketPolicy -> ByteString
toPath PutBucketPolicy' {Maybe Bool
Maybe Text
Maybe ChecksumAlgorithm
ByteString
BucketName
policy :: ByteString
bucket :: BucketName
expectedBucketOwner :: Maybe Text
contentMD5 :: Maybe Text
confirmRemoveSelfBucketAccess :: Maybe Bool
checksumAlgorithm :: Maybe ChecksumAlgorithm
$sel:policy:PutBucketPolicy' :: PutBucketPolicy -> ByteString
$sel:bucket:PutBucketPolicy' :: PutBucketPolicy -> BucketName
$sel:expectedBucketOwner:PutBucketPolicy' :: PutBucketPolicy -> Maybe Text
$sel:contentMD5:PutBucketPolicy' :: PutBucketPolicy -> Maybe Text
$sel:confirmRemoveSelfBucketAccess:PutBucketPolicy' :: PutBucketPolicy -> Maybe Bool
$sel:checksumAlgorithm:PutBucketPolicy' :: PutBucketPolicy -> Maybe ChecksumAlgorithm
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/", forall a. ToByteString a => a -> ByteString
Data.toBS BucketName
bucket]

instance Data.ToQuery PutBucketPolicy where
  toQuery :: PutBucketPolicy -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const (forall a. Monoid a => [a] -> a
Prelude.mconcat [QueryString
"policy"])

-- | /See:/ 'newPutBucketPolicyResponse' smart constructor.
data PutBucketPolicyResponse = PutBucketPolicyResponse'
  {
  }
  deriving (PutBucketPolicyResponse -> PutBucketPolicyResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutBucketPolicyResponse -> PutBucketPolicyResponse -> Bool
$c/= :: PutBucketPolicyResponse -> PutBucketPolicyResponse -> Bool
== :: PutBucketPolicyResponse -> PutBucketPolicyResponse -> Bool
$c== :: PutBucketPolicyResponse -> PutBucketPolicyResponse -> Bool
Prelude.Eq, ReadPrec [PutBucketPolicyResponse]
ReadPrec PutBucketPolicyResponse
Int -> ReadS PutBucketPolicyResponse
ReadS [PutBucketPolicyResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutBucketPolicyResponse]
$creadListPrec :: ReadPrec [PutBucketPolicyResponse]
readPrec :: ReadPrec PutBucketPolicyResponse
$creadPrec :: ReadPrec PutBucketPolicyResponse
readList :: ReadS [PutBucketPolicyResponse]
$creadList :: ReadS [PutBucketPolicyResponse]
readsPrec :: Int -> ReadS PutBucketPolicyResponse
$creadsPrec :: Int -> ReadS PutBucketPolicyResponse
Prelude.Read, Int -> PutBucketPolicyResponse -> ShowS
[PutBucketPolicyResponse] -> ShowS
PutBucketPolicyResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutBucketPolicyResponse] -> ShowS
$cshowList :: [PutBucketPolicyResponse] -> ShowS
show :: PutBucketPolicyResponse -> String
$cshow :: PutBucketPolicyResponse -> String
showsPrec :: Int -> PutBucketPolicyResponse -> ShowS
$cshowsPrec :: Int -> PutBucketPolicyResponse -> ShowS
Prelude.Show, forall x. Rep PutBucketPolicyResponse x -> PutBucketPolicyResponse
forall x. PutBucketPolicyResponse -> Rep PutBucketPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutBucketPolicyResponse x -> PutBucketPolicyResponse
$cfrom :: forall x. PutBucketPolicyResponse -> Rep PutBucketPolicyResponse x
Prelude.Generic)

-- |
-- Create a value of 'PutBucketPolicyResponse' 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.
newPutBucketPolicyResponse ::
  PutBucketPolicyResponse
newPutBucketPolicyResponse :: PutBucketPolicyResponse
newPutBucketPolicyResponse = PutBucketPolicyResponse
PutBucketPolicyResponse'

instance Prelude.NFData PutBucketPolicyResponse where
  rnf :: PutBucketPolicyResponse -> ()
rnf PutBucketPolicyResponse
_ = ()