module Network.AWS.S3.ListBuckets
(
ListBuckets
, listBuckets
, ListBucketsResponse
, listBucketsResponse
, lbrBuckets
, lbrOwner
) where
import Network.AWS.Prelude
import Network.AWS.Request.S3
import Network.AWS.S3.Types
import qualified GHC.Exts
data ListBuckets = ListBuckets
deriving (Eq, Ord, Show, Generic)
listBuckets :: ListBuckets
listBuckets = ListBuckets
data ListBucketsResponse = ListBucketsResponse
{ _lbrBuckets :: List "Bucket" Bucket
, _lbrOwner :: Maybe Owner
} deriving (Eq, Show)
listBucketsResponse :: ListBucketsResponse
listBucketsResponse = ListBucketsResponse
{ _lbrBuckets = mempty
, _lbrOwner = Nothing
}
lbrBuckets :: Lens' ListBucketsResponse [Bucket]
lbrBuckets = lens _lbrBuckets (\s a -> s { _lbrBuckets = a }) . _List
lbrOwner :: Lens' ListBucketsResponse (Maybe Owner)
lbrOwner = lens _lbrOwner (\s a -> s { _lbrOwner = a })
instance ToPath ListBuckets where
toPath = const "/"
instance ToQuery ListBuckets where
toQuery = const mempty
instance ToHeaders ListBuckets
instance ToXMLRoot ListBuckets where
toXMLRoot = const (namespaced ns "ListBuckets" [])
instance ToXML ListBuckets
instance AWSRequest ListBuckets where
type Sv ListBuckets = S3
type Rs ListBuckets = ListBucketsResponse
request = get
response = xmlResponse
instance FromXML ListBucketsResponse where
parseXML x = ListBucketsResponse
<$> x .@ "Buckets"
<*> x .@? "Owner"