module Network.AWS.DataPipeline.ListPipelines
(
listPipelines
, ListPipelines
, lpMarker
, listPipelinesResponse
, ListPipelinesResponse
, lprsHasMoreResults
, lprsMarker
, lprsResponseStatus
, lprsPipelineIdList
) where
import Network.AWS.DataPipeline.Types
import Network.AWS.DataPipeline.Types.Product
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
newtype ListPipelines = ListPipelines'
{ _lpMarker :: Maybe Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listPipelines
:: ListPipelines
listPipelines =
ListPipelines'
{ _lpMarker = Nothing
}
lpMarker :: Lens' ListPipelines (Maybe Text)
lpMarker = lens _lpMarker (\ s a -> s{_lpMarker = a});
instance AWSPager ListPipelines where
page rq rs
| stop (rs ^. lprsHasMoreResults) = Nothing
| isNothing (rs ^. lprsMarker) = Nothing
| otherwise =
Just $ rq & lpMarker .~ rs ^. lprsMarker
instance AWSRequest ListPipelines where
type Rs ListPipelines = ListPipelinesResponse
request = postJSON dataPipeline
response
= receiveJSON
(\ s h x ->
ListPipelinesResponse' <$>
(x .?> "hasMoreResults") <*> (x .?> "marker") <*>
(pure (fromEnum s))
<*> (x .?> "pipelineIdList" .!@ mempty))
instance ToHeaders ListPipelines where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("DataPipeline.ListPipelines" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListPipelines where
toJSON ListPipelines'{..}
= object (catMaybes [("marker" .=) <$> _lpMarker])
instance ToPath ListPipelines where
toPath = const "/"
instance ToQuery ListPipelines where
toQuery = const mempty
data ListPipelinesResponse = ListPipelinesResponse'
{ _lprsHasMoreResults :: !(Maybe Bool)
, _lprsMarker :: !(Maybe Text)
, _lprsResponseStatus :: !Int
, _lprsPipelineIdList :: ![PipelineIdName]
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listPipelinesResponse
:: Int
-> ListPipelinesResponse
listPipelinesResponse pResponseStatus_ =
ListPipelinesResponse'
{ _lprsHasMoreResults = Nothing
, _lprsMarker = Nothing
, _lprsResponseStatus = pResponseStatus_
, _lprsPipelineIdList = mempty
}
lprsHasMoreResults :: Lens' ListPipelinesResponse (Maybe Bool)
lprsHasMoreResults = lens _lprsHasMoreResults (\ s a -> s{_lprsHasMoreResults = a});
lprsMarker :: Lens' ListPipelinesResponse (Maybe Text)
lprsMarker = lens _lprsMarker (\ s a -> s{_lprsMarker = a});
lprsResponseStatus :: Lens' ListPipelinesResponse Int
lprsResponseStatus = lens _lprsResponseStatus (\ s a -> s{_lprsResponseStatus = a});
lprsPipelineIdList :: Lens' ListPipelinesResponse [PipelineIdName]
lprsPipelineIdList = lens _lprsPipelineIdList (\ s a -> s{_lprsPipelineIdList = a}) . _Coerce;