module Network.AWS.ImportExport.ListJobs
(
listJobs
, ListJobs
, ljAPIVersion
, ljMarker
, ljMaxJobs
, listJobsResponse
, ListJobsResponse
, ljrsJobs
, ljrsIsTruncated
, ljrsStatus
) where
import Network.AWS.ImportExport.Types
import Network.AWS.ImportExport.Types.Product
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data ListJobs = ListJobs'
{ _ljAPIVersion :: !(Maybe Text)
, _ljMarker :: !(Maybe Text)
, _ljMaxJobs :: !(Maybe Int)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listJobs
:: ListJobs
listJobs =
ListJobs'
{ _ljAPIVersion = Nothing
, _ljMarker = Nothing
, _ljMaxJobs = Nothing
}
ljAPIVersion :: Lens' ListJobs (Maybe Text)
ljAPIVersion = lens _ljAPIVersion (\ s a -> s{_ljAPIVersion = a});
ljMarker :: Lens' ListJobs (Maybe Text)
ljMarker = lens _ljMarker (\ s a -> s{_ljMarker = a});
ljMaxJobs :: Lens' ListJobs (Maybe Int)
ljMaxJobs = lens _ljMaxJobs (\ s a -> s{_ljMaxJobs = a});
instance AWSPager ListJobs where
page rq rs
| stop (rs ^. ljrsIsTruncated) = Nothing
| isNothing (rs ^? ljrsJobs . _last . jobJobId) =
Nothing
| otherwise =
Just $ rq &
ljMarker .~ rs ^? ljrsJobs . _last . jobJobId
instance AWSRequest ListJobs where
type Rs ListJobs = ListJobsResponse
request = postQuery importExport
response
= receiveXMLWrapper "ListJobsResult"
(\ s h x ->
ListJobsResponse' <$>
(x .@? "Jobs" .!@ mempty >>=
may (parseXMLList "member"))
<*> (x .@? "IsTruncated")
<*> (pure (fromEnum s)))
instance ToHeaders ListJobs where
toHeaders = const mempty
instance ToPath ListJobs where
toPath = const "/"
instance ToQuery ListJobs where
toQuery ListJobs'{..}
= mconcat
["Operation=ListJobs",
"Action" =: ("ListJobs" :: ByteString),
"Version" =: ("2010-06-01" :: ByteString),
"APIVersion" =: _ljAPIVersion, "Marker" =: _ljMarker,
"MaxJobs" =: _ljMaxJobs]
data ListJobsResponse = ListJobsResponse'
{ _ljrsJobs :: !(Maybe [Job])
, _ljrsIsTruncated :: !(Maybe Bool)
, _ljrsStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listJobsResponse
:: Int
-> ListJobsResponse
listJobsResponse pStatus_ =
ListJobsResponse'
{ _ljrsJobs = Nothing
, _ljrsIsTruncated = Nothing
, _ljrsStatus = pStatus_
}
ljrsJobs :: Lens' ListJobsResponse [Job]
ljrsJobs = lens _ljrsJobs (\ s a -> s{_ljrsJobs = a}) . _Default . _Coerce;
ljrsIsTruncated :: Lens' ListJobsResponse (Maybe Bool)
ljrsIsTruncated = lens _ljrsIsTruncated (\ s a -> s{_ljrsIsTruncated = a});
ljrsStatus :: Lens' ListJobsResponse Int
ljrsStatus = lens _ljrsStatus (\ s a -> s{_ljrsStatus = a});