{-# 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.CloudDirectory.ListTagsForResource -- Copyright : (c) 2013-2017 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Returns tags for a resource. Tagging is currently supported only for directories with a limit of 50 tags per directory. All 50 tags are returned for a given directory with this API call. -- -- module Network.AWS.CloudDirectory.ListTagsForResource ( -- * Creating a Request listTagsForResource , ListTagsForResource -- * Request Lenses , ltfrNextToken , ltfrMaxResults , ltfrResourceARN -- * Destructuring the Response , listTagsForResourceResponse , ListTagsForResourceResponse -- * Response Lenses , ltfrrsNextToken , ltfrrsTags , ltfrrsResponseStatus ) where import Network.AWS.CloudDirectory.Types import Network.AWS.CloudDirectory.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) , _ltfrMaxResults :: !(Maybe Nat) , _ltfrResourceARN :: !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' - The pagination token. This is for future use. Currently pagination is not supported for tagging. -- -- * 'ltfrMaxResults' - The @MaxResults@ parameter sets the maximum number of results returned in a single page. This is for future use and is not supported currently. -- -- * 'ltfrResourceARN' - The Amazon Resource Name (ARN) of the resource. Tagging is only supported for directories. listTagsForResource :: Text -- ^ 'ltfrResourceARN' -> ListTagsForResource listTagsForResource pResourceARN_ = ListTagsForResource' { _ltfrNextToken = Nothing , _ltfrMaxResults = Nothing , _ltfrResourceARN = pResourceARN_ } -- | The pagination token. This is for future use. Currently pagination is not supported for tagging. ltfrNextToken :: Lens' ListTagsForResource (Maybe Text) ltfrNextToken = lens _ltfrNextToken (\ s a -> s{_ltfrNextToken = a}); -- | The @MaxResults@ parameter sets the maximum number of results returned in a single page. This is for future use and is not supported currently. ltfrMaxResults :: Lens' ListTagsForResource (Maybe Natural) ltfrMaxResults = lens _ltfrMaxResults (\ s a -> s{_ltfrMaxResults = a}) . mapping _Nat; -- | The Amazon Resource Name (ARN) of the resource. Tagging is only supported for directories. ltfrResourceARN :: Lens' ListTagsForResource Text ltfrResourceARN = lens _ltfrResourceARN (\ s a -> s{_ltfrResourceARN = a}); instance AWSRequest ListTagsForResource where type Rs ListTagsForResource = ListTagsForResourceResponse request = postJSON cloudDirectory 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 mempty instance ToJSON ListTagsForResource where toJSON ListTagsForResource'{..} = object (catMaybes [("NextToken" .=) <$> _ltfrNextToken, ("MaxResults" .=) <$> _ltfrMaxResults, Just ("ResourceArn" .= _ltfrResourceARN)]) instance ToPath ListTagsForResource where toPath = const "/amazonclouddirectory/2017-01-11/tags" 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' - The token to use to retrieve the next page of results. This value is null when there are no more results to return. -- -- * 'ltfrrsTags' - A list of tag key value pairs that are associated with the response. -- -- * 'ltfrrsResponseStatus' - -- | The response status code. listTagsForResourceResponse :: Int -- ^ 'ltfrrsResponseStatus' -> ListTagsForResourceResponse listTagsForResourceResponse pResponseStatus_ = ListTagsForResourceResponse' { _ltfrrsNextToken = Nothing , _ltfrrsTags = Nothing , _ltfrrsResponseStatus = pResponseStatus_ } -- | The token to use to retrieve the next page of results. This value is null when there are no more results to return. ltfrrsNextToken :: Lens' ListTagsForResourceResponse (Maybe Text) ltfrrsNextToken = lens _ltfrrsNextToken (\ s a -> s{_ltfrrsNextToken = a}); -- | A list of tag key value pairs that are associated with the response. 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