module Network.AWS.S3.GetBucketLocation
(
getBucketLocation
, GetBucketLocation
, gblBucket
, getBucketLocationResponse
, GetBucketLocationResponse
, grsResponseStatus
, grsLocationConstraint
) where
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.S3.Types
import Network.AWS.S3.Types.Product
newtype GetBucketLocation = GetBucketLocation'
{ _gblBucket :: BucketName
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getBucketLocation
:: BucketName
-> GetBucketLocation
getBucketLocation pBucket_ =
GetBucketLocation'
{ _gblBucket = pBucket_
}
gblBucket :: Lens' GetBucketLocation BucketName
gblBucket = lens _gblBucket (\ s a -> s{_gblBucket = a});
instance AWSRequest GetBucketLocation where
type Rs GetBucketLocation = GetBucketLocationResponse
request = get s3
response
= receiveXML
(\ s h x ->
GetBucketLocationResponse' <$>
(pure (fromEnum s)) <*> (parseXML x))
instance ToHeaders GetBucketLocation where
toHeaders = const mempty
instance ToPath GetBucketLocation where
toPath GetBucketLocation'{..}
= mconcat ["/", toBS _gblBucket]
instance ToQuery GetBucketLocation where
toQuery = const (mconcat ["location"])
data GetBucketLocationResponse = GetBucketLocationResponse'
{ _grsResponseStatus :: !Int
, _grsLocationConstraint :: !Region
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getBucketLocationResponse
:: Int
-> Region
-> GetBucketLocationResponse
getBucketLocationResponse pResponseStatus_ pLocationConstraint_ =
GetBucketLocationResponse'
{ _grsResponseStatus = pResponseStatus_
, _grsLocationConstraint = pLocationConstraint_
}
grsResponseStatus :: Lens' GetBucketLocationResponse Int
grsResponseStatus = lens _grsResponseStatus (\ s a -> s{_grsResponseStatus = a});
grsLocationConstraint :: Lens' GetBucketLocationResponse Region
grsLocationConstraint = lens _grsLocationConstraint (\ s a -> s{_grsLocationConstraint = a});