{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.CodePipeline.PollForThirdPartyJobs
(
PollForThirdPartyJobs (..),
newPollForThirdPartyJobs,
pollForThirdPartyJobs_maxBatchSize,
pollForThirdPartyJobs_actionTypeId,
PollForThirdPartyJobsResponse (..),
newPollForThirdPartyJobsResponse,
pollForThirdPartyJobsResponse_jobs,
pollForThirdPartyJobsResponse_httpStatus,
)
where
import Amazonka.CodePipeline.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data PollForThirdPartyJobs = PollForThirdPartyJobs'
{
PollForThirdPartyJobs -> Maybe Natural
maxBatchSize :: Prelude.Maybe Prelude.Natural,
PollForThirdPartyJobs -> ActionTypeId
actionTypeId :: ActionTypeId
}
deriving (PollForThirdPartyJobs -> PollForThirdPartyJobs -> Bool
(PollForThirdPartyJobs -> PollForThirdPartyJobs -> Bool)
-> (PollForThirdPartyJobs -> PollForThirdPartyJobs -> Bool)
-> Eq PollForThirdPartyJobs
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PollForThirdPartyJobs -> PollForThirdPartyJobs -> Bool
$c/= :: PollForThirdPartyJobs -> PollForThirdPartyJobs -> Bool
== :: PollForThirdPartyJobs -> PollForThirdPartyJobs -> Bool
$c== :: PollForThirdPartyJobs -> PollForThirdPartyJobs -> Bool
Prelude.Eq, ReadPrec [PollForThirdPartyJobs]
ReadPrec PollForThirdPartyJobs
Int -> ReadS PollForThirdPartyJobs
ReadS [PollForThirdPartyJobs]
(Int -> ReadS PollForThirdPartyJobs)
-> ReadS [PollForThirdPartyJobs]
-> ReadPrec PollForThirdPartyJobs
-> ReadPrec [PollForThirdPartyJobs]
-> Read PollForThirdPartyJobs
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PollForThirdPartyJobs]
$creadListPrec :: ReadPrec [PollForThirdPartyJobs]
readPrec :: ReadPrec PollForThirdPartyJobs
$creadPrec :: ReadPrec PollForThirdPartyJobs
readList :: ReadS [PollForThirdPartyJobs]
$creadList :: ReadS [PollForThirdPartyJobs]
readsPrec :: Int -> ReadS PollForThirdPartyJobs
$creadsPrec :: Int -> ReadS PollForThirdPartyJobs
Prelude.Read, Int -> PollForThirdPartyJobs -> ShowS
[PollForThirdPartyJobs] -> ShowS
PollForThirdPartyJobs -> String
(Int -> PollForThirdPartyJobs -> ShowS)
-> (PollForThirdPartyJobs -> String)
-> ([PollForThirdPartyJobs] -> ShowS)
-> Show PollForThirdPartyJobs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PollForThirdPartyJobs] -> ShowS
$cshowList :: [PollForThirdPartyJobs] -> ShowS
show :: PollForThirdPartyJobs -> String
$cshow :: PollForThirdPartyJobs -> String
showsPrec :: Int -> PollForThirdPartyJobs -> ShowS
$cshowsPrec :: Int -> PollForThirdPartyJobs -> ShowS
Prelude.Show, (forall x. PollForThirdPartyJobs -> Rep PollForThirdPartyJobs x)
-> (forall x. Rep PollForThirdPartyJobs x -> PollForThirdPartyJobs)
-> Generic PollForThirdPartyJobs
forall x. Rep PollForThirdPartyJobs x -> PollForThirdPartyJobs
forall x. PollForThirdPartyJobs -> Rep PollForThirdPartyJobs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PollForThirdPartyJobs x -> PollForThirdPartyJobs
$cfrom :: forall x. PollForThirdPartyJobs -> Rep PollForThirdPartyJobs x
Prelude.Generic)
newPollForThirdPartyJobs ::
ActionTypeId ->
PollForThirdPartyJobs
newPollForThirdPartyJobs :: ActionTypeId -> PollForThirdPartyJobs
newPollForThirdPartyJobs ActionTypeId
pActionTypeId_ =
PollForThirdPartyJobs' :: Maybe Natural -> ActionTypeId -> PollForThirdPartyJobs
PollForThirdPartyJobs'
{ $sel:maxBatchSize:PollForThirdPartyJobs' :: Maybe Natural
maxBatchSize =
Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:actionTypeId:PollForThirdPartyJobs' :: ActionTypeId
actionTypeId = ActionTypeId
pActionTypeId_
}
pollForThirdPartyJobs_maxBatchSize :: Lens.Lens' PollForThirdPartyJobs (Prelude.Maybe Prelude.Natural)
pollForThirdPartyJobs_maxBatchSize :: (Maybe Natural -> f (Maybe Natural))
-> PollForThirdPartyJobs -> f PollForThirdPartyJobs
pollForThirdPartyJobs_maxBatchSize = (PollForThirdPartyJobs -> Maybe Natural)
-> (PollForThirdPartyJobs
-> Maybe Natural -> PollForThirdPartyJobs)
-> Lens
PollForThirdPartyJobs
PollForThirdPartyJobs
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PollForThirdPartyJobs' {Maybe Natural
maxBatchSize :: Maybe Natural
$sel:maxBatchSize:PollForThirdPartyJobs' :: PollForThirdPartyJobs -> Maybe Natural
maxBatchSize} -> Maybe Natural
maxBatchSize) (\s :: PollForThirdPartyJobs
s@PollForThirdPartyJobs' {} Maybe Natural
a -> PollForThirdPartyJobs
s {$sel:maxBatchSize:PollForThirdPartyJobs' :: Maybe Natural
maxBatchSize = Maybe Natural
a} :: PollForThirdPartyJobs)
pollForThirdPartyJobs_actionTypeId :: Lens.Lens' PollForThirdPartyJobs ActionTypeId
pollForThirdPartyJobs_actionTypeId :: (ActionTypeId -> f ActionTypeId)
-> PollForThirdPartyJobs -> f PollForThirdPartyJobs
pollForThirdPartyJobs_actionTypeId = (PollForThirdPartyJobs -> ActionTypeId)
-> (PollForThirdPartyJobs -> ActionTypeId -> PollForThirdPartyJobs)
-> Lens
PollForThirdPartyJobs
PollForThirdPartyJobs
ActionTypeId
ActionTypeId
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PollForThirdPartyJobs' {ActionTypeId
actionTypeId :: ActionTypeId
$sel:actionTypeId:PollForThirdPartyJobs' :: PollForThirdPartyJobs -> ActionTypeId
actionTypeId} -> ActionTypeId
actionTypeId) (\s :: PollForThirdPartyJobs
s@PollForThirdPartyJobs' {} ActionTypeId
a -> PollForThirdPartyJobs
s {$sel:actionTypeId:PollForThirdPartyJobs' :: ActionTypeId
actionTypeId = ActionTypeId
a} :: PollForThirdPartyJobs)
instance Core.AWSRequest PollForThirdPartyJobs where
type
AWSResponse PollForThirdPartyJobs =
PollForThirdPartyJobsResponse
request :: PollForThirdPartyJobs -> Request PollForThirdPartyJobs
request = Service -> PollForThirdPartyJobs -> Request PollForThirdPartyJobs
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PollForThirdPartyJobs
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PollForThirdPartyJobs)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PollForThirdPartyJobs))
-> Logger
-> Service
-> Proxy PollForThirdPartyJobs
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PollForThirdPartyJobs)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [ThirdPartyJob] -> Int -> PollForThirdPartyJobsResponse
PollForThirdPartyJobsResponse'
(Maybe [ThirdPartyJob] -> Int -> PollForThirdPartyJobsResponse)
-> Either String (Maybe [ThirdPartyJob])
-> Either String (Int -> PollForThirdPartyJobsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Key -> Either String (Maybe (Maybe [ThirdPartyJob]))
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"jobs" Either String (Maybe (Maybe [ThirdPartyJob]))
-> Maybe [ThirdPartyJob] -> Either String (Maybe [ThirdPartyJob])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ThirdPartyJob]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> PollForThirdPartyJobsResponse)
-> Either String Int -> Either String PollForThirdPartyJobsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable PollForThirdPartyJobs
instance Prelude.NFData PollForThirdPartyJobs
instance Core.ToHeaders PollForThirdPartyJobs where
toHeaders :: PollForThirdPartyJobs -> ResponseHeaders
toHeaders =
ResponseHeaders -> PollForThirdPartyJobs -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"CodePipeline_20150709.PollForThirdPartyJobs" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON PollForThirdPartyJobs where
toJSON :: PollForThirdPartyJobs -> Value
toJSON PollForThirdPartyJobs' {Maybe Natural
ActionTypeId
actionTypeId :: ActionTypeId
maxBatchSize :: Maybe Natural
$sel:actionTypeId:PollForThirdPartyJobs' :: PollForThirdPartyJobs -> ActionTypeId
$sel:maxBatchSize:PollForThirdPartyJobs' :: PollForThirdPartyJobs -> Maybe Natural
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"maxBatchSize" Key -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxBatchSize,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Key
"actionTypeId" Key -> ActionTypeId -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Core..= ActionTypeId
actionTypeId)
]
)
instance Core.ToPath PollForThirdPartyJobs where
toPath :: PollForThirdPartyJobs -> ByteString
toPath = ByteString -> PollForThirdPartyJobs -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PollForThirdPartyJobs where
toQuery :: PollForThirdPartyJobs -> QueryString
toQuery = QueryString -> PollForThirdPartyJobs -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PollForThirdPartyJobsResponse = PollForThirdPartyJobsResponse'
{
PollForThirdPartyJobsResponse -> Maybe [ThirdPartyJob]
jobs :: Prelude.Maybe [ThirdPartyJob],
PollForThirdPartyJobsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PollForThirdPartyJobsResponse
-> PollForThirdPartyJobsResponse -> Bool
(PollForThirdPartyJobsResponse
-> PollForThirdPartyJobsResponse -> Bool)
-> (PollForThirdPartyJobsResponse
-> PollForThirdPartyJobsResponse -> Bool)
-> Eq PollForThirdPartyJobsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PollForThirdPartyJobsResponse
-> PollForThirdPartyJobsResponse -> Bool
$c/= :: PollForThirdPartyJobsResponse
-> PollForThirdPartyJobsResponse -> Bool
== :: PollForThirdPartyJobsResponse
-> PollForThirdPartyJobsResponse -> Bool
$c== :: PollForThirdPartyJobsResponse
-> PollForThirdPartyJobsResponse -> Bool
Prelude.Eq, ReadPrec [PollForThirdPartyJobsResponse]
ReadPrec PollForThirdPartyJobsResponse
Int -> ReadS PollForThirdPartyJobsResponse
ReadS [PollForThirdPartyJobsResponse]
(Int -> ReadS PollForThirdPartyJobsResponse)
-> ReadS [PollForThirdPartyJobsResponse]
-> ReadPrec PollForThirdPartyJobsResponse
-> ReadPrec [PollForThirdPartyJobsResponse]
-> Read PollForThirdPartyJobsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PollForThirdPartyJobsResponse]
$creadListPrec :: ReadPrec [PollForThirdPartyJobsResponse]
readPrec :: ReadPrec PollForThirdPartyJobsResponse
$creadPrec :: ReadPrec PollForThirdPartyJobsResponse
readList :: ReadS [PollForThirdPartyJobsResponse]
$creadList :: ReadS [PollForThirdPartyJobsResponse]
readsPrec :: Int -> ReadS PollForThirdPartyJobsResponse
$creadsPrec :: Int -> ReadS PollForThirdPartyJobsResponse
Prelude.Read, Int -> PollForThirdPartyJobsResponse -> ShowS
[PollForThirdPartyJobsResponse] -> ShowS
PollForThirdPartyJobsResponse -> String
(Int -> PollForThirdPartyJobsResponse -> ShowS)
-> (PollForThirdPartyJobsResponse -> String)
-> ([PollForThirdPartyJobsResponse] -> ShowS)
-> Show PollForThirdPartyJobsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PollForThirdPartyJobsResponse] -> ShowS
$cshowList :: [PollForThirdPartyJobsResponse] -> ShowS
show :: PollForThirdPartyJobsResponse -> String
$cshow :: PollForThirdPartyJobsResponse -> String
showsPrec :: Int -> PollForThirdPartyJobsResponse -> ShowS
$cshowsPrec :: Int -> PollForThirdPartyJobsResponse -> ShowS
Prelude.Show, (forall x.
PollForThirdPartyJobsResponse
-> Rep PollForThirdPartyJobsResponse x)
-> (forall x.
Rep PollForThirdPartyJobsResponse x
-> PollForThirdPartyJobsResponse)
-> Generic PollForThirdPartyJobsResponse
forall x.
Rep PollForThirdPartyJobsResponse x
-> PollForThirdPartyJobsResponse
forall x.
PollForThirdPartyJobsResponse
-> Rep PollForThirdPartyJobsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PollForThirdPartyJobsResponse x
-> PollForThirdPartyJobsResponse
$cfrom :: forall x.
PollForThirdPartyJobsResponse
-> Rep PollForThirdPartyJobsResponse x
Prelude.Generic)
newPollForThirdPartyJobsResponse ::
Prelude.Int ->
PollForThirdPartyJobsResponse
newPollForThirdPartyJobsResponse :: Int -> PollForThirdPartyJobsResponse
newPollForThirdPartyJobsResponse Int
pHttpStatus_ =
PollForThirdPartyJobsResponse' :: Maybe [ThirdPartyJob] -> Int -> PollForThirdPartyJobsResponse
PollForThirdPartyJobsResponse'
{ $sel:jobs:PollForThirdPartyJobsResponse' :: Maybe [ThirdPartyJob]
jobs =
Maybe [ThirdPartyJob]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PollForThirdPartyJobsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
pollForThirdPartyJobsResponse_jobs :: Lens.Lens' PollForThirdPartyJobsResponse (Prelude.Maybe [ThirdPartyJob])
pollForThirdPartyJobsResponse_jobs :: (Maybe [ThirdPartyJob] -> f (Maybe [ThirdPartyJob]))
-> PollForThirdPartyJobsResponse -> f PollForThirdPartyJobsResponse
pollForThirdPartyJobsResponse_jobs = (PollForThirdPartyJobsResponse -> Maybe [ThirdPartyJob])
-> (PollForThirdPartyJobsResponse
-> Maybe [ThirdPartyJob] -> PollForThirdPartyJobsResponse)
-> Lens
PollForThirdPartyJobsResponse
PollForThirdPartyJobsResponse
(Maybe [ThirdPartyJob])
(Maybe [ThirdPartyJob])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PollForThirdPartyJobsResponse' {Maybe [ThirdPartyJob]
jobs :: Maybe [ThirdPartyJob]
$sel:jobs:PollForThirdPartyJobsResponse' :: PollForThirdPartyJobsResponse -> Maybe [ThirdPartyJob]
jobs} -> Maybe [ThirdPartyJob]
jobs) (\s :: PollForThirdPartyJobsResponse
s@PollForThirdPartyJobsResponse' {} Maybe [ThirdPartyJob]
a -> PollForThirdPartyJobsResponse
s {$sel:jobs:PollForThirdPartyJobsResponse' :: Maybe [ThirdPartyJob]
jobs = Maybe [ThirdPartyJob]
a} :: PollForThirdPartyJobsResponse) ((Maybe [ThirdPartyJob] -> f (Maybe [ThirdPartyJob]))
-> PollForThirdPartyJobsResponse
-> f PollForThirdPartyJobsResponse)
-> ((Maybe [ThirdPartyJob] -> f (Maybe [ThirdPartyJob]))
-> Maybe [ThirdPartyJob] -> f (Maybe [ThirdPartyJob]))
-> (Maybe [ThirdPartyJob] -> f (Maybe [ThirdPartyJob]))
-> PollForThirdPartyJobsResponse
-> f PollForThirdPartyJobsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[ThirdPartyJob] [ThirdPartyJob] [ThirdPartyJob] [ThirdPartyJob]
-> Iso
(Maybe [ThirdPartyJob])
(Maybe [ThirdPartyJob])
(Maybe [ThirdPartyJob])
(Maybe [ThirdPartyJob])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[ThirdPartyJob] [ThirdPartyJob] [ThirdPartyJob] [ThirdPartyJob]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
pollForThirdPartyJobsResponse_httpStatus :: Lens.Lens' PollForThirdPartyJobsResponse Prelude.Int
pollForThirdPartyJobsResponse_httpStatus :: (Int -> f Int)
-> PollForThirdPartyJobsResponse -> f PollForThirdPartyJobsResponse
pollForThirdPartyJobsResponse_httpStatus = (PollForThirdPartyJobsResponse -> Int)
-> (PollForThirdPartyJobsResponse
-> Int -> PollForThirdPartyJobsResponse)
-> Lens
PollForThirdPartyJobsResponse PollForThirdPartyJobsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PollForThirdPartyJobsResponse' {Int
httpStatus :: Int
$sel:httpStatus:PollForThirdPartyJobsResponse' :: PollForThirdPartyJobsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PollForThirdPartyJobsResponse
s@PollForThirdPartyJobsResponse' {} Int
a -> PollForThirdPartyJobsResponse
s {$sel:httpStatus:PollForThirdPartyJobsResponse' :: Int
httpStatus = Int
a} :: PollForThirdPartyJobsResponse)
instance Prelude.NFData PollForThirdPartyJobsResponse