module Network.AWS.Inspector.ListTagsForResource
(
listTagsForResource
, ListTagsForResource
, ltfrResourceARN
, listTagsForResourceResponse
, ListTagsForResourceResponse
, ltfrrsTagList
, ltfrrsResponseStatus
) where
import Network.AWS.Inspector.Types
import Network.AWS.Inspector.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
newtype ListTagsForResource = ListTagsForResource'
{ _ltfrResourceARN :: Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listTagsForResource
:: Text
-> ListTagsForResource
listTagsForResource pResourceARN_ =
ListTagsForResource'
{ _ltfrResourceARN = pResourceARN_
}
ltfrResourceARN :: Lens' ListTagsForResource Text
ltfrResourceARN = lens _ltfrResourceARN (\ s a -> s{_ltfrResourceARN = a});
instance AWSRequest ListTagsForResource where
type Rs ListTagsForResource =
ListTagsForResourceResponse
request = postJSON inspector
response
= receiveJSON
(\ s h x ->
ListTagsForResourceResponse' <$>
(x .?> "tagList" .!@ mempty) <*> (pure (fromEnum s)))
instance ToHeaders ListTagsForResource where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("InspectorService.ListTagsForResource" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListTagsForResource where
toJSON ListTagsForResource'{..}
= object
(catMaybes
[Just ("resourceArn" .= _ltfrResourceARN)])
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});