{-# 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.SSM.ListTagsForResource
(
listTagsForResource
, ListTagsForResource
, ltfrResourceType
, ltfrResourceId
, listTagsForResourceResponse
, ListTagsForResourceResponse
, ltfrrsTagList
, ltfrrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.SSM.Types
import Network.AWS.SSM.Types.Product
data ListTagsForResource = ListTagsForResource'
{ _ltfrResourceType :: !ResourceTypeForTagging
, _ltfrResourceId :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listTagsForResource
:: ResourceTypeForTagging
-> Text
-> ListTagsForResource
listTagsForResource pResourceType_ pResourceId_ =
ListTagsForResource'
{ _ltfrResourceType = pResourceType_
, _ltfrResourceId = pResourceId_
}
ltfrResourceType :: Lens' ListTagsForResource ResourceTypeForTagging
ltfrResourceType = lens _ltfrResourceType (\ s a -> s{_ltfrResourceType = a});
ltfrResourceId :: Lens' ListTagsForResource Text
ltfrResourceId = lens _ltfrResourceId (\ s a -> s{_ltfrResourceId = a});
instance AWSRequest ListTagsForResource where
type Rs ListTagsForResource =
ListTagsForResourceResponse
request = postJSON ssm
response
= receiveJSON
(\ s h x ->
ListTagsForResourceResponse' <$>
(x .?> "TagList" .!@ mempty) <*> (pure (fromEnum s)))
instance Hashable ListTagsForResource
instance NFData ListTagsForResource
instance ToHeaders ListTagsForResource where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonSSM.ListTagsForResource" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListTagsForResource where
toJSON ListTagsForResource'{..}
= object
(catMaybes
[Just ("ResourceType" .= _ltfrResourceType),
Just ("ResourceId" .= _ltfrResourceId)])
instance ToPath ListTagsForResource where
toPath = const "/"
instance ToQuery ListTagsForResource where
toQuery = const mempty
data ListTagsForResourceResponse = ListTagsForResourceResponse'
{ _ltfrrsTagList :: !(Maybe [Tag])
, _ltfrrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listTagsForResourceResponse
:: Int
-> ListTagsForResourceResponse
listTagsForResourceResponse pResponseStatus_ =
ListTagsForResourceResponse'
{ _ltfrrsTagList = Nothing
, _ltfrrsResponseStatus = pResponseStatus_
}
ltfrrsTagList :: Lens' ListTagsForResourceResponse [Tag]
ltfrrsTagList = lens _ltfrrsTagList (\ s a -> s{_ltfrrsTagList = a}) . _Default . _Coerce;
ltfrrsResponseStatus :: Lens' ListTagsForResourceResponse Int
ltfrrsResponseStatus = lens _ltfrrsResponseStatus (\ s a -> s{_ltfrrsResponseStatus = a});
instance NFData ListTagsForResourceResponse