module Network.AWS.S3.GetBucketPolicy
(
getBucketPolicy
, GetBucketPolicy
, gbpBucket
, getBucketPolicyResponse
, GetBucketPolicyResponse
, gbprsResponseStatus
, gbprsPolicy
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.S3.Types
import Network.AWS.S3.Types.Product
newtype GetBucketPolicy = GetBucketPolicy'
{ _gbpBucket :: BucketName
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getBucketPolicy
:: BucketName
-> GetBucketPolicy
getBucketPolicy pBucket_ = GetBucketPolicy' {_gbpBucket = pBucket_}
gbpBucket :: Lens' GetBucketPolicy BucketName
gbpBucket = lens _gbpBucket (\ s a -> s{_gbpBucket = a});
instance AWSRequest GetBucketPolicy where
type Rs GetBucketPolicy = GetBucketPolicyResponse
request = get s3
response
= receiveJSON
(\ s h x ->
GetBucketPolicyResponse' <$>
(pure (fromEnum s)) <*> (pure x))
instance Hashable GetBucketPolicy where
instance NFData GetBucketPolicy where
instance ToHeaders GetBucketPolicy where
toHeaders = const mempty
instance ToPath GetBucketPolicy where
toPath GetBucketPolicy'{..}
= mconcat ["/", toBS _gbpBucket]
instance ToQuery GetBucketPolicy where
toQuery = const (mconcat ["policy"])
data GetBucketPolicyResponse = GetBucketPolicyResponse'
{ _gbprsResponseStatus :: !Int
, _gbprsPolicy :: !(HashMap Text Value)
} deriving (Eq, Show, Data, Typeable, Generic)
getBucketPolicyResponse
:: Int
-> HashMap Text Value
-> GetBucketPolicyResponse
getBucketPolicyResponse pResponseStatus_ pPolicy_ =
GetBucketPolicyResponse'
{_gbprsResponseStatus = pResponseStatus_, _gbprsPolicy = pPolicy_}
gbprsResponseStatus :: Lens' GetBucketPolicyResponse Int
gbprsResponseStatus = lens _gbprsResponseStatus (\ s a -> s{_gbprsResponseStatus = a});
gbprsPolicy :: Lens' GetBucketPolicyResponse (HashMap Text Value)
gbprsPolicy = lens _gbprsPolicy (\ s a -> s{_gbprsPolicy = a});
instance NFData GetBucketPolicyResponse where