{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.CodePipeline.PollForJobs
(
pollForJobs
, PollForJobs
, pfjMaxBatchSize
, pfjQueryParam
, pfjActionTypeId
, pollForJobsResponse
, PollForJobsResponse
, pfjrsJobs
, pfjrsResponseStatus
) where
import Network.AWS.CodePipeline.Types
import Network.AWS.CodePipeline.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data PollForJobs = PollForJobs'
{ _pfjMaxBatchSize :: !(Maybe Nat)
, _pfjQueryParam :: !(Maybe (Map Text Text))
, _pfjActionTypeId :: !ActionTypeId
} deriving (Eq,Read,Show,Data,Typeable,Generic)
pollForJobs
:: ActionTypeId
-> PollForJobs
pollForJobs pActionTypeId_ =
PollForJobs'
{ _pfjMaxBatchSize = Nothing
, _pfjQueryParam = Nothing
, _pfjActionTypeId = pActionTypeId_
}
pfjMaxBatchSize :: Lens' PollForJobs (Maybe Natural)
pfjMaxBatchSize = lens _pfjMaxBatchSize (\ s a -> s{_pfjMaxBatchSize = a}) . mapping _Nat;
pfjQueryParam :: Lens' PollForJobs (HashMap Text Text)
pfjQueryParam = lens _pfjQueryParam (\ s a -> s{_pfjQueryParam = a}) . _Default . _Map;
pfjActionTypeId :: Lens' PollForJobs ActionTypeId
pfjActionTypeId = lens _pfjActionTypeId (\ s a -> s{_pfjActionTypeId = a});
instance AWSRequest PollForJobs where
type Rs PollForJobs = PollForJobsResponse
request = postJSON codePipeline
response
= receiveJSON
(\ s h x ->
PollForJobsResponse' <$>
(x .?> "jobs" .!@ mempty) <*> (pure (fromEnum s)))
instance Hashable PollForJobs
instance NFData PollForJobs
instance ToHeaders PollForJobs where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CodePipeline_20150709.PollForJobs" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON PollForJobs where
toJSON PollForJobs'{..}
= object
(catMaybes
[("maxBatchSize" .=) <$> _pfjMaxBatchSize,
("queryParam" .=) <$> _pfjQueryParam,
Just ("actionTypeId" .= _pfjActionTypeId)])
instance ToPath PollForJobs where
toPath = const "/"
instance ToQuery PollForJobs where
toQuery = const mempty
data PollForJobsResponse = PollForJobsResponse'
{ _pfjrsJobs :: !(Maybe [Job])
, _pfjrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
pollForJobsResponse
:: Int
-> PollForJobsResponse
pollForJobsResponse pResponseStatus_ =
PollForJobsResponse'
{ _pfjrsJobs = Nothing
, _pfjrsResponseStatus = pResponseStatus_
}
pfjrsJobs :: Lens' PollForJobsResponse [Job]
pfjrsJobs = lens _pfjrsJobs (\ s a -> s{_pfjrsJobs = a}) . _Default . _Coerce;
pfjrsResponseStatus :: Lens' PollForJobsResponse Int
pfjrsResponseStatus = lens _pfjrsResponseStatus (\ s a -> s{_pfjrsResponseStatus = a});
instance NFData PollForJobsResponse