module Network.AWS.CloudFormation.ListStacks
(
listStacks
, ListStacks
, lsNextToken
, lsStackStatusFilter
, listStacksResponse
, ListStacksResponse
, lsrsNextToken
, lsrsStackSummaries
, lsrsResponseStatus
) where
import Network.AWS.CloudFormation.Types
import Network.AWS.CloudFormation.Types.Product
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data ListStacks = ListStacks'
{ _lsNextToken :: !(Maybe Text)
, _lsStackStatusFilter :: !(Maybe [StackStatus])
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listStacks
:: ListStacks
listStacks =
ListStacks'
{ _lsNextToken = Nothing
, _lsStackStatusFilter = Nothing
}
lsNextToken :: Lens' ListStacks (Maybe Text)
lsNextToken = lens _lsNextToken (\ s a -> s{_lsNextToken = a});
lsStackStatusFilter :: Lens' ListStacks [StackStatus]
lsStackStatusFilter = lens _lsStackStatusFilter (\ s a -> s{_lsStackStatusFilter = a}) . _Default . _Coerce;
instance AWSPager ListStacks where
page rq rs
| stop (rs ^. lsrsNextToken) = Nothing
| stop (rs ^. lsrsStackSummaries) = Nothing
| otherwise =
Just $ rq & lsNextToken .~ rs ^. lsrsNextToken
instance AWSRequest ListStacks where
type Rs ListStacks = ListStacksResponse
request = postQuery cloudFormation
response
= receiveXMLWrapper "ListStacksResult"
(\ s h x ->
ListStacksResponse' <$>
(x .@? "NextToken") <*>
(x .@? "StackSummaries" .!@ mempty >>=
may (parseXMLList "member"))
<*> (pure (fromEnum s)))
instance ToHeaders ListStacks where
toHeaders = const mempty
instance ToPath ListStacks where
toPath = const "/"
instance ToQuery ListStacks where
toQuery ListStacks'{..}
= mconcat
["Action" =: ("ListStacks" :: ByteString),
"Version" =: ("2010-05-15" :: ByteString),
"NextToken" =: _lsNextToken,
"StackStatusFilter" =:
toQuery
(toQueryList "member" <$> _lsStackStatusFilter)]
data ListStacksResponse = ListStacksResponse'
{ _lsrsNextToken :: !(Maybe Text)
, _lsrsStackSummaries :: !(Maybe [StackSummary])
, _lsrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listStacksResponse
:: Int
-> ListStacksResponse
listStacksResponse pResponseStatus_ =
ListStacksResponse'
{ _lsrsNextToken = Nothing
, _lsrsStackSummaries = Nothing
, _lsrsResponseStatus = pResponseStatus_
}
lsrsNextToken :: Lens' ListStacksResponse (Maybe Text)
lsrsNextToken = lens _lsrsNextToken (\ s a -> s{_lsrsNextToken = a});
lsrsStackSummaries :: Lens' ListStacksResponse [StackSummary]
lsrsStackSummaries = lens _lsrsStackSummaries (\ s a -> s{_lsrsStackSummaries = a}) . _Default . _Coerce;
lsrsResponseStatus :: Lens' ListStacksResponse Int
lsrsResponseStatus = lens _lsrsResponseStatus (\ s a -> s{_lsrsResponseStatus = a});