{-# 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.CodeBuild.RetryBuildBatch
(
RetryBuildBatch (..),
newRetryBuildBatch,
retryBuildBatch_idempotencyToken,
retryBuildBatch_id,
retryBuildBatch_retryType,
RetryBuildBatchResponse (..),
newRetryBuildBatchResponse,
retryBuildBatchResponse_buildBatch,
retryBuildBatchResponse_httpStatus,
)
where
import Amazonka.CodeBuild.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 RetryBuildBatch = RetryBuildBatch'
{
RetryBuildBatch -> Maybe Text
idempotencyToken :: Prelude.Maybe Prelude.Text,
RetryBuildBatch -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
RetryBuildBatch -> Maybe RetryBuildBatchType
retryType :: Prelude.Maybe RetryBuildBatchType
}
deriving (RetryBuildBatch -> RetryBuildBatch -> Bool
(RetryBuildBatch -> RetryBuildBatch -> Bool)
-> (RetryBuildBatch -> RetryBuildBatch -> Bool)
-> Eq RetryBuildBatch
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RetryBuildBatch -> RetryBuildBatch -> Bool
$c/= :: RetryBuildBatch -> RetryBuildBatch -> Bool
== :: RetryBuildBatch -> RetryBuildBatch -> Bool
$c== :: RetryBuildBatch -> RetryBuildBatch -> Bool
Prelude.Eq, ReadPrec [RetryBuildBatch]
ReadPrec RetryBuildBatch
Int -> ReadS RetryBuildBatch
ReadS [RetryBuildBatch]
(Int -> ReadS RetryBuildBatch)
-> ReadS [RetryBuildBatch]
-> ReadPrec RetryBuildBatch
-> ReadPrec [RetryBuildBatch]
-> Read RetryBuildBatch
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RetryBuildBatch]
$creadListPrec :: ReadPrec [RetryBuildBatch]
readPrec :: ReadPrec RetryBuildBatch
$creadPrec :: ReadPrec RetryBuildBatch
readList :: ReadS [RetryBuildBatch]
$creadList :: ReadS [RetryBuildBatch]
readsPrec :: Int -> ReadS RetryBuildBatch
$creadsPrec :: Int -> ReadS RetryBuildBatch
Prelude.Read, Int -> RetryBuildBatch -> ShowS
[RetryBuildBatch] -> ShowS
RetryBuildBatch -> String
(Int -> RetryBuildBatch -> ShowS)
-> (RetryBuildBatch -> String)
-> ([RetryBuildBatch] -> ShowS)
-> Show RetryBuildBatch
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RetryBuildBatch] -> ShowS
$cshowList :: [RetryBuildBatch] -> ShowS
show :: RetryBuildBatch -> String
$cshow :: RetryBuildBatch -> String
showsPrec :: Int -> RetryBuildBatch -> ShowS
$cshowsPrec :: Int -> RetryBuildBatch -> ShowS
Prelude.Show, (forall x. RetryBuildBatch -> Rep RetryBuildBatch x)
-> (forall x. Rep RetryBuildBatch x -> RetryBuildBatch)
-> Generic RetryBuildBatch
forall x. Rep RetryBuildBatch x -> RetryBuildBatch
forall x. RetryBuildBatch -> Rep RetryBuildBatch x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RetryBuildBatch x -> RetryBuildBatch
$cfrom :: forall x. RetryBuildBatch -> Rep RetryBuildBatch x
Prelude.Generic)
newRetryBuildBatch ::
RetryBuildBatch
newRetryBuildBatch :: RetryBuildBatch
newRetryBuildBatch =
RetryBuildBatch' :: Maybe Text
-> Maybe Text -> Maybe RetryBuildBatchType -> RetryBuildBatch
RetryBuildBatch'
{ $sel:idempotencyToken:RetryBuildBatch' :: Maybe Text
idempotencyToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:id:RetryBuildBatch' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:retryType:RetryBuildBatch' :: Maybe RetryBuildBatchType
retryType = Maybe RetryBuildBatchType
forall a. Maybe a
Prelude.Nothing
}
retryBuildBatch_idempotencyToken :: Lens.Lens' RetryBuildBatch (Prelude.Maybe Prelude.Text)
retryBuildBatch_idempotencyToken :: (Maybe Text -> f (Maybe Text))
-> RetryBuildBatch -> f RetryBuildBatch
retryBuildBatch_idempotencyToken = (RetryBuildBatch -> Maybe Text)
-> (RetryBuildBatch -> Maybe Text -> RetryBuildBatch)
-> Lens RetryBuildBatch RetryBuildBatch (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RetryBuildBatch' {Maybe Text
idempotencyToken :: Maybe Text
$sel:idempotencyToken:RetryBuildBatch' :: RetryBuildBatch -> Maybe Text
idempotencyToken} -> Maybe Text
idempotencyToken) (\s :: RetryBuildBatch
s@RetryBuildBatch' {} Maybe Text
a -> RetryBuildBatch
s {$sel:idempotencyToken:RetryBuildBatch' :: Maybe Text
idempotencyToken = Maybe Text
a} :: RetryBuildBatch)
retryBuildBatch_id :: Lens.Lens' RetryBuildBatch (Prelude.Maybe Prelude.Text)
retryBuildBatch_id :: (Maybe Text -> f (Maybe Text))
-> RetryBuildBatch -> f RetryBuildBatch
retryBuildBatch_id = (RetryBuildBatch -> Maybe Text)
-> (RetryBuildBatch -> Maybe Text -> RetryBuildBatch)
-> Lens RetryBuildBatch RetryBuildBatch (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RetryBuildBatch' {Maybe Text
id :: Maybe Text
$sel:id:RetryBuildBatch' :: RetryBuildBatch -> Maybe Text
id} -> Maybe Text
id) (\s :: RetryBuildBatch
s@RetryBuildBatch' {} Maybe Text
a -> RetryBuildBatch
s {$sel:id:RetryBuildBatch' :: Maybe Text
id = Maybe Text
a} :: RetryBuildBatch)
retryBuildBatch_retryType :: Lens.Lens' RetryBuildBatch (Prelude.Maybe RetryBuildBatchType)
retryBuildBatch_retryType :: (Maybe RetryBuildBatchType -> f (Maybe RetryBuildBatchType))
-> RetryBuildBatch -> f RetryBuildBatch
retryBuildBatch_retryType = (RetryBuildBatch -> Maybe RetryBuildBatchType)
-> (RetryBuildBatch
-> Maybe RetryBuildBatchType -> RetryBuildBatch)
-> Lens
RetryBuildBatch
RetryBuildBatch
(Maybe RetryBuildBatchType)
(Maybe RetryBuildBatchType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RetryBuildBatch' {Maybe RetryBuildBatchType
retryType :: Maybe RetryBuildBatchType
$sel:retryType:RetryBuildBatch' :: RetryBuildBatch -> Maybe RetryBuildBatchType
retryType} -> Maybe RetryBuildBatchType
retryType) (\s :: RetryBuildBatch
s@RetryBuildBatch' {} Maybe RetryBuildBatchType
a -> RetryBuildBatch
s {$sel:retryType:RetryBuildBatch' :: Maybe RetryBuildBatchType
retryType = Maybe RetryBuildBatchType
a} :: RetryBuildBatch)
instance Core.AWSRequest RetryBuildBatch where
type
AWSResponse RetryBuildBatch =
RetryBuildBatchResponse
request :: RetryBuildBatch -> Request RetryBuildBatch
request = Service -> RetryBuildBatch -> Request RetryBuildBatch
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RetryBuildBatch
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RetryBuildBatch)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse RetryBuildBatch))
-> Logger
-> Service
-> Proxy RetryBuildBatch
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RetryBuildBatch)))
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 BuildBatch -> Int -> RetryBuildBatchResponse
RetryBuildBatchResponse'
(Maybe BuildBatch -> Int -> RetryBuildBatchResponse)
-> Either String (Maybe BuildBatch)
-> Either String (Int -> RetryBuildBatchResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe BuildBatch)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"buildBatch")
Either String (Int -> RetryBuildBatchResponse)
-> Either String Int -> Either String RetryBuildBatchResponse
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 RetryBuildBatch
instance Prelude.NFData RetryBuildBatch
instance Core.ToHeaders RetryBuildBatch where
toHeaders :: RetryBuildBatch -> ResponseHeaders
toHeaders =
ResponseHeaders -> RetryBuildBatch -> 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
"CodeBuild_20161006.RetryBuildBatch" ::
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 RetryBuildBatch where
toJSON :: RetryBuildBatch -> Value
toJSON RetryBuildBatch' {Maybe Text
Maybe RetryBuildBatchType
retryType :: Maybe RetryBuildBatchType
id :: Maybe Text
idempotencyToken :: Maybe Text
$sel:retryType:RetryBuildBatch' :: RetryBuildBatch -> Maybe RetryBuildBatchType
$sel:id:RetryBuildBatch' :: RetryBuildBatch -> Maybe Text
$sel:idempotencyToken:RetryBuildBatch' :: RetryBuildBatch -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"idempotencyToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
idempotencyToken,
(Text
"id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
id,
(Text
"retryType" Text -> RetryBuildBatchType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (RetryBuildBatchType -> Pair)
-> Maybe RetryBuildBatchType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RetryBuildBatchType
retryType
]
)
instance Core.ToPath RetryBuildBatch where
toPath :: RetryBuildBatch -> ByteString
toPath = ByteString -> RetryBuildBatch -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery RetryBuildBatch where
toQuery :: RetryBuildBatch -> QueryString
toQuery = QueryString -> RetryBuildBatch -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data RetryBuildBatchResponse = RetryBuildBatchResponse'
{ RetryBuildBatchResponse -> Maybe BuildBatch
buildBatch :: Prelude.Maybe BuildBatch,
RetryBuildBatchResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RetryBuildBatchResponse -> RetryBuildBatchResponse -> Bool
(RetryBuildBatchResponse -> RetryBuildBatchResponse -> Bool)
-> (RetryBuildBatchResponse -> RetryBuildBatchResponse -> Bool)
-> Eq RetryBuildBatchResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RetryBuildBatchResponse -> RetryBuildBatchResponse -> Bool
$c/= :: RetryBuildBatchResponse -> RetryBuildBatchResponse -> Bool
== :: RetryBuildBatchResponse -> RetryBuildBatchResponse -> Bool
$c== :: RetryBuildBatchResponse -> RetryBuildBatchResponse -> Bool
Prelude.Eq, ReadPrec [RetryBuildBatchResponse]
ReadPrec RetryBuildBatchResponse
Int -> ReadS RetryBuildBatchResponse
ReadS [RetryBuildBatchResponse]
(Int -> ReadS RetryBuildBatchResponse)
-> ReadS [RetryBuildBatchResponse]
-> ReadPrec RetryBuildBatchResponse
-> ReadPrec [RetryBuildBatchResponse]
-> Read RetryBuildBatchResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RetryBuildBatchResponse]
$creadListPrec :: ReadPrec [RetryBuildBatchResponse]
readPrec :: ReadPrec RetryBuildBatchResponse
$creadPrec :: ReadPrec RetryBuildBatchResponse
readList :: ReadS [RetryBuildBatchResponse]
$creadList :: ReadS [RetryBuildBatchResponse]
readsPrec :: Int -> ReadS RetryBuildBatchResponse
$creadsPrec :: Int -> ReadS RetryBuildBatchResponse
Prelude.Read, Int -> RetryBuildBatchResponse -> ShowS
[RetryBuildBatchResponse] -> ShowS
RetryBuildBatchResponse -> String
(Int -> RetryBuildBatchResponse -> ShowS)
-> (RetryBuildBatchResponse -> String)
-> ([RetryBuildBatchResponse] -> ShowS)
-> Show RetryBuildBatchResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RetryBuildBatchResponse] -> ShowS
$cshowList :: [RetryBuildBatchResponse] -> ShowS
show :: RetryBuildBatchResponse -> String
$cshow :: RetryBuildBatchResponse -> String
showsPrec :: Int -> RetryBuildBatchResponse -> ShowS
$cshowsPrec :: Int -> RetryBuildBatchResponse -> ShowS
Prelude.Show, (forall x.
RetryBuildBatchResponse -> Rep RetryBuildBatchResponse x)
-> (forall x.
Rep RetryBuildBatchResponse x -> RetryBuildBatchResponse)
-> Generic RetryBuildBatchResponse
forall x. Rep RetryBuildBatchResponse x -> RetryBuildBatchResponse
forall x. RetryBuildBatchResponse -> Rep RetryBuildBatchResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RetryBuildBatchResponse x -> RetryBuildBatchResponse
$cfrom :: forall x. RetryBuildBatchResponse -> Rep RetryBuildBatchResponse x
Prelude.Generic)
newRetryBuildBatchResponse ::
Prelude.Int ->
RetryBuildBatchResponse
newRetryBuildBatchResponse :: Int -> RetryBuildBatchResponse
newRetryBuildBatchResponse Int
pHttpStatus_ =
RetryBuildBatchResponse' :: Maybe BuildBatch -> Int -> RetryBuildBatchResponse
RetryBuildBatchResponse'
{ $sel:buildBatch:RetryBuildBatchResponse' :: Maybe BuildBatch
buildBatch =
Maybe BuildBatch
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:RetryBuildBatchResponse' :: Int
httpStatus = Int
pHttpStatus_
}
retryBuildBatchResponse_buildBatch :: Lens.Lens' RetryBuildBatchResponse (Prelude.Maybe BuildBatch)
retryBuildBatchResponse_buildBatch :: (Maybe BuildBatch -> f (Maybe BuildBatch))
-> RetryBuildBatchResponse -> f RetryBuildBatchResponse
retryBuildBatchResponse_buildBatch = (RetryBuildBatchResponse -> Maybe BuildBatch)
-> (RetryBuildBatchResponse
-> Maybe BuildBatch -> RetryBuildBatchResponse)
-> Lens
RetryBuildBatchResponse
RetryBuildBatchResponse
(Maybe BuildBatch)
(Maybe BuildBatch)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RetryBuildBatchResponse' {Maybe BuildBatch
buildBatch :: Maybe BuildBatch
$sel:buildBatch:RetryBuildBatchResponse' :: RetryBuildBatchResponse -> Maybe BuildBatch
buildBatch} -> Maybe BuildBatch
buildBatch) (\s :: RetryBuildBatchResponse
s@RetryBuildBatchResponse' {} Maybe BuildBatch
a -> RetryBuildBatchResponse
s {$sel:buildBatch:RetryBuildBatchResponse' :: Maybe BuildBatch
buildBatch = Maybe BuildBatch
a} :: RetryBuildBatchResponse)
retryBuildBatchResponse_httpStatus :: Lens.Lens' RetryBuildBatchResponse Prelude.Int
retryBuildBatchResponse_httpStatus :: (Int -> f Int)
-> RetryBuildBatchResponse -> f RetryBuildBatchResponse
retryBuildBatchResponse_httpStatus = (RetryBuildBatchResponse -> Int)
-> (RetryBuildBatchResponse -> Int -> RetryBuildBatchResponse)
-> Lens RetryBuildBatchResponse RetryBuildBatchResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RetryBuildBatchResponse' {Int
httpStatus :: Int
$sel:httpStatus:RetryBuildBatchResponse' :: RetryBuildBatchResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RetryBuildBatchResponse
s@RetryBuildBatchResponse' {} Int
a -> RetryBuildBatchResponse
s {$sel:httpStatus:RetryBuildBatchResponse' :: Int
httpStatus = Int
a} :: RetryBuildBatchResponse)
instance Prelude.NFData RetryBuildBatchResponse