{-# 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 #-}
module Amazonka.S3.PutBucketPolicy
(
PutBucketPolicy (..),
newPutBucketPolicy,
putBucketPolicy_confirmRemoveSelfBucketAccess,
putBucketPolicy_contentMD5,
putBucketPolicy_expectedBucketOwner,
putBucketPolicy_bucket,
putBucketPolicy_policy,
PutBucketPolicyResponse (..),
newPutBucketPolicyResponse,
)
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
data PutBucketPolicy = PutBucketPolicy'
{
PutBucketPolicy -> Maybe Bool
confirmRemoveSelfBucketAccess :: Prelude.Maybe Prelude.Bool,
PutBucketPolicy -> Maybe Text
contentMD5 :: Prelude.Maybe Prelude.Text,
PutBucketPolicy -> Maybe Text
expectedBucketOwner :: Prelude.Maybe Prelude.Text,
PutBucketPolicy -> BucketName
bucket :: BucketName,
PutBucketPolicy -> ByteString
policy :: Prelude.ByteString
}
deriving (PutBucketPolicy -> PutBucketPolicy -> Bool
(PutBucketPolicy -> PutBucketPolicy -> Bool)
-> (PutBucketPolicy -> PutBucketPolicy -> Bool)
-> Eq PutBucketPolicy
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
(Int -> PutBucketPolicy -> ShowS)
-> (PutBucketPolicy -> String)
-> ([PutBucketPolicy] -> ShowS)
-> Show PutBucketPolicy
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. PutBucketPolicy -> Rep PutBucketPolicy x)
-> (forall x. Rep PutBucketPolicy x -> PutBucketPolicy)
-> Generic PutBucketPolicy
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)
newPutBucketPolicy ::
BucketName ->
Prelude.ByteString ->
PutBucketPolicy
newPutBucketPolicy :: BucketName -> ByteString -> PutBucketPolicy
newPutBucketPolicy BucketName
pBucket_ ByteString
pPolicy_ =
PutBucketPolicy' :: Maybe Bool
-> Maybe Text
-> Maybe Text
-> BucketName
-> ByteString
-> PutBucketPolicy
PutBucketPolicy'
{ $sel:confirmRemoveSelfBucketAccess:PutBucketPolicy' :: Maybe Bool
confirmRemoveSelfBucketAccess =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:contentMD5:PutBucketPolicy' :: Maybe Text
contentMD5 = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:expectedBucketOwner:PutBucketPolicy' :: Maybe Text
expectedBucketOwner = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:bucket:PutBucketPolicy' :: BucketName
bucket = BucketName
pBucket_,
$sel:policy:PutBucketPolicy' :: ByteString
policy = ByteString
pPolicy_
}
putBucketPolicy_confirmRemoveSelfBucketAccess :: Lens.Lens' PutBucketPolicy (Prelude.Maybe Prelude.Bool)
putBucketPolicy_confirmRemoveSelfBucketAccess :: (Maybe Bool -> f (Maybe Bool))
-> PutBucketPolicy -> f PutBucketPolicy
putBucketPolicy_confirmRemoveSelfBucketAccess = (PutBucketPolicy -> Maybe Bool)
-> (PutBucketPolicy -> Maybe Bool -> PutBucketPolicy)
-> Lens PutBucketPolicy PutBucketPolicy (Maybe Bool) (Maybe Bool)
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)
putBucketPolicy_contentMD5 :: Lens.Lens' PutBucketPolicy (Prelude.Maybe Prelude.Text)
putBucketPolicy_contentMD5 :: (Maybe Text -> f (Maybe Text))
-> PutBucketPolicy -> f PutBucketPolicy
putBucketPolicy_contentMD5 = (PutBucketPolicy -> Maybe Text)
-> (PutBucketPolicy -> Maybe Text -> PutBucketPolicy)
-> Lens PutBucketPolicy PutBucketPolicy (Maybe Text) (Maybe Text)
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)
putBucketPolicy_expectedBucketOwner :: Lens.Lens' PutBucketPolicy (Prelude.Maybe Prelude.Text)
putBucketPolicy_expectedBucketOwner :: (Maybe Text -> f (Maybe Text))
-> PutBucketPolicy -> f PutBucketPolicy
putBucketPolicy_expectedBucketOwner = (PutBucketPolicy -> Maybe Text)
-> (PutBucketPolicy -> Maybe Text -> PutBucketPolicy)
-> Lens PutBucketPolicy PutBucketPolicy (Maybe Text) (Maybe Text)
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)
putBucketPolicy_bucket :: Lens.Lens' PutBucketPolicy BucketName
putBucketPolicy_bucket :: (BucketName -> f BucketName)
-> PutBucketPolicy -> f PutBucketPolicy
putBucketPolicy_bucket = (PutBucketPolicy -> BucketName)
-> (PutBucketPolicy -> BucketName -> PutBucketPolicy)
-> Lens PutBucketPolicy PutBucketPolicy BucketName BucketName
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)
putBucketPolicy_policy :: Lens.Lens' PutBucketPolicy Prelude.ByteString
putBucketPolicy_policy :: (ByteString -> f ByteString)
-> PutBucketPolicy -> f PutBucketPolicy
putBucketPolicy_policy = (PutBucketPolicy -> ByteString)
-> (PutBucketPolicy -> ByteString -> PutBucketPolicy)
-> Lens PutBucketPolicy PutBucketPolicy ByteString ByteString
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 :: PutBucketPolicy -> Request PutBucketPolicy
request =
Request PutBucketPolicy -> Request PutBucketPolicy
forall a. Request a -> Request a
Request.contentMD5Header
(Request PutBucketPolicy -> Request PutBucketPolicy)
-> (PutBucketPolicy -> Request PutBucketPolicy)
-> PutBucketPolicy
-> Request PutBucketPolicy
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Request PutBucketPolicy -> Request PutBucketPolicy
forall a. Request a -> Request a
Request.s3vhost
(Request PutBucketPolicy -> Request PutBucketPolicy)
-> (PutBucketPolicy -> Request PutBucketPolicy)
-> PutBucketPolicy
-> Request PutBucketPolicy
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Service -> PutBucketPolicy -> Request PutBucketPolicy
forall a. (ToRequest a, ToBody a) => Service -> a -> Request a
Request.putBody Service
defaultService
response :: Logger
-> Service
-> Proxy PutBucketPolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutBucketPolicy)))
response =
AWSResponse PutBucketPolicy
-> Logger
-> Service
-> Proxy PutBucketPolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutBucketPolicy)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse PutBucketPolicy
PutBucketPolicyResponse
PutBucketPolicyResponse'
instance Prelude.Hashable PutBucketPolicy
instance Prelude.NFData PutBucketPolicy
instance Core.ToBody PutBucketPolicy where
toBody :: PutBucketPolicy -> RequestBody
toBody PutBucketPolicy' {Maybe Bool
Maybe Text
ByteString
BucketName
policy :: ByteString
bucket :: BucketName
expectedBucketOwner :: Maybe Text
contentMD5 :: Maybe Text
confirmRemoveSelfBucketAccess :: Maybe Bool
$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
..} = ByteString -> RequestBody
forall a. ToBody a => a -> RequestBody
Core.toBody ByteString
policy
instance Core.ToHeaders PutBucketPolicy where
toHeaders :: PutBucketPolicy -> [Header]
toHeaders PutBucketPolicy' {Maybe Bool
Maybe Text
ByteString
BucketName
policy :: ByteString
bucket :: BucketName
expectedBucketOwner :: Maybe Text
contentMD5 :: Maybe Text
confirmRemoveSelfBucketAccess :: Maybe Bool
$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
..} =
[[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"x-amz-confirm-remove-self-bucket-access"
HeaderName -> Maybe Bool -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# Maybe Bool
confirmRemoveSelfBucketAccess,
HeaderName
"Content-MD5" HeaderName -> Maybe Text -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# Maybe Text
contentMD5,
HeaderName
"x-amz-expected-bucket-owner"
HeaderName -> Maybe Text -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# Maybe Text
expectedBucketOwner
]
instance Core.ToPath PutBucketPolicy where
toPath :: PutBucketPolicy -> ByteString
toPath PutBucketPolicy' {Maybe Bool
Maybe Text
ByteString
BucketName
policy :: ByteString
bucket :: BucketName
expectedBucketOwner :: Maybe Text
contentMD5 :: Maybe Text
confirmRemoveSelfBucketAccess :: Maybe Bool
$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
..} =
[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 PutBucketPolicy where
toQuery :: PutBucketPolicy -> QueryString
toQuery = QueryString -> PutBucketPolicy -> QueryString
forall a b. a -> b -> a
Prelude.const ([QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [QueryString
"policy"])
data PutBucketPolicyResponse = PutBucketPolicyResponse'
{
}
deriving (PutBucketPolicyResponse -> PutBucketPolicyResponse -> Bool
(PutBucketPolicyResponse -> PutBucketPolicyResponse -> Bool)
-> (PutBucketPolicyResponse -> PutBucketPolicyResponse -> Bool)
-> Eq PutBucketPolicyResponse
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]
(Int -> ReadS PutBucketPolicyResponse)
-> ReadS [PutBucketPolicyResponse]
-> ReadPrec PutBucketPolicyResponse
-> ReadPrec [PutBucketPolicyResponse]
-> Read 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
(Int -> PutBucketPolicyResponse -> ShowS)
-> (PutBucketPolicyResponse -> String)
-> ([PutBucketPolicyResponse] -> ShowS)
-> Show PutBucketPolicyResponse
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.
PutBucketPolicyResponse -> Rep PutBucketPolicyResponse x)
-> (forall x.
Rep PutBucketPolicyResponse x -> PutBucketPolicyResponse)
-> Generic PutBucketPolicyResponse
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)
newPutBucketPolicyResponse ::
PutBucketPolicyResponse
newPutBucketPolicyResponse :: PutBucketPolicyResponse
newPutBucketPolicyResponse = PutBucketPolicyResponse
PutBucketPolicyResponse'
instance Prelude.NFData PutBucketPolicyResponse