{-# 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.CloudTrail.ListTags -- Copyright : (c) 2013-2016 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Lists the tags for the specified trail or trails in the current region. -- -- Lists the tags for the trail in the current region. module Network.AWS.CloudTrail.ListTags ( -- * Creating a Request listTags , ListTags -- * Request Lenses , ltNextToken , ltResourceIdList -- * Destructuring the Response , listTagsResponse , ListTagsResponse -- * Response Lenses , ltrsNextToken , ltrsResourceTagList , ltrsResponseStatus ) where import Network.AWS.CloudTrail.Types import Network.AWS.CloudTrail.Types.Product import Network.AWS.Lens import Network.AWS.Prelude import Network.AWS.Request import Network.AWS.Response -- | Specifies a list of trail tags to return. -- -- /See:/ 'listTags' smart constructor. data ListTags = ListTags' { _ltNextToken :: !(Maybe Text) , _ltResourceIdList :: ![Text] } deriving (Eq,Read,Show,Data,Typeable,Generic) -- | Creates a value of 'ListTags' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'ltNextToken' -- -- * 'ltResourceIdList' listTags :: ListTags listTags = ListTags' { _ltNextToken = Nothing , _ltResourceIdList = mempty } -- | Reserved for future use. ltNextToken :: Lens' ListTags (Maybe Text) ltNextToken = lens _ltNextToken (\ s a -> s{_ltNextToken = a}); -- | Specifies a list of trail ARNs whose tags will be listed. The list has a -- limit of 20 ARNs. The format of a trail ARN is -- 'arn:aws:cloudtrail:us-east-1:123456789012:trail\/MyTrail'. ltResourceIdList :: Lens' ListTags [Text] ltResourceIdList = lens _ltResourceIdList (\ s a -> s{_ltResourceIdList = a}) . _Coerce; instance AWSRequest ListTags where type Rs ListTags = ListTagsResponse request = postJSON cloudTrail response = receiveJSON (\ s h x -> ListTagsResponse' <$> (x .?> "NextToken") <*> (x .?> "ResourceTagList" .!@ mempty) <*> (pure (fromEnum s))) instance Hashable ListTags instance ToHeaders ListTags where toHeaders = const (mconcat ["X-Amz-Target" =# ("com.amazonaws.cloudtrail.v20131101.CloudTrail_20131101.ListTags" :: ByteString), "Content-Type" =# ("application/x-amz-json-1.1" :: ByteString)]) instance ToJSON ListTags where toJSON ListTags'{..} = object (catMaybes [("NextToken" .=) <$> _ltNextToken, Just ("ResourceIdList" .= _ltResourceIdList)]) instance ToPath ListTags where toPath = const "/" instance ToQuery ListTags where toQuery = const mempty -- | Returns the objects or data listed below if successful. Otherwise, -- returns an error. -- -- /See:/ 'listTagsResponse' smart constructor. data ListTagsResponse = ListTagsResponse' { _ltrsNextToken :: !(Maybe Text) , _ltrsResourceTagList :: !(Maybe [ResourceTag]) , _ltrsResponseStatus :: !Int } deriving (Eq,Read,Show,Data,Typeable,Generic) -- | Creates a value of 'ListTagsResponse' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'ltrsNextToken' -- -- * 'ltrsResourceTagList' -- -- * 'ltrsResponseStatus' listTagsResponse :: Int -- ^ 'ltrsResponseStatus' -> ListTagsResponse listTagsResponse pResponseStatus_ = ListTagsResponse' { _ltrsNextToken = Nothing , _ltrsResourceTagList = Nothing , _ltrsResponseStatus = pResponseStatus_ } -- | Reserved for future use. ltrsNextToken :: Lens' ListTagsResponse (Maybe Text) ltrsNextToken = lens _ltrsNextToken (\ s a -> s{_ltrsNextToken = a}); -- | Undocumented member. ltrsResourceTagList :: Lens' ListTagsResponse [ResourceTag] ltrsResourceTagList = lens _ltrsResourceTagList (\ s a -> s{_ltrsResourceTagList = a}) . _Default . _Coerce; -- | The response status code. ltrsResponseStatus :: Lens' ListTagsResponse Int ltrsResponseStatus = lens _ltrsResponseStatus (\ s a -> s{_ltrsResponseStatus = a});