{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
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
= receiveBytes
(\ 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 :: !ByteString
} deriving (Eq, Show, Data, Typeable, Generic)
getBucketPolicyResponse
:: Int
-> ByteString
-> GetBucketPolicyResponse
getBucketPolicyResponse pResponseStatus_ pPolicy_ =
GetBucketPolicyResponse'
{_gbprsResponseStatus = pResponseStatus_, _gbprsPolicy = pPolicy_}
gbprsResponseStatus :: Lens' GetBucketPolicyResponse Int
gbprsResponseStatus = lens _gbprsResponseStatus (\ s a -> s{_gbprsResponseStatus = a})
gbprsPolicy :: Lens' GetBucketPolicyResponse ByteString
gbprsPolicy = lens _gbprsPolicy (\ s a -> s{_gbprsPolicy = a})
instance NFData GetBucketPolicyResponse where