{-# 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.GetBucketTagging
(
getBucketTagging
, GetBucketTagging
, gbtBucket
, getBucketTaggingResponse
, GetBucketTaggingResponse
, gbtrsResponseStatus
, gbtrsTagSet
) 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 GetBucketTagging = GetBucketTagging'
{ _gbtBucket :: BucketName
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getBucketTagging
:: BucketName
-> GetBucketTagging
getBucketTagging pBucket_ = GetBucketTagging' {_gbtBucket = pBucket_}
gbtBucket :: Lens' GetBucketTagging BucketName
gbtBucket = lens _gbtBucket (\ s a -> s{_gbtBucket = a})
instance AWSRequest GetBucketTagging where
type Rs GetBucketTagging = GetBucketTaggingResponse
request = get s3
response
= receiveXML
(\ s h x ->
GetBucketTaggingResponse' <$>
(pure (fromEnum s)) <*>
(x .@? "TagSet" .!@ mempty >>= parseXMLList "Tag"))
instance Hashable GetBucketTagging where
instance NFData GetBucketTagging where
instance ToHeaders GetBucketTagging where
toHeaders = const mempty
instance ToPath GetBucketTagging where
toPath GetBucketTagging'{..}
= mconcat ["/", toBS _gbtBucket]
instance ToQuery GetBucketTagging where
toQuery = const (mconcat ["tagging"])
data GetBucketTaggingResponse = GetBucketTaggingResponse'
{ _gbtrsResponseStatus :: !Int
, _gbtrsTagSet :: ![Tag]
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getBucketTaggingResponse
:: Int
-> GetBucketTaggingResponse
getBucketTaggingResponse pResponseStatus_ =
GetBucketTaggingResponse'
{_gbtrsResponseStatus = pResponseStatus_, _gbtrsTagSet = mempty}
gbtrsResponseStatus :: Lens' GetBucketTaggingResponse Int
gbtrsResponseStatus = lens _gbtrsResponseStatus (\ s a -> s{_gbtrsResponseStatus = a})
gbtrsTagSet :: Lens' GetBucketTaggingResponse [Tag]
gbtrsTagSet = lens _gbtrsTagSet (\ s a -> s{_gbtrsTagSet = a}) . _Coerce
instance NFData GetBucketTaggingResponse where