module Network.AWS.Glue.GetJobs
(
getJobs
, GetJobs
, gjNextToken
, gjMaxResults
, getJobsResponse
, GetJobsResponse
, gjsrsNextToken
, gjsrsJobs
, gjsrsResponseStatus
) where
import Network.AWS.Glue.Types
import Network.AWS.Glue.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data GetJobs = GetJobs'
{ _gjNextToken :: !(Maybe Text)
, _gjMaxResults :: !(Maybe Nat)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getJobs
:: GetJobs
getJobs = GetJobs' {_gjNextToken = Nothing, _gjMaxResults = Nothing}
gjNextToken :: Lens' GetJobs (Maybe Text)
gjNextToken = lens _gjNextToken (\ s a -> s{_gjNextToken = a});
gjMaxResults :: Lens' GetJobs (Maybe Natural)
gjMaxResults = lens _gjMaxResults (\ s a -> s{_gjMaxResults = a}) . mapping _Nat;
instance AWSRequest GetJobs where
type Rs GetJobs = GetJobsResponse
request = postJSON glue
response
= receiveJSON
(\ s h x ->
GetJobsResponse' <$>
(x .?> "NextToken") <*> (x .?> "Jobs" .!@ mempty) <*>
(pure (fromEnum s)))
instance Hashable GetJobs where
instance NFData GetJobs where
instance ToHeaders GetJobs where
toHeaders
= const
(mconcat
["X-Amz-Target" =# ("AWSGlue.GetJobs" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetJobs where
toJSON GetJobs'{..}
= object
(catMaybes
[("NextToken" .=) <$> _gjNextToken,
("MaxResults" .=) <$> _gjMaxResults])
instance ToPath GetJobs where
toPath = const "/"
instance ToQuery GetJobs where
toQuery = const mempty
data GetJobsResponse = GetJobsResponse'
{ _gjsrsNextToken :: !(Maybe Text)
, _gjsrsJobs :: !(Maybe [Job])
, _gjsrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getJobsResponse
:: Int
-> GetJobsResponse
getJobsResponse pResponseStatus_ =
GetJobsResponse'
{ _gjsrsNextToken = Nothing
, _gjsrsJobs = Nothing
, _gjsrsResponseStatus = pResponseStatus_
}
gjsrsNextToken :: Lens' GetJobsResponse (Maybe Text)
gjsrsNextToken = lens _gjsrsNextToken (\ s a -> s{_gjsrsNextToken = a});
gjsrsJobs :: Lens' GetJobsResponse [Job]
gjsrsJobs = lens _gjsrsJobs (\ s a -> s{_gjsrsJobs = a}) . _Default . _Coerce;
gjsrsResponseStatus :: Lens' GetJobsResponse Int
gjsrsResponseStatus = lens _gjsrsResponseStatus (\ s a -> s{_gjsrsResponseStatus = a});
instance NFData GetJobsResponse where