{-# 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 #-} -- Derived from AWS service descriptions, licensed under Apache 2.0. -- | -- Module : Network.AWS.SSM.ListTagsForResource -- Copyright : (c) 2013-2018 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Returns a list of the tags assigned to the specified resource. -- -- module Network.AWS.SSM.ListTagsForResource ( -- * Creating a Request listTagsForResource , ListTagsForResource -- * Request Lenses , ltfrResourceType , ltfrResourceId -- * Destructuring the Response , listTagsForResourceResponse , ListTagsForResourceResponse -- * Response Lenses , 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 -- | /See:/ 'listTagsForResource' smart constructor. data ListTagsForResource = ListTagsForResource' { _ltfrResourceType :: !ResourceTypeForTagging , _ltfrResourceId :: !Text } deriving (Eq, Read, Show, Data, Typeable, Generic) -- | Creates a value of 'ListTagsForResource' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'ltfrResourceType' - Returns a list of tags for a specific resource type. -- -- * 'ltfrResourceId' - The resource ID for which you want to see a list of tags. listTagsForResource :: ResourceTypeForTagging -- ^ 'ltfrResourceType' -> Text -- ^ 'ltfrResourceId' -> ListTagsForResource listTagsForResource pResourceType_ pResourceId_ = ListTagsForResource' {_ltfrResourceType = pResourceType_, _ltfrResourceId = pResourceId_} -- | Returns a list of tags for a specific resource type. ltfrResourceType :: Lens' ListTagsForResource ResourceTypeForTagging ltfrResourceType = lens _ltfrResourceType (\ s a -> s{_ltfrResourceType = a}) -- | The resource ID for which you want to see a list of tags. 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 where instance NFData ListTagsForResource where 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 -- | /See:/ 'listTagsForResourceResponse' smart constructor. data ListTagsForResourceResponse = ListTagsForResourceResponse' { _ltfrrsTagList :: !(Maybe [Tag]) , _ltfrrsResponseStatus :: !Int } deriving (Eq, Read, Show, Data, Typeable, Generic) -- | Creates a value of 'ListTagsForResourceResponse' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'ltfrrsTagList' - A list of tags. -- -- * 'ltfrrsResponseStatus' - -- | The response status code. listTagsForResourceResponse :: Int -- ^ 'ltfrrsResponseStatus' -> ListTagsForResourceResponse listTagsForResourceResponse pResponseStatus_ = ListTagsForResourceResponse' {_ltfrrsTagList = Nothing, _ltfrrsResponseStatus = pResponseStatus_} -- | A list of tags. ltfrrsTagList :: Lens' ListTagsForResourceResponse [Tag] ltfrrsTagList = lens _ltfrrsTagList (\ s a -> s{_ltfrrsTagList = a}) . _Default . _Coerce -- | -- | The response status code. ltfrrsResponseStatus :: Lens' ListTagsForResourceResponse Int ltfrrsResponseStatus = lens _ltfrrsResponseStatus (\ s a -> s{_ltfrrsResponseStatus = a}) instance NFData ListTagsForResourceResponse where