{-# 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.APIGateway.GetTags
(
getTags
, GetTags
, gtLimit
, gtPosition
, gtResourceARN
, getTagsResponse
, GetTagsResponse
, gtrsTags
, gtrsResponseStatus
) where
import Network.AWS.APIGateway.Types
import Network.AWS.APIGateway.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data GetTags = GetTags'
{ _gtLimit :: !(Maybe Int)
, _gtPosition :: !(Maybe Text)
, _gtResourceARN :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getTags
:: Text
-> GetTags
getTags pResourceARN_ =
GetTags'
{_gtLimit = Nothing, _gtPosition = Nothing, _gtResourceARN = pResourceARN_}
gtLimit :: Lens' GetTags (Maybe Int)
gtLimit = lens _gtLimit (\ s a -> s{_gtLimit = a})
gtPosition :: Lens' GetTags (Maybe Text)
gtPosition = lens _gtPosition (\ s a -> s{_gtPosition = a})
gtResourceARN :: Lens' GetTags Text
gtResourceARN = lens _gtResourceARN (\ s a -> s{_gtResourceARN = a})
instance AWSRequest GetTags where
type Rs GetTags = GetTagsResponse
request = get apiGateway
response
= receiveJSON
(\ s h x ->
GetTagsResponse' <$>
(x .?> "tags" .!@ mempty) <*> (pure (fromEnum s)))
instance Hashable GetTags where
instance NFData GetTags where
instance ToHeaders GetTags where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToPath GetTags where
toPath GetTags'{..}
= mconcat ["/tags/", toBS _gtResourceARN]
instance ToQuery GetTags where
toQuery GetTags'{..}
= mconcat
["limit" =: _gtLimit, "position" =: _gtPosition]
data GetTagsResponse = GetTagsResponse'
{ _gtrsTags :: !(Maybe (Map Text Text))
, _gtrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getTagsResponse
:: Int
-> GetTagsResponse
getTagsResponse pResponseStatus_ =
GetTagsResponse' {_gtrsTags = Nothing, _gtrsResponseStatus = pResponseStatus_}
gtrsTags :: Lens' GetTagsResponse (HashMap Text Text)
gtrsTags = lens _gtrsTags (\ s a -> s{_gtrsTags = a}) . _Default . _Map
gtrsResponseStatus :: Lens' GetTagsResponse Int
gtrsResponseStatus = lens _gtrsResponseStatus (\ s a -> s{_gtrsResponseStatus = a})
instance NFData GetTagsResponse where