module Network.AWS.S3.PutBucketPolicy
(
PutBucketPolicy
, putBucketPolicy
, pbpBucket
, pbpContentMD5
, pbpPolicy
, PutBucketPolicyResponse
, putBucketPolicyResponse
) where
import Network.AWS.Prelude
import Network.AWS.Request.S3
import Network.AWS.S3.Types
import qualified GHC.Exts
data PutBucketPolicy = PutBucketPolicy
{ _pbpBucket :: Text
, _pbpContentMD5 :: Maybe Text
, _pbpPolicy :: Text
} deriving (Eq, Ord, Show)
putBucketPolicy :: Text
-> Text
-> PutBucketPolicy
putBucketPolicy p1 p2 = PutBucketPolicy
{ _pbpBucket = p1
, _pbpPolicy = p2
, _pbpContentMD5 = Nothing
}
pbpBucket :: Lens' PutBucketPolicy Text
pbpBucket = lens _pbpBucket (\s a -> s { _pbpBucket = a })
pbpContentMD5 :: Lens' PutBucketPolicy (Maybe Text)
pbpContentMD5 = lens _pbpContentMD5 (\s a -> s { _pbpContentMD5 = a })
pbpPolicy :: Lens' PutBucketPolicy Text
pbpPolicy = lens _pbpPolicy (\s a -> s { _pbpPolicy = a })
data PutBucketPolicyResponse = PutBucketPolicyResponse
deriving (Eq, Ord, Show, Generic)
putBucketPolicyResponse :: PutBucketPolicyResponse
putBucketPolicyResponse = PutBucketPolicyResponse
instance ToPath PutBucketPolicy where
toPath PutBucketPolicy{..} = mconcat
[ "/"
, toText _pbpBucket
]
instance ToQuery PutBucketPolicy where
toQuery = const "policy"
instance ToHeaders PutBucketPolicy where
toHeaders PutBucketPolicy{..} = mconcat
[ "Content-MD5" =: _pbpContentMD5
]
instance ToXMLRoot PutBucketPolicy where
toXMLRoot PutBucketPolicy{..} = namespaced ns "PutBucketPolicy"
[ "Policy" =@ _pbpPolicy
]
instance ToXML PutBucketPolicy
instance AWSRequest PutBucketPolicy where
type Sv PutBucketPolicy = S3
type Rs PutBucketPolicy = PutBucketPolicyResponse
request = put
response = nullResponse PutBucketPolicyResponse