{-# 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 #-}
module Network.AWS.AutoScaling.DescribeTags
(
describeTags
, DescribeTags
, dtFilters
, dtNextToken
, dtMaxRecords
, describeTagsResponse
, DescribeTagsResponse
, dtrsNextToken
, dtrsTags
, dtrsResponseStatus
) where
import Network.AWS.AutoScaling.Types
import Network.AWS.AutoScaling.Types.Product
import Network.AWS.Lens
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data DescribeTags = DescribeTags'
{ _dtFilters :: !(Maybe [Filter])
, _dtNextToken :: !(Maybe Text)
, _dtMaxRecords :: !(Maybe Int)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeTags
:: DescribeTags
describeTags =
DescribeTags'
{ _dtFilters = Nothing
, _dtNextToken = Nothing
, _dtMaxRecords = Nothing
}
dtFilters :: Lens' DescribeTags [Filter]
dtFilters = lens _dtFilters (\ s a -> s{_dtFilters = a}) . _Default . _Coerce;
dtNextToken :: Lens' DescribeTags (Maybe Text)
dtNextToken = lens _dtNextToken (\ s a -> s{_dtNextToken = a});
dtMaxRecords :: Lens' DescribeTags (Maybe Int)
dtMaxRecords = lens _dtMaxRecords (\ s a -> s{_dtMaxRecords = a});
instance AWSPager DescribeTags where
page rq rs
| stop (rs ^. dtrsNextToken) = Nothing
| stop (rs ^. dtrsTags) = Nothing
| otherwise =
Just $ rq & dtNextToken .~ rs ^. dtrsNextToken
instance AWSRequest DescribeTags where
type Rs DescribeTags = DescribeTagsResponse
request = postQuery autoScaling
response
= receiveXMLWrapper "DescribeTagsResult"
(\ s h x ->
DescribeTagsResponse' <$>
(x .@? "NextToken") <*>
(x .@? "Tags" .!@ mempty >>=
may (parseXMLList "member"))
<*> (pure (fromEnum s)))
instance Hashable DescribeTags
instance NFData DescribeTags
instance ToHeaders DescribeTags where
toHeaders = const mempty
instance ToPath DescribeTags where
toPath = const "/"
instance ToQuery DescribeTags where
toQuery DescribeTags'{..}
= mconcat
["Action" =: ("DescribeTags" :: ByteString),
"Version" =: ("2011-01-01" :: ByteString),
"Filters" =:
toQuery (toQueryList "member" <$> _dtFilters),
"NextToken" =: _dtNextToken,
"MaxRecords" =: _dtMaxRecords]
data DescribeTagsResponse = DescribeTagsResponse'
{ _dtrsNextToken :: !(Maybe Text)
, _dtrsTags :: !(Maybe [TagDescription])
, _dtrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeTagsResponse
:: Int
-> DescribeTagsResponse
describeTagsResponse pResponseStatus_ =
DescribeTagsResponse'
{ _dtrsNextToken = Nothing
, _dtrsTags = Nothing
, _dtrsResponseStatus = pResponseStatus_
}
dtrsNextToken :: Lens' DescribeTagsResponse (Maybe Text)
dtrsNextToken = lens _dtrsNextToken (\ s a -> s{_dtrsNextToken = a});
dtrsTags :: Lens' DescribeTagsResponse [TagDescription]
dtrsTags = lens _dtrsTags (\ s a -> s{_dtrsTags = a}) . _Default . _Coerce;
dtrsResponseStatus :: Lens' DescribeTagsResponse Int
dtrsResponseStatus = lens _dtrsResponseStatus (\ s a -> s{_dtrsResponseStatus = a});
instance NFData DescribeTagsResponse