module Network.AWS.S3.GetBucketPolicy
(
GetBucketPolicy
, getBucketPolicy
, gbpBucket
, GetBucketPolicyResponse
, getBucketPolicyResponse
, gbprPolicy
) where
import Network.AWS.Prelude
import Network.AWS.Request.S3
import Network.AWS.S3.Types
import qualified GHC.Exts
newtype GetBucketPolicy = GetBucketPolicy
{ _gbpBucket :: Text
} deriving (Eq, Ord, Show, Monoid, IsString)
getBucketPolicy :: Text
-> GetBucketPolicy
getBucketPolicy p1 = GetBucketPolicy
{ _gbpBucket = p1
}
gbpBucket :: Lens' GetBucketPolicy Text
gbpBucket = lens _gbpBucket (\s a -> s { _gbpBucket = a })
newtype GetBucketPolicyResponse = GetBucketPolicyResponse
{ _gbprPolicy :: Maybe Text
} deriving (Eq, Ord, Show, Monoid)
getBucketPolicyResponse :: GetBucketPolicyResponse
getBucketPolicyResponse = GetBucketPolicyResponse
{ _gbprPolicy = Nothing
}
gbprPolicy :: Lens' GetBucketPolicyResponse (Maybe Text)
gbprPolicy = lens _gbprPolicy (\s a -> s { _gbprPolicy = a })
instance ToPath GetBucketPolicy where
toPath GetBucketPolicy{..} = mconcat
[ "/"
, toText _gbpBucket
]
instance ToQuery GetBucketPolicy where
toQuery = const "policy"
instance ToHeaders GetBucketPolicy
instance ToXMLRoot GetBucketPolicy where
toXMLRoot = const (namespaced ns "GetBucketPolicy" [])
instance ToXML GetBucketPolicy
instance AWSRequest GetBucketPolicy where
type Sv GetBucketPolicy = S3
type Rs GetBucketPolicy = GetBucketPolicyResponse
request = get
response = xmlResponse
instance FromXML GetBucketPolicyResponse where
parseXML x = GetBucketPolicyResponse
<$> x .@? "Policy"