{-# 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.DynamoDB.ListTagsOfResource
(
listTagsOfResource
, ListTagsOfResource
, ltorNextToken
, ltorResourceARN
, listTagsOfResourceResponse
, ListTagsOfResourceResponse
, ltorrsNextToken
, ltorrsTags
, ltorrsResponseStatus
) where
import Network.AWS.DynamoDB.Types
import Network.AWS.DynamoDB.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data ListTagsOfResource = ListTagsOfResource'
{ _ltorNextToken :: !(Maybe Text)
, _ltorResourceARN :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listTagsOfResource
:: Text
-> ListTagsOfResource
listTagsOfResource pResourceARN_ =
ListTagsOfResource'
{_ltorNextToken = Nothing, _ltorResourceARN = pResourceARN_}
ltorNextToken :: Lens' ListTagsOfResource (Maybe Text)
ltorNextToken = lens _ltorNextToken (\ s a -> s{_ltorNextToken = a})
ltorResourceARN :: Lens' ListTagsOfResource Text
ltorResourceARN = lens _ltorResourceARN (\ s a -> s{_ltorResourceARN = a})
instance AWSRequest ListTagsOfResource where
type Rs ListTagsOfResource =
ListTagsOfResourceResponse
request = postJSON dynamoDB
response
= receiveJSON
(\ s h x ->
ListTagsOfResourceResponse' <$>
(x .?> "NextToken") <*> (x .?> "Tags" .!@ mempty) <*>
(pure (fromEnum s)))
instance Hashable ListTagsOfResource where
instance NFData ListTagsOfResource where
instance ToHeaders ListTagsOfResource where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("DynamoDB_20120810.ListTagsOfResource" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.0" :: ByteString)])
instance ToJSON ListTagsOfResource where
toJSON ListTagsOfResource'{..}
= object
(catMaybes
[("NextToken" .=) <$> _ltorNextToken,
Just ("ResourceArn" .= _ltorResourceARN)])
instance ToPath ListTagsOfResource where
toPath = const "/"
instance ToQuery ListTagsOfResource where
toQuery = const mempty
data ListTagsOfResourceResponse = ListTagsOfResourceResponse'
{ _ltorrsNextToken :: !(Maybe Text)
, _ltorrsTags :: !(Maybe [Tag])
, _ltorrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listTagsOfResourceResponse
:: Int
-> ListTagsOfResourceResponse
listTagsOfResourceResponse pResponseStatus_ =
ListTagsOfResourceResponse'
{ _ltorrsNextToken = Nothing
, _ltorrsTags = Nothing
, _ltorrsResponseStatus = pResponseStatus_
}
ltorrsNextToken :: Lens' ListTagsOfResourceResponse (Maybe Text)
ltorrsNextToken = lens _ltorrsNextToken (\ s a -> s{_ltorrsNextToken = a})
ltorrsTags :: Lens' ListTagsOfResourceResponse [Tag]
ltorrsTags = lens _ltorrsTags (\ s a -> s{_ltorrsTags = a}) . _Default . _Coerce
ltorrsResponseStatus :: Lens' ListTagsOfResourceResponse Int
ltorrsResponseStatus = lens _ltorrsResponseStatus (\ s a -> s{_ltorrsResponseStatus = a})
instance NFData ListTagsOfResourceResponse where