module Network.AWS.ECS.ListContainerInstances
(
listContainerInstances
, ListContainerInstances
, lciCluster
, lciNextToken
, lciMaxResults
, listContainerInstancesResponse
, ListContainerInstancesResponse
, lcirsContainerInstanceARNs
, lcirsNextToken
, lcirsResponseStatus
) where
import Network.AWS.ECS.Types
import Network.AWS.ECS.Types.Product
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data ListContainerInstances = ListContainerInstances'
{ _lciCluster :: !(Maybe Text)
, _lciNextToken :: !(Maybe Text)
, _lciMaxResults :: !(Maybe Int)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listContainerInstances
:: ListContainerInstances
listContainerInstances =
ListContainerInstances'
{ _lciCluster = Nothing
, _lciNextToken = Nothing
, _lciMaxResults = Nothing
}
lciCluster :: Lens' ListContainerInstances (Maybe Text)
lciCluster = lens _lciCluster (\ s a -> s{_lciCluster = a});
lciNextToken :: Lens' ListContainerInstances (Maybe Text)
lciNextToken = lens _lciNextToken (\ s a -> s{_lciNextToken = a});
lciMaxResults :: Lens' ListContainerInstances (Maybe Int)
lciMaxResults = lens _lciMaxResults (\ s a -> s{_lciMaxResults = a});
instance AWSPager ListContainerInstances where
page rq rs
| stop (rs ^. lcirsNextToken) = Nothing
| stop (rs ^. lcirsContainerInstanceARNs) = Nothing
| otherwise =
Just $ rq & lciNextToken .~ rs ^. lcirsNextToken
instance AWSRequest ListContainerInstances where
type Rs ListContainerInstances =
ListContainerInstancesResponse
request = postJSON eCS
response
= receiveJSON
(\ s h x ->
ListContainerInstancesResponse' <$>
(x .?> "containerInstanceArns" .!@ mempty) <*>
(x .?> "nextToken")
<*> (pure (fromEnum s)))
instance ToHeaders ListContainerInstances where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonEC2ContainerServiceV20141113.ListContainerInstances"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListContainerInstances where
toJSON ListContainerInstances'{..}
= object
(catMaybes
[("cluster" .=) <$> _lciCluster,
("nextToken" .=) <$> _lciNextToken,
("maxResults" .=) <$> _lciMaxResults])
instance ToPath ListContainerInstances where
toPath = const "/"
instance ToQuery ListContainerInstances where
toQuery = const mempty
data ListContainerInstancesResponse = ListContainerInstancesResponse'
{ _lcirsContainerInstanceARNs :: !(Maybe [Text])
, _lcirsNextToken :: !(Maybe Text)
, _lcirsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listContainerInstancesResponse
:: Int
-> ListContainerInstancesResponse
listContainerInstancesResponse pResponseStatus_ =
ListContainerInstancesResponse'
{ _lcirsContainerInstanceARNs = Nothing
, _lcirsNextToken = Nothing
, _lcirsResponseStatus = pResponseStatus_
}
lcirsContainerInstanceARNs :: Lens' ListContainerInstancesResponse [Text]
lcirsContainerInstanceARNs = lens _lcirsContainerInstanceARNs (\ s a -> s{_lcirsContainerInstanceARNs = a}) . _Default . _Coerce;
lcirsNextToken :: Lens' ListContainerInstancesResponse (Maybe Text)
lcirsNextToken = lens _lcirsNextToken (\ s a -> s{_lcirsNextToken = a});
lcirsResponseStatus :: Lens' ListContainerInstancesResponse Int
lcirsResponseStatus = lens _lcirsResponseStatus (\ s a -> s{_lcirsResponseStatus = a});