{-# 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.ResourceGroups.GetTags
(
getTags
, GetTags
, gtARN
, getTagsResponse
, GetTagsResponse
, gtrsARN
, gtrsTags
, gtrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.ResourceGroups.Types
import Network.AWS.ResourceGroups.Types.Product
import Network.AWS.Response
newtype GetTags = GetTags'
{ _gtARN :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getTags
:: Text
-> GetTags
getTags pARN_ = GetTags' {_gtARN = pARN_}
gtARN :: Lens' GetTags Text
gtARN = lens _gtARN (\ s a -> s{_gtARN = a})
instance AWSRequest GetTags where
type Rs GetTags = GetTagsResponse
request = get resourceGroups
response
= receiveJSON
(\ s h x ->
GetTagsResponse' <$>
(x .?> "Arn") <*> (x .?> "Tags" .!@ mempty) <*>
(pure (fromEnum s)))
instance Hashable GetTags where
instance NFData GetTags where
instance ToHeaders GetTags where
toHeaders = const mempty
instance ToPath GetTags where
toPath GetTags'{..}
= mconcat ["/resources/", toBS _gtARN, "/tags"]
instance ToQuery GetTags where
toQuery = const mempty
data GetTagsResponse = GetTagsResponse'
{ _gtrsARN :: !(Maybe Text)
, _gtrsTags :: !(Maybe (Map Text Text))
, _gtrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getTagsResponse
:: Int
-> GetTagsResponse
getTagsResponse pResponseStatus_ =
GetTagsResponse'
{ _gtrsARN = Nothing
, _gtrsTags = Nothing
, _gtrsResponseStatus = pResponseStatus_
}
gtrsARN :: Lens' GetTagsResponse (Maybe Text)
gtrsARN = lens _gtrsARN (\ s a -> s{_gtrsARN = a})
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