{-# 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.BatchGetBuilds
(
BatchGetBuilds (..),
newBatchGetBuilds,
batchGetBuilds_ids,
BatchGetBuildsResponse (..),
newBatchGetBuildsResponse,
batchGetBuildsResponse_builds,
batchGetBuildsResponse_buildsNotFound,
batchGetBuildsResponse_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 BatchGetBuilds = BatchGetBuilds'
{
BatchGetBuilds -> NonEmpty Text
ids :: Prelude.NonEmpty Prelude.Text
}
deriving (BatchGetBuilds -> BatchGetBuilds -> Bool
(BatchGetBuilds -> BatchGetBuilds -> Bool)
-> (BatchGetBuilds -> BatchGetBuilds -> Bool) -> Eq BatchGetBuilds
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetBuilds -> BatchGetBuilds -> Bool
$c/= :: BatchGetBuilds -> BatchGetBuilds -> Bool
== :: BatchGetBuilds -> BatchGetBuilds -> Bool
$c== :: BatchGetBuilds -> BatchGetBuilds -> Bool
Prelude.Eq, ReadPrec [BatchGetBuilds]
ReadPrec BatchGetBuilds
Int -> ReadS BatchGetBuilds
ReadS [BatchGetBuilds]
(Int -> ReadS BatchGetBuilds)
-> ReadS [BatchGetBuilds]
-> ReadPrec BatchGetBuilds
-> ReadPrec [BatchGetBuilds]
-> Read BatchGetBuilds
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGetBuilds]
$creadListPrec :: ReadPrec [BatchGetBuilds]
readPrec :: ReadPrec BatchGetBuilds
$creadPrec :: ReadPrec BatchGetBuilds
readList :: ReadS [BatchGetBuilds]
$creadList :: ReadS [BatchGetBuilds]
readsPrec :: Int -> ReadS BatchGetBuilds
$creadsPrec :: Int -> ReadS BatchGetBuilds
Prelude.Read, Int -> BatchGetBuilds -> ShowS
[BatchGetBuilds] -> ShowS
BatchGetBuilds -> String
(Int -> BatchGetBuilds -> ShowS)
-> (BatchGetBuilds -> String)
-> ([BatchGetBuilds] -> ShowS)
-> Show BatchGetBuilds
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetBuilds] -> ShowS
$cshowList :: [BatchGetBuilds] -> ShowS
show :: BatchGetBuilds -> String
$cshow :: BatchGetBuilds -> String
showsPrec :: Int -> BatchGetBuilds -> ShowS
$cshowsPrec :: Int -> BatchGetBuilds -> ShowS
Prelude.Show, (forall x. BatchGetBuilds -> Rep BatchGetBuilds x)
-> (forall x. Rep BatchGetBuilds x -> BatchGetBuilds)
-> Generic BatchGetBuilds
forall x. Rep BatchGetBuilds x -> BatchGetBuilds
forall x. BatchGetBuilds -> Rep BatchGetBuilds x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchGetBuilds x -> BatchGetBuilds
$cfrom :: forall x. BatchGetBuilds -> Rep BatchGetBuilds x
Prelude.Generic)
newBatchGetBuilds ::
Prelude.NonEmpty Prelude.Text ->
BatchGetBuilds
newBatchGetBuilds :: NonEmpty Text -> BatchGetBuilds
newBatchGetBuilds NonEmpty Text
pIds_ =
BatchGetBuilds' :: NonEmpty Text -> BatchGetBuilds
BatchGetBuilds' {$sel:ids:BatchGetBuilds' :: NonEmpty Text
ids = Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pIds_}
batchGetBuilds_ids :: Lens.Lens' BatchGetBuilds (Prelude.NonEmpty Prelude.Text)
batchGetBuilds_ids :: (NonEmpty Text -> f (NonEmpty Text))
-> BatchGetBuilds -> f BatchGetBuilds
batchGetBuilds_ids = (BatchGetBuilds -> NonEmpty Text)
-> (BatchGetBuilds -> NonEmpty Text -> BatchGetBuilds)
-> Lens
BatchGetBuilds BatchGetBuilds (NonEmpty Text) (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetBuilds' {NonEmpty Text
ids :: NonEmpty Text
$sel:ids:BatchGetBuilds' :: BatchGetBuilds -> NonEmpty Text
ids} -> NonEmpty Text
ids) (\s :: BatchGetBuilds
s@BatchGetBuilds' {} NonEmpty Text
a -> BatchGetBuilds
s {$sel:ids:BatchGetBuilds' :: NonEmpty Text
ids = NonEmpty Text
a} :: BatchGetBuilds) ((NonEmpty Text -> f (NonEmpty Text))
-> BatchGetBuilds -> f BatchGetBuilds)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> BatchGetBuilds
-> f BatchGetBuilds
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest BatchGetBuilds where
type
AWSResponse BatchGetBuilds =
BatchGetBuildsResponse
request :: BatchGetBuilds -> Request BatchGetBuilds
request = Service -> BatchGetBuilds -> Request BatchGetBuilds
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy BatchGetBuilds
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse BatchGetBuilds)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse BatchGetBuilds))
-> Logger
-> Service
-> Proxy BatchGetBuilds
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse BatchGetBuilds)))
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 [Build]
-> Maybe (NonEmpty Text) -> Int -> BatchGetBuildsResponse
BatchGetBuildsResponse'
(Maybe [Build]
-> Maybe (NonEmpty Text) -> Int -> BatchGetBuildsResponse)
-> Either String (Maybe [Build])
-> Either
String (Maybe (NonEmpty Text) -> Int -> BatchGetBuildsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Build]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"builds" Either String (Maybe (Maybe [Build]))
-> Maybe [Build] -> Either String (Maybe [Build])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Build]
forall a. Monoid a => a
Prelude.mempty)
Either
String (Maybe (NonEmpty Text) -> Int -> BatchGetBuildsResponse)
-> Either String (Maybe (NonEmpty Text))
-> Either String (Int -> BatchGetBuildsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (NonEmpty Text))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"buildsNotFound")
Either String (Int -> BatchGetBuildsResponse)
-> Either String Int -> Either String BatchGetBuildsResponse
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 BatchGetBuilds
instance Prelude.NFData BatchGetBuilds
instance Core.ToHeaders BatchGetBuilds where
toHeaders :: BatchGetBuilds -> ResponseHeaders
toHeaders =
ResponseHeaders -> BatchGetBuilds -> 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.BatchGetBuilds" ::
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 BatchGetBuilds where
toJSON :: BatchGetBuilds -> Value
toJSON BatchGetBuilds' {NonEmpty Text
ids :: NonEmpty Text
$sel:ids:BatchGetBuilds' :: BatchGetBuilds -> NonEmpty Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ids" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
ids)]
)
instance Core.ToPath BatchGetBuilds where
toPath :: BatchGetBuilds -> ByteString
toPath = ByteString -> BatchGetBuilds -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery BatchGetBuilds where
toQuery :: BatchGetBuilds -> QueryString
toQuery = QueryString -> BatchGetBuilds -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data BatchGetBuildsResponse = BatchGetBuildsResponse'
{
BatchGetBuildsResponse -> Maybe [Build]
builds :: Prelude.Maybe [Build],
BatchGetBuildsResponse -> Maybe (NonEmpty Text)
buildsNotFound :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
BatchGetBuildsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (BatchGetBuildsResponse -> BatchGetBuildsResponse -> Bool
(BatchGetBuildsResponse -> BatchGetBuildsResponse -> Bool)
-> (BatchGetBuildsResponse -> BatchGetBuildsResponse -> Bool)
-> Eq BatchGetBuildsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetBuildsResponse -> BatchGetBuildsResponse -> Bool
$c/= :: BatchGetBuildsResponse -> BatchGetBuildsResponse -> Bool
== :: BatchGetBuildsResponse -> BatchGetBuildsResponse -> Bool
$c== :: BatchGetBuildsResponse -> BatchGetBuildsResponse -> Bool
Prelude.Eq, ReadPrec [BatchGetBuildsResponse]
ReadPrec BatchGetBuildsResponse
Int -> ReadS BatchGetBuildsResponse
ReadS [BatchGetBuildsResponse]
(Int -> ReadS BatchGetBuildsResponse)
-> ReadS [BatchGetBuildsResponse]
-> ReadPrec BatchGetBuildsResponse
-> ReadPrec [BatchGetBuildsResponse]
-> Read BatchGetBuildsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGetBuildsResponse]
$creadListPrec :: ReadPrec [BatchGetBuildsResponse]
readPrec :: ReadPrec BatchGetBuildsResponse
$creadPrec :: ReadPrec BatchGetBuildsResponse
readList :: ReadS [BatchGetBuildsResponse]
$creadList :: ReadS [BatchGetBuildsResponse]
readsPrec :: Int -> ReadS BatchGetBuildsResponse
$creadsPrec :: Int -> ReadS BatchGetBuildsResponse
Prelude.Read, Int -> BatchGetBuildsResponse -> ShowS
[BatchGetBuildsResponse] -> ShowS
BatchGetBuildsResponse -> String
(Int -> BatchGetBuildsResponse -> ShowS)
-> (BatchGetBuildsResponse -> String)
-> ([BatchGetBuildsResponse] -> ShowS)
-> Show BatchGetBuildsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetBuildsResponse] -> ShowS
$cshowList :: [BatchGetBuildsResponse] -> ShowS
show :: BatchGetBuildsResponse -> String
$cshow :: BatchGetBuildsResponse -> String
showsPrec :: Int -> BatchGetBuildsResponse -> ShowS
$cshowsPrec :: Int -> BatchGetBuildsResponse -> ShowS
Prelude.Show, (forall x. BatchGetBuildsResponse -> Rep BatchGetBuildsResponse x)
-> (forall x.
Rep BatchGetBuildsResponse x -> BatchGetBuildsResponse)
-> Generic BatchGetBuildsResponse
forall x. Rep BatchGetBuildsResponse x -> BatchGetBuildsResponse
forall x. BatchGetBuildsResponse -> Rep BatchGetBuildsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchGetBuildsResponse x -> BatchGetBuildsResponse
$cfrom :: forall x. BatchGetBuildsResponse -> Rep BatchGetBuildsResponse x
Prelude.Generic)
newBatchGetBuildsResponse ::
Prelude.Int ->
BatchGetBuildsResponse
newBatchGetBuildsResponse :: Int -> BatchGetBuildsResponse
newBatchGetBuildsResponse Int
pHttpStatus_ =
BatchGetBuildsResponse' :: Maybe [Build]
-> Maybe (NonEmpty Text) -> Int -> BatchGetBuildsResponse
BatchGetBuildsResponse'
{ $sel:builds:BatchGetBuildsResponse' :: Maybe [Build]
builds = Maybe [Build]
forall a. Maybe a
Prelude.Nothing,
$sel:buildsNotFound:BatchGetBuildsResponse' :: Maybe (NonEmpty Text)
buildsNotFound = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchGetBuildsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchGetBuildsResponse_builds :: Lens.Lens' BatchGetBuildsResponse (Prelude.Maybe [Build])
batchGetBuildsResponse_builds :: (Maybe [Build] -> f (Maybe [Build]))
-> BatchGetBuildsResponse -> f BatchGetBuildsResponse
batchGetBuildsResponse_builds = (BatchGetBuildsResponse -> Maybe [Build])
-> (BatchGetBuildsResponse
-> Maybe [Build] -> BatchGetBuildsResponse)
-> Lens
BatchGetBuildsResponse
BatchGetBuildsResponse
(Maybe [Build])
(Maybe [Build])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetBuildsResponse' {Maybe [Build]
builds :: Maybe [Build]
$sel:builds:BatchGetBuildsResponse' :: BatchGetBuildsResponse -> Maybe [Build]
builds} -> Maybe [Build]
builds) (\s :: BatchGetBuildsResponse
s@BatchGetBuildsResponse' {} Maybe [Build]
a -> BatchGetBuildsResponse
s {$sel:builds:BatchGetBuildsResponse' :: Maybe [Build]
builds = Maybe [Build]
a} :: BatchGetBuildsResponse) ((Maybe [Build] -> f (Maybe [Build]))
-> BatchGetBuildsResponse -> f BatchGetBuildsResponse)
-> ((Maybe [Build] -> f (Maybe [Build]))
-> Maybe [Build] -> f (Maybe [Build]))
-> (Maybe [Build] -> f (Maybe [Build]))
-> BatchGetBuildsResponse
-> f BatchGetBuildsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Build] [Build] [Build] [Build]
-> Iso
(Maybe [Build]) (Maybe [Build]) (Maybe [Build]) (Maybe [Build])
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 [Build] [Build] [Build] [Build]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchGetBuildsResponse_buildsNotFound :: Lens.Lens' BatchGetBuildsResponse (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
batchGetBuildsResponse_buildsNotFound :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> BatchGetBuildsResponse -> f BatchGetBuildsResponse
batchGetBuildsResponse_buildsNotFound = (BatchGetBuildsResponse -> Maybe (NonEmpty Text))
-> (BatchGetBuildsResponse
-> Maybe (NonEmpty Text) -> BatchGetBuildsResponse)
-> Lens
BatchGetBuildsResponse
BatchGetBuildsResponse
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetBuildsResponse' {Maybe (NonEmpty Text)
buildsNotFound :: Maybe (NonEmpty Text)
$sel:buildsNotFound:BatchGetBuildsResponse' :: BatchGetBuildsResponse -> Maybe (NonEmpty Text)
buildsNotFound} -> Maybe (NonEmpty Text)
buildsNotFound) (\s :: BatchGetBuildsResponse
s@BatchGetBuildsResponse' {} Maybe (NonEmpty Text)
a -> BatchGetBuildsResponse
s {$sel:buildsNotFound:BatchGetBuildsResponse' :: Maybe (NonEmpty Text)
buildsNotFound = Maybe (NonEmpty Text)
a} :: BatchGetBuildsResponse) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> BatchGetBuildsResponse -> f BatchGetBuildsResponse)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> BatchGetBuildsResponse
-> f BatchGetBuildsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
(Maybe (NonEmpty 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
(NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchGetBuildsResponse_httpStatus :: Lens.Lens' BatchGetBuildsResponse Prelude.Int
batchGetBuildsResponse_httpStatus :: (Int -> f Int)
-> BatchGetBuildsResponse -> f BatchGetBuildsResponse
batchGetBuildsResponse_httpStatus = (BatchGetBuildsResponse -> Int)
-> (BatchGetBuildsResponse -> Int -> BatchGetBuildsResponse)
-> Lens BatchGetBuildsResponse BatchGetBuildsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetBuildsResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchGetBuildsResponse' :: BatchGetBuildsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchGetBuildsResponse
s@BatchGetBuildsResponse' {} Int
a -> BatchGetBuildsResponse
s {$sel:httpStatus:BatchGetBuildsResponse' :: Int
httpStatus = Int
a} :: BatchGetBuildsResponse)
instance Prelude.NFData BatchGetBuildsResponse