{-# 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.PollForThirdPartyJobs
(
pollForThirdPartyJobs
, PollForThirdPartyJobs
, pftpjMaxBatchSize
, pftpjActionTypeId
, pollForThirdPartyJobsResponse
, PollForThirdPartyJobsResponse
, pftpjrsJobs
, pftpjrsResponseStatus
) 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 PollForThirdPartyJobs = PollForThirdPartyJobs'
{ _pftpjMaxBatchSize :: !(Maybe Nat)
, _pftpjActionTypeId :: !ActionTypeId
} deriving (Eq, Read, Show, Data, Typeable, Generic)
pollForThirdPartyJobs
:: ActionTypeId
-> PollForThirdPartyJobs
pollForThirdPartyJobs pActionTypeId_ =
PollForThirdPartyJobs'
{_pftpjMaxBatchSize = Nothing, _pftpjActionTypeId = pActionTypeId_}
pftpjMaxBatchSize :: Lens' PollForThirdPartyJobs (Maybe Natural)
pftpjMaxBatchSize = lens _pftpjMaxBatchSize (\ s a -> s{_pftpjMaxBatchSize = a}) . mapping _Nat
pftpjActionTypeId :: Lens' PollForThirdPartyJobs ActionTypeId
pftpjActionTypeId = lens _pftpjActionTypeId (\ s a -> s{_pftpjActionTypeId = a})
instance AWSRequest PollForThirdPartyJobs where
type Rs PollForThirdPartyJobs =
PollForThirdPartyJobsResponse
request = postJSON codePipeline
response
= receiveJSON
(\ s h x ->
PollForThirdPartyJobsResponse' <$>
(x .?> "jobs" .!@ mempty) <*> (pure (fromEnum s)))
instance Hashable PollForThirdPartyJobs where
instance NFData PollForThirdPartyJobs where
instance ToHeaders PollForThirdPartyJobs where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CodePipeline_20150709.PollForThirdPartyJobs" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON PollForThirdPartyJobs where
toJSON PollForThirdPartyJobs'{..}
= object
(catMaybes
[("maxBatchSize" .=) <$> _pftpjMaxBatchSize,
Just ("actionTypeId" .= _pftpjActionTypeId)])
instance ToPath PollForThirdPartyJobs where
toPath = const "/"
instance ToQuery PollForThirdPartyJobs where
toQuery = const mempty
data PollForThirdPartyJobsResponse = PollForThirdPartyJobsResponse'
{ _pftpjrsJobs :: !(Maybe [ThirdPartyJob])
, _pftpjrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
pollForThirdPartyJobsResponse
:: Int
-> PollForThirdPartyJobsResponse
pollForThirdPartyJobsResponse pResponseStatus_ =
PollForThirdPartyJobsResponse'
{_pftpjrsJobs = Nothing, _pftpjrsResponseStatus = pResponseStatus_}
pftpjrsJobs :: Lens' PollForThirdPartyJobsResponse [ThirdPartyJob]
pftpjrsJobs = lens _pftpjrsJobs (\ s a -> s{_pftpjrsJobs = a}) . _Default . _Coerce
pftpjrsResponseStatus :: Lens' PollForThirdPartyJobsResponse Int
pftpjrsResponseStatus = lens _pftpjrsResponseStatus (\ s a -> s{_pftpjrsResponseStatus = a})
instance NFData PollForThirdPartyJobsResponse where