module Network.AWS.S3.GetBucketLocation
(
GetBucketLocation
, getBucketLocation
, gblBucket
, GetBucketLocationResponse
, getBucketLocationResponse
, gblrLocationConstraint
) where
import Network.AWS.Prelude
import Network.AWS.Request.RestXML
import Network.AWS.S3.Types
import qualified GHC.Exts
newtype GetBucketLocation = GetBucketLocation
{ _gblBucket :: Text
} deriving (Eq, Ord, Show, Monoid, IsString)
getBucketLocation :: Text
-> GetBucketLocation
getBucketLocation p1 = GetBucketLocation
{ _gblBucket = p1
}
gblBucket :: Lens' GetBucketLocation Text
gblBucket = lens _gblBucket (\s a -> s { _gblBucket = a })
newtype GetBucketLocationResponse = GetBucketLocationResponse
{ _gblrLocationConstraint :: Maybe Region
} deriving (Eq, Show)
getBucketLocationResponse :: GetBucketLocationResponse
getBucketLocationResponse = GetBucketLocationResponse
{ _gblrLocationConstraint = Nothing
}
gblrLocationConstraint :: Lens' GetBucketLocationResponse (Maybe Region)
gblrLocationConstraint =
lens _gblrLocationConstraint (\s a -> s { _gblrLocationConstraint = a })
instance ToPath GetBucketLocation where
toPath GetBucketLocation{..} = mconcat
[ "/"
, toText _gblBucket
]
instance ToQuery GetBucketLocation where
toQuery = const "location"
instance ToHeaders GetBucketLocation
instance ToXMLRoot GetBucketLocation where
toXMLRoot = const (namespaced ns "GetBucketLocation" [])
instance ToXML GetBucketLocation
instance AWSRequest GetBucketLocation where
type Sv GetBucketLocation = S3
type Rs GetBucketLocation = GetBucketLocationResponse
request = get
response = xmlResponse
instance FromXML GetBucketLocationResponse where
parseXML x = GetBucketLocationResponse
<$> x .@? "LocationConstraint"