{-# 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.DirectoryService.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) -- -- Lists all tags on a directory. -- -- module Network.AWS.DirectoryService.ListTagsForResource ( -- * Creating a Request listTagsForResource , ListTagsForResource -- * Request Lenses , ltfrNextToken , ltfrLimit , ltfrResourceId -- * Destructuring the Response , listTagsForResourceResponse , ListTagsForResourceResponse -- * Response Lenses , ltfrrsNextToken , ltfrrsTags , ltfrrsResponseStatus ) where import Network.AWS.DirectoryService.Types import Network.AWS.DirectoryService.Types.Product import Network.AWS.Lens import Network.AWS.Prelude import Network.AWS.Request import Network.AWS.Response -- | /See:/ 'listTagsForResource' smart constructor. data ListTagsForResource = ListTagsForResource' { _ltfrNextToken :: !(Maybe Text) , _ltfrLimit :: !(Maybe Nat) , _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: -- -- * 'ltfrNextToken' - Reserved for future use. -- -- * 'ltfrLimit' - Reserved for future use. -- -- * 'ltfrResourceId' - Identifier (ID) of the directory for which you want to retrieve tags. listTagsForResource :: Text -- ^ 'ltfrResourceId' -> ListTagsForResource listTagsForResource pResourceId_ = ListTagsForResource' { _ltfrNextToken = Nothing , _ltfrLimit = Nothing , _ltfrResourceId = pResourceId_ } -- | Reserved for future use. ltfrNextToken :: Lens' ListTagsForResource (Maybe Text) ltfrNextToken = lens _ltfrNextToken (\ s a -> s{_ltfrNextToken = a}) -- | Reserved for future use. ltfrLimit :: Lens' ListTagsForResource (Maybe Natural) ltfrLimit = lens _ltfrLimit (\ s a -> s{_ltfrLimit = a}) . mapping _Nat -- | Identifier (ID) of the directory for which you want to retrieve tags. ltfrResourceId :: Lens' ListTagsForResource Text ltfrResourceId = lens _ltfrResourceId (\ s a -> s{_ltfrResourceId = a}) instance AWSRequest ListTagsForResource where type Rs ListTagsForResource = ListTagsForResourceResponse request = postJSON directoryService response = receiveJSON (\ s h x -> ListTagsForResourceResponse' <$> (x .?> "NextToken") <*> (x .?> "Tags" .!@ mempty) <*> (pure (fromEnum s))) instance Hashable ListTagsForResource where instance NFData ListTagsForResource where instance ToHeaders ListTagsForResource where toHeaders = const (mconcat ["X-Amz-Target" =# ("DirectoryService_20150416.ListTagsForResource" :: ByteString), "Content-Type" =# ("application/x-amz-json-1.1" :: ByteString)]) instance ToJSON ListTagsForResource where toJSON ListTagsForResource'{..} = object (catMaybes [("NextToken" .=) <$> _ltfrNextToken, ("Limit" .=) <$> _ltfrLimit, Just ("ResourceId" .= _ltfrResourceId)]) instance ToPath ListTagsForResource where toPath = const "/" instance ToQuery ListTagsForResource where toQuery = const mempty -- | /See:/ 'listTagsForResourceResponse' smart constructor. data ListTagsForResourceResponse = ListTagsForResourceResponse' { _ltfrrsNextToken :: !(Maybe Text) , _ltfrrsTags :: !(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: -- -- * 'ltfrrsNextToken' - Reserved for future use. -- -- * 'ltfrrsTags' - List of tags returned by the ListTagsForResource operation. -- -- * 'ltfrrsResponseStatus' - -- | The response status code. listTagsForResourceResponse :: Int -- ^ 'ltfrrsResponseStatus' -> ListTagsForResourceResponse listTagsForResourceResponse pResponseStatus_ = ListTagsForResourceResponse' { _ltfrrsNextToken = Nothing , _ltfrrsTags = Nothing , _ltfrrsResponseStatus = pResponseStatus_ } -- | Reserved for future use. ltfrrsNextToken :: Lens' ListTagsForResourceResponse (Maybe Text) ltfrrsNextToken = lens _ltfrrsNextToken (\ s a -> s{_ltfrrsNextToken = a}) -- | List of tags returned by the ListTagsForResource operation. ltfrrsTags :: Lens' ListTagsForResourceResponse [Tag] ltfrrsTags = lens _ltfrrsTags (\ s a -> s{_ltfrrsTags = a}) . _Default . _Coerce -- | -- | The response status code. ltfrrsResponseStatus :: Lens' ListTagsForResourceResponse Int ltfrrsResponseStatus = lens _ltfrrsResponseStatus (\ s a -> s{_ltfrrsResponseStatus = a}) instance NFData ListTagsForResourceResponse where