{-# 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.PollForJobs
(
PollForJobs (..),
newPollForJobs,
pollForJobs_maxBatchSize,
pollForJobs_queryParam,
pollForJobs_actionTypeId,
PollForJobsResponse (..),
newPollForJobsResponse,
pollForJobsResponse_jobs,
pollForJobsResponse_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 PollForJobs = PollForJobs'
{
PollForJobs -> Maybe Natural
maxBatchSize :: Prelude.Maybe Prelude.Natural,
PollForJobs -> Maybe (HashMap Text Text)
queryParam :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
PollForJobs -> ActionTypeId
actionTypeId :: ActionTypeId
}
deriving (PollForJobs -> PollForJobs -> Bool
(PollForJobs -> PollForJobs -> Bool)
-> (PollForJobs -> PollForJobs -> Bool) -> Eq PollForJobs
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PollForJobs -> PollForJobs -> Bool
$c/= :: PollForJobs -> PollForJobs -> Bool
== :: PollForJobs -> PollForJobs -> Bool
$c== :: PollForJobs -> PollForJobs -> Bool
Prelude.Eq, ReadPrec [PollForJobs]
ReadPrec PollForJobs
Int -> ReadS PollForJobs
ReadS [PollForJobs]
(Int -> ReadS PollForJobs)
-> ReadS [PollForJobs]
-> ReadPrec PollForJobs
-> ReadPrec [PollForJobs]
-> Read PollForJobs
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PollForJobs]
$creadListPrec :: ReadPrec [PollForJobs]
readPrec :: ReadPrec PollForJobs
$creadPrec :: ReadPrec PollForJobs
readList :: ReadS [PollForJobs]
$creadList :: ReadS [PollForJobs]
readsPrec :: Int -> ReadS PollForJobs
$creadsPrec :: Int -> ReadS PollForJobs
Prelude.Read, Int -> PollForJobs -> ShowS
[PollForJobs] -> ShowS
PollForJobs -> String
(Int -> PollForJobs -> ShowS)
-> (PollForJobs -> String)
-> ([PollForJobs] -> ShowS)
-> Show PollForJobs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PollForJobs] -> ShowS
$cshowList :: [PollForJobs] -> ShowS
show :: PollForJobs -> String
$cshow :: PollForJobs -> String
showsPrec :: Int -> PollForJobs -> ShowS
$cshowsPrec :: Int -> PollForJobs -> ShowS
Prelude.Show, (forall x. PollForJobs -> Rep PollForJobs x)
-> (forall x. Rep PollForJobs x -> PollForJobs)
-> Generic PollForJobs
forall x. Rep PollForJobs x -> PollForJobs
forall x. PollForJobs -> Rep PollForJobs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PollForJobs x -> PollForJobs
$cfrom :: forall x. PollForJobs -> Rep PollForJobs x
Prelude.Generic)
newPollForJobs ::
ActionTypeId ->
PollForJobs
newPollForJobs :: ActionTypeId -> PollForJobs
newPollForJobs ActionTypeId
pActionTypeId_ =
PollForJobs' :: Maybe Natural
-> Maybe (HashMap Text Text) -> ActionTypeId -> PollForJobs
PollForJobs'
{ $sel:maxBatchSize:PollForJobs' :: Maybe Natural
maxBatchSize = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:queryParam:PollForJobs' :: Maybe (HashMap Text Text)
queryParam = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:actionTypeId:PollForJobs' :: ActionTypeId
actionTypeId = ActionTypeId
pActionTypeId_
}
pollForJobs_maxBatchSize :: Lens.Lens' PollForJobs (Prelude.Maybe Prelude.Natural)
pollForJobs_maxBatchSize :: (Maybe Natural -> f (Maybe Natural))
-> PollForJobs -> f PollForJobs
pollForJobs_maxBatchSize = (PollForJobs -> Maybe Natural)
-> (PollForJobs -> Maybe Natural -> PollForJobs)
-> Lens PollForJobs PollForJobs (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PollForJobs' {Maybe Natural
maxBatchSize :: Maybe Natural
$sel:maxBatchSize:PollForJobs' :: PollForJobs -> Maybe Natural
maxBatchSize} -> Maybe Natural
maxBatchSize) (\s :: PollForJobs
s@PollForJobs' {} Maybe Natural
a -> PollForJobs
s {$sel:maxBatchSize:PollForJobs' :: Maybe Natural
maxBatchSize = Maybe Natural
a} :: PollForJobs)
pollForJobs_queryParam :: Lens.Lens' PollForJobs (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
pollForJobs_queryParam :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> PollForJobs -> f PollForJobs
pollForJobs_queryParam = (PollForJobs -> Maybe (HashMap Text Text))
-> (PollForJobs -> Maybe (HashMap Text Text) -> PollForJobs)
-> Lens
PollForJobs
PollForJobs
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PollForJobs' {Maybe (HashMap Text Text)
queryParam :: Maybe (HashMap Text Text)
$sel:queryParam:PollForJobs' :: PollForJobs -> Maybe (HashMap Text Text)
queryParam} -> Maybe (HashMap Text Text)
queryParam) (\s :: PollForJobs
s@PollForJobs' {} Maybe (HashMap Text Text)
a -> PollForJobs
s {$sel:queryParam:PollForJobs' :: Maybe (HashMap Text Text)
queryParam = Maybe (HashMap Text Text)
a} :: PollForJobs) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> PollForJobs -> f PollForJobs)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> PollForJobs
-> f PollForJobs
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
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
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
pollForJobs_actionTypeId :: Lens.Lens' PollForJobs ActionTypeId
pollForJobs_actionTypeId :: (ActionTypeId -> f ActionTypeId) -> PollForJobs -> f PollForJobs
pollForJobs_actionTypeId = (PollForJobs -> ActionTypeId)
-> (PollForJobs -> ActionTypeId -> PollForJobs)
-> Lens PollForJobs PollForJobs ActionTypeId ActionTypeId
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PollForJobs' {ActionTypeId
actionTypeId :: ActionTypeId
$sel:actionTypeId:PollForJobs' :: PollForJobs -> ActionTypeId
actionTypeId} -> ActionTypeId
actionTypeId) (\s :: PollForJobs
s@PollForJobs' {} ActionTypeId
a -> PollForJobs
s {$sel:actionTypeId:PollForJobs' :: ActionTypeId
actionTypeId = ActionTypeId
a} :: PollForJobs)
instance Core.AWSRequest PollForJobs where
type AWSResponse PollForJobs = PollForJobsResponse
request :: PollForJobs -> Request PollForJobs
request = Service -> PollForJobs -> Request PollForJobs
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PollForJobs
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PollForJobs)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PollForJobs))
-> Logger
-> Service
-> Proxy PollForJobs
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PollForJobs)))
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 [Job] -> Int -> PollForJobsResponse
PollForJobsResponse'
(Maybe [Job] -> Int -> PollForJobsResponse)
-> Either String (Maybe [Job])
-> Either String (Int -> PollForJobsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Job]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"jobs" Either String (Maybe (Maybe [Job]))
-> Maybe [Job] -> Either String (Maybe [Job])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Job]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> PollForJobsResponse)
-> Either String Int -> Either String PollForJobsResponse
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 PollForJobs
instance Prelude.NFData PollForJobs
instance Core.ToHeaders PollForJobs where
toHeaders :: PollForJobs -> ResponseHeaders
toHeaders =
ResponseHeaders -> PollForJobs -> 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.PollForJobs" ::
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 PollForJobs where
toJSON :: PollForJobs -> Value
toJSON PollForJobs' {Maybe Natural
Maybe (HashMap Text Text)
ActionTypeId
actionTypeId :: ActionTypeId
queryParam :: Maybe (HashMap Text Text)
maxBatchSize :: Maybe Natural
$sel:actionTypeId:PollForJobs' :: PollForJobs -> ActionTypeId
$sel:queryParam:PollForJobs' :: PollForJobs -> Maybe (HashMap Text Text)
$sel:maxBatchSize:PollForJobs' :: PollForJobs -> Maybe Natural
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"maxBatchSize" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> 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,
(Text
"queryParam" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
queryParam,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"actionTypeId" Text -> ActionTypeId -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ActionTypeId
actionTypeId)
]
)
instance Core.ToPath PollForJobs where
toPath :: PollForJobs -> ByteString
toPath = ByteString -> PollForJobs -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PollForJobs where
toQuery :: PollForJobs -> QueryString
toQuery = QueryString -> PollForJobs -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PollForJobsResponse = PollForJobsResponse'
{
PollForJobsResponse -> Maybe [Job]
jobs :: Prelude.Maybe [Job],
PollForJobsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PollForJobsResponse -> PollForJobsResponse -> Bool
(PollForJobsResponse -> PollForJobsResponse -> Bool)
-> (PollForJobsResponse -> PollForJobsResponse -> Bool)
-> Eq PollForJobsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PollForJobsResponse -> PollForJobsResponse -> Bool
$c/= :: PollForJobsResponse -> PollForJobsResponse -> Bool
== :: PollForJobsResponse -> PollForJobsResponse -> Bool
$c== :: PollForJobsResponse -> PollForJobsResponse -> Bool
Prelude.Eq, Int -> PollForJobsResponse -> ShowS
[PollForJobsResponse] -> ShowS
PollForJobsResponse -> String
(Int -> PollForJobsResponse -> ShowS)
-> (PollForJobsResponse -> String)
-> ([PollForJobsResponse] -> ShowS)
-> Show PollForJobsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PollForJobsResponse] -> ShowS
$cshowList :: [PollForJobsResponse] -> ShowS
show :: PollForJobsResponse -> String
$cshow :: PollForJobsResponse -> String
showsPrec :: Int -> PollForJobsResponse -> ShowS
$cshowsPrec :: Int -> PollForJobsResponse -> ShowS
Prelude.Show, (forall x. PollForJobsResponse -> Rep PollForJobsResponse x)
-> (forall x. Rep PollForJobsResponse x -> PollForJobsResponse)
-> Generic PollForJobsResponse
forall x. Rep PollForJobsResponse x -> PollForJobsResponse
forall x. PollForJobsResponse -> Rep PollForJobsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PollForJobsResponse x -> PollForJobsResponse
$cfrom :: forall x. PollForJobsResponse -> Rep PollForJobsResponse x
Prelude.Generic)
newPollForJobsResponse ::
Prelude.Int ->
PollForJobsResponse
newPollForJobsResponse :: Int -> PollForJobsResponse
newPollForJobsResponse Int
pHttpStatus_ =
PollForJobsResponse' :: Maybe [Job] -> Int -> PollForJobsResponse
PollForJobsResponse'
{ $sel:jobs:PollForJobsResponse' :: Maybe [Job]
jobs = Maybe [Job]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PollForJobsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
pollForJobsResponse_jobs :: Lens.Lens' PollForJobsResponse (Prelude.Maybe [Job])
pollForJobsResponse_jobs :: (Maybe [Job] -> f (Maybe [Job]))
-> PollForJobsResponse -> f PollForJobsResponse
pollForJobsResponse_jobs = (PollForJobsResponse -> Maybe [Job])
-> (PollForJobsResponse -> Maybe [Job] -> PollForJobsResponse)
-> Lens
PollForJobsResponse PollForJobsResponse (Maybe [Job]) (Maybe [Job])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PollForJobsResponse' {Maybe [Job]
jobs :: Maybe [Job]
$sel:jobs:PollForJobsResponse' :: PollForJobsResponse -> Maybe [Job]
jobs} -> Maybe [Job]
jobs) (\s :: PollForJobsResponse
s@PollForJobsResponse' {} Maybe [Job]
a -> PollForJobsResponse
s {$sel:jobs:PollForJobsResponse' :: Maybe [Job]
jobs = Maybe [Job]
a} :: PollForJobsResponse) ((Maybe [Job] -> f (Maybe [Job]))
-> PollForJobsResponse -> f PollForJobsResponse)
-> ((Maybe [Job] -> f (Maybe [Job]))
-> Maybe [Job] -> f (Maybe [Job]))
-> (Maybe [Job] -> f (Maybe [Job]))
-> PollForJobsResponse
-> f PollForJobsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Job] [Job] [Job] [Job]
-> Iso (Maybe [Job]) (Maybe [Job]) (Maybe [Job]) (Maybe [Job])
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 [Job] [Job] [Job] [Job]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
pollForJobsResponse_httpStatus :: Lens.Lens' PollForJobsResponse Prelude.Int
pollForJobsResponse_httpStatus :: (Int -> f Int) -> PollForJobsResponse -> f PollForJobsResponse
pollForJobsResponse_httpStatus = (PollForJobsResponse -> Int)
-> (PollForJobsResponse -> Int -> PollForJobsResponse)
-> Lens PollForJobsResponse PollForJobsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PollForJobsResponse' {Int
httpStatus :: Int
$sel:httpStatus:PollForJobsResponse' :: PollForJobsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PollForJobsResponse
s@PollForJobsResponse' {} Int
a -> PollForJobsResponse
s {$sel:httpStatus:PollForJobsResponse' :: Int
httpStatus = Int
a} :: PollForJobsResponse)
instance Prelude.NFData PollForJobsResponse