module Network.AWS.S3.GetBucketACL
(
getBucketACL
, GetBucketACL
, gbaBucket
, getBucketACLResponse
, GetBucketACLResponse
, gbarsGrants
, gbarsOwner
, gbarsResponseStatus
) 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 GetBucketACL = GetBucketACL'
{ _gbaBucket :: BucketName
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getBucketACL
:: BucketName
-> GetBucketACL
getBucketACL pBucket_ = GetBucketACL' {_gbaBucket = pBucket_}
gbaBucket :: Lens' GetBucketACL BucketName
gbaBucket = lens _gbaBucket (\ s a -> s{_gbaBucket = a});
instance AWSRequest GetBucketACL where
type Rs GetBucketACL = GetBucketACLResponse
request = get s3
response
= receiveXML
(\ s h x ->
GetBucketACLResponse' <$>
(x .@? "AccessControlList" .!@ mempty >>=
may (parseXMLList "Grant"))
<*> (x .@? "Owner")
<*> (pure (fromEnum s)))
instance Hashable GetBucketACL where
instance NFData GetBucketACL where
instance ToHeaders GetBucketACL where
toHeaders = const mempty
instance ToPath GetBucketACL where
toPath GetBucketACL'{..}
= mconcat ["/", toBS _gbaBucket]
instance ToQuery GetBucketACL where
toQuery = const (mconcat ["acl"])
data GetBucketACLResponse = GetBucketACLResponse'
{ _gbarsGrants :: !(Maybe [Grant])
, _gbarsOwner :: !(Maybe Owner)
, _gbarsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getBucketACLResponse
:: Int
-> GetBucketACLResponse
getBucketACLResponse pResponseStatus_ =
GetBucketACLResponse'
{ _gbarsGrants = Nothing
, _gbarsOwner = Nothing
, _gbarsResponseStatus = pResponseStatus_
}
gbarsGrants :: Lens' GetBucketACLResponse [Grant]
gbarsGrants = lens _gbarsGrants (\ s a -> s{_gbarsGrants = a}) . _Default . _Coerce;
gbarsOwner :: Lens' GetBucketACLResponse (Maybe Owner)
gbarsOwner = lens _gbarsOwner (\ s a -> s{_gbarsOwner = a});
gbarsResponseStatus :: Lens' GetBucketACLResponse Int
gbarsResponseStatus = lens _gbarsResponseStatus (\ s a -> s{_gbarsResponseStatus = a});
instance NFData GetBucketACLResponse where