{-# 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.BatchGetProjects
(
BatchGetProjects (..),
newBatchGetProjects,
batchGetProjects_names,
BatchGetProjectsResponse (..),
newBatchGetProjectsResponse,
batchGetProjectsResponse_projectsNotFound,
batchGetProjectsResponse_projects,
batchGetProjectsResponse_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 BatchGetProjects = BatchGetProjects'
{
BatchGetProjects -> NonEmpty Text
names :: Prelude.NonEmpty Prelude.Text
}
deriving (BatchGetProjects -> BatchGetProjects -> Bool
(BatchGetProjects -> BatchGetProjects -> Bool)
-> (BatchGetProjects -> BatchGetProjects -> Bool)
-> Eq BatchGetProjects
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetProjects -> BatchGetProjects -> Bool
$c/= :: BatchGetProjects -> BatchGetProjects -> Bool
== :: BatchGetProjects -> BatchGetProjects -> Bool
$c== :: BatchGetProjects -> BatchGetProjects -> Bool
Prelude.Eq, ReadPrec [BatchGetProjects]
ReadPrec BatchGetProjects
Int -> ReadS BatchGetProjects
ReadS [BatchGetProjects]
(Int -> ReadS BatchGetProjects)
-> ReadS [BatchGetProjects]
-> ReadPrec BatchGetProjects
-> ReadPrec [BatchGetProjects]
-> Read BatchGetProjects
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGetProjects]
$creadListPrec :: ReadPrec [BatchGetProjects]
readPrec :: ReadPrec BatchGetProjects
$creadPrec :: ReadPrec BatchGetProjects
readList :: ReadS [BatchGetProjects]
$creadList :: ReadS [BatchGetProjects]
readsPrec :: Int -> ReadS BatchGetProjects
$creadsPrec :: Int -> ReadS BatchGetProjects
Prelude.Read, Int -> BatchGetProjects -> ShowS
[BatchGetProjects] -> ShowS
BatchGetProjects -> String
(Int -> BatchGetProjects -> ShowS)
-> (BatchGetProjects -> String)
-> ([BatchGetProjects] -> ShowS)
-> Show BatchGetProjects
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetProjects] -> ShowS
$cshowList :: [BatchGetProjects] -> ShowS
show :: BatchGetProjects -> String
$cshow :: BatchGetProjects -> String
showsPrec :: Int -> BatchGetProjects -> ShowS
$cshowsPrec :: Int -> BatchGetProjects -> ShowS
Prelude.Show, (forall x. BatchGetProjects -> Rep BatchGetProjects x)
-> (forall x. Rep BatchGetProjects x -> BatchGetProjects)
-> Generic BatchGetProjects
forall x. Rep BatchGetProjects x -> BatchGetProjects
forall x. BatchGetProjects -> Rep BatchGetProjects x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchGetProjects x -> BatchGetProjects
$cfrom :: forall x. BatchGetProjects -> Rep BatchGetProjects x
Prelude.Generic)
newBatchGetProjects ::
Prelude.NonEmpty Prelude.Text ->
BatchGetProjects
newBatchGetProjects :: NonEmpty Text -> BatchGetProjects
newBatchGetProjects NonEmpty Text
pNames_ =
BatchGetProjects' :: NonEmpty Text -> BatchGetProjects
BatchGetProjects'
{ $sel:names:BatchGetProjects' :: NonEmpty Text
names =
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
pNames_
}
batchGetProjects_names :: Lens.Lens' BatchGetProjects (Prelude.NonEmpty Prelude.Text)
batchGetProjects_names :: (NonEmpty Text -> f (NonEmpty Text))
-> BatchGetProjects -> f BatchGetProjects
batchGetProjects_names = (BatchGetProjects -> NonEmpty Text)
-> (BatchGetProjects -> NonEmpty Text -> BatchGetProjects)
-> Lens
BatchGetProjects BatchGetProjects (NonEmpty Text) (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetProjects' {NonEmpty Text
names :: NonEmpty Text
$sel:names:BatchGetProjects' :: BatchGetProjects -> NonEmpty Text
names} -> NonEmpty Text
names) (\s :: BatchGetProjects
s@BatchGetProjects' {} NonEmpty Text
a -> BatchGetProjects
s {$sel:names:BatchGetProjects' :: NonEmpty Text
names = NonEmpty Text
a} :: BatchGetProjects) ((NonEmpty Text -> f (NonEmpty Text))
-> BatchGetProjects -> f BatchGetProjects)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> BatchGetProjects
-> f BatchGetProjects
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 BatchGetProjects where
type
AWSResponse BatchGetProjects =
BatchGetProjectsResponse
request :: BatchGetProjects -> Request BatchGetProjects
request = Service -> BatchGetProjects -> Request BatchGetProjects
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy BatchGetProjects
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse BatchGetProjects)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse BatchGetProjects))
-> Logger
-> Service
-> Proxy BatchGetProjects
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse BatchGetProjects)))
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 (NonEmpty Text)
-> Maybe [Project] -> Int -> BatchGetProjectsResponse
BatchGetProjectsResponse'
(Maybe (NonEmpty Text)
-> Maybe [Project] -> Int -> BatchGetProjectsResponse)
-> Either String (Maybe (NonEmpty Text))
-> Either
String (Maybe [Project] -> Int -> BatchGetProjectsResponse)
forall (f :: * -> *) a b. Functor 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
"projectsNotFound")
Either String (Maybe [Project] -> Int -> BatchGetProjectsResponse)
-> Either String (Maybe [Project])
-> Either String (Int -> BatchGetProjectsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [Project]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"projects" Either String (Maybe (Maybe [Project]))
-> Maybe [Project] -> Either String (Maybe [Project])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Project]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> BatchGetProjectsResponse)
-> Either String Int -> Either String BatchGetProjectsResponse
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 BatchGetProjects
instance Prelude.NFData BatchGetProjects
instance Core.ToHeaders BatchGetProjects where
toHeaders :: BatchGetProjects -> ResponseHeaders
toHeaders =
ResponseHeaders -> BatchGetProjects -> 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.BatchGetProjects" ::
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 BatchGetProjects where
toJSON :: BatchGetProjects -> Value
toJSON BatchGetProjects' {NonEmpty Text
names :: NonEmpty Text
$sel:names:BatchGetProjects' :: BatchGetProjects -> 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
"names" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
names)]
)
instance Core.ToPath BatchGetProjects where
toPath :: BatchGetProjects -> ByteString
toPath = ByteString -> BatchGetProjects -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery BatchGetProjects where
toQuery :: BatchGetProjects -> QueryString
toQuery = QueryString -> BatchGetProjects -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data BatchGetProjectsResponse = BatchGetProjectsResponse'
{
BatchGetProjectsResponse -> Maybe (NonEmpty Text)
projectsNotFound :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
BatchGetProjectsResponse -> Maybe [Project]
projects :: Prelude.Maybe [Project],
BatchGetProjectsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (BatchGetProjectsResponse -> BatchGetProjectsResponse -> Bool
(BatchGetProjectsResponse -> BatchGetProjectsResponse -> Bool)
-> (BatchGetProjectsResponse -> BatchGetProjectsResponse -> Bool)
-> Eq BatchGetProjectsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetProjectsResponse -> BatchGetProjectsResponse -> Bool
$c/= :: BatchGetProjectsResponse -> BatchGetProjectsResponse -> Bool
== :: BatchGetProjectsResponse -> BatchGetProjectsResponse -> Bool
$c== :: BatchGetProjectsResponse -> BatchGetProjectsResponse -> Bool
Prelude.Eq, ReadPrec [BatchGetProjectsResponse]
ReadPrec BatchGetProjectsResponse
Int -> ReadS BatchGetProjectsResponse
ReadS [BatchGetProjectsResponse]
(Int -> ReadS BatchGetProjectsResponse)
-> ReadS [BatchGetProjectsResponse]
-> ReadPrec BatchGetProjectsResponse
-> ReadPrec [BatchGetProjectsResponse]
-> Read BatchGetProjectsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGetProjectsResponse]
$creadListPrec :: ReadPrec [BatchGetProjectsResponse]
readPrec :: ReadPrec BatchGetProjectsResponse
$creadPrec :: ReadPrec BatchGetProjectsResponse
readList :: ReadS [BatchGetProjectsResponse]
$creadList :: ReadS [BatchGetProjectsResponse]
readsPrec :: Int -> ReadS BatchGetProjectsResponse
$creadsPrec :: Int -> ReadS BatchGetProjectsResponse
Prelude.Read, Int -> BatchGetProjectsResponse -> ShowS
[BatchGetProjectsResponse] -> ShowS
BatchGetProjectsResponse -> String
(Int -> BatchGetProjectsResponse -> ShowS)
-> (BatchGetProjectsResponse -> String)
-> ([BatchGetProjectsResponse] -> ShowS)
-> Show BatchGetProjectsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetProjectsResponse] -> ShowS
$cshowList :: [BatchGetProjectsResponse] -> ShowS
show :: BatchGetProjectsResponse -> String
$cshow :: BatchGetProjectsResponse -> String
showsPrec :: Int -> BatchGetProjectsResponse -> ShowS
$cshowsPrec :: Int -> BatchGetProjectsResponse -> ShowS
Prelude.Show, (forall x.
BatchGetProjectsResponse -> Rep BatchGetProjectsResponse x)
-> (forall x.
Rep BatchGetProjectsResponse x -> BatchGetProjectsResponse)
-> Generic BatchGetProjectsResponse
forall x.
Rep BatchGetProjectsResponse x -> BatchGetProjectsResponse
forall x.
BatchGetProjectsResponse -> Rep BatchGetProjectsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchGetProjectsResponse x -> BatchGetProjectsResponse
$cfrom :: forall x.
BatchGetProjectsResponse -> Rep BatchGetProjectsResponse x
Prelude.Generic)
newBatchGetProjectsResponse ::
Prelude.Int ->
BatchGetProjectsResponse
newBatchGetProjectsResponse :: Int -> BatchGetProjectsResponse
newBatchGetProjectsResponse Int
pHttpStatus_ =
BatchGetProjectsResponse' :: Maybe (NonEmpty Text)
-> Maybe [Project] -> Int -> BatchGetProjectsResponse
BatchGetProjectsResponse'
{ $sel:projectsNotFound:BatchGetProjectsResponse' :: Maybe (NonEmpty Text)
projectsNotFound =
Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
$sel:projects:BatchGetProjectsResponse' :: Maybe [Project]
projects = Maybe [Project]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchGetProjectsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchGetProjectsResponse_projectsNotFound :: Lens.Lens' BatchGetProjectsResponse (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
batchGetProjectsResponse_projectsNotFound :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> BatchGetProjectsResponse -> f BatchGetProjectsResponse
batchGetProjectsResponse_projectsNotFound = (BatchGetProjectsResponse -> Maybe (NonEmpty Text))
-> (BatchGetProjectsResponse
-> Maybe (NonEmpty Text) -> BatchGetProjectsResponse)
-> Lens
BatchGetProjectsResponse
BatchGetProjectsResponse
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetProjectsResponse' {Maybe (NonEmpty Text)
projectsNotFound :: Maybe (NonEmpty Text)
$sel:projectsNotFound:BatchGetProjectsResponse' :: BatchGetProjectsResponse -> Maybe (NonEmpty Text)
projectsNotFound} -> Maybe (NonEmpty Text)
projectsNotFound) (\s :: BatchGetProjectsResponse
s@BatchGetProjectsResponse' {} Maybe (NonEmpty Text)
a -> BatchGetProjectsResponse
s {$sel:projectsNotFound:BatchGetProjectsResponse' :: Maybe (NonEmpty Text)
projectsNotFound = Maybe (NonEmpty Text)
a} :: BatchGetProjectsResponse) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> BatchGetProjectsResponse -> f BatchGetProjectsResponse)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> BatchGetProjectsResponse
-> f BatchGetProjectsResponse
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
batchGetProjectsResponse_projects :: Lens.Lens' BatchGetProjectsResponse (Prelude.Maybe [Project])
batchGetProjectsResponse_projects :: (Maybe [Project] -> f (Maybe [Project]))
-> BatchGetProjectsResponse -> f BatchGetProjectsResponse
batchGetProjectsResponse_projects = (BatchGetProjectsResponse -> Maybe [Project])
-> (BatchGetProjectsResponse
-> Maybe [Project] -> BatchGetProjectsResponse)
-> Lens
BatchGetProjectsResponse
BatchGetProjectsResponse
(Maybe [Project])
(Maybe [Project])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetProjectsResponse' {Maybe [Project]
projects :: Maybe [Project]
$sel:projects:BatchGetProjectsResponse' :: BatchGetProjectsResponse -> Maybe [Project]
projects} -> Maybe [Project]
projects) (\s :: BatchGetProjectsResponse
s@BatchGetProjectsResponse' {} Maybe [Project]
a -> BatchGetProjectsResponse
s {$sel:projects:BatchGetProjectsResponse' :: Maybe [Project]
projects = Maybe [Project]
a} :: BatchGetProjectsResponse) ((Maybe [Project] -> f (Maybe [Project]))
-> BatchGetProjectsResponse -> f BatchGetProjectsResponse)
-> ((Maybe [Project] -> f (Maybe [Project]))
-> Maybe [Project] -> f (Maybe [Project]))
-> (Maybe [Project] -> f (Maybe [Project]))
-> BatchGetProjectsResponse
-> f BatchGetProjectsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Project] [Project] [Project] [Project]
-> Iso
(Maybe [Project])
(Maybe [Project])
(Maybe [Project])
(Maybe [Project])
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 [Project] [Project] [Project] [Project]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchGetProjectsResponse_httpStatus :: Lens.Lens' BatchGetProjectsResponse Prelude.Int
batchGetProjectsResponse_httpStatus :: (Int -> f Int)
-> BatchGetProjectsResponse -> f BatchGetProjectsResponse
batchGetProjectsResponse_httpStatus = (BatchGetProjectsResponse -> Int)
-> (BatchGetProjectsResponse -> Int -> BatchGetProjectsResponse)
-> Lens BatchGetProjectsResponse BatchGetProjectsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetProjectsResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchGetProjectsResponse' :: BatchGetProjectsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchGetProjectsResponse
s@BatchGetProjectsResponse' {} Int
a -> BatchGetProjectsResponse
s {$sel:httpStatus:BatchGetProjectsResponse' :: Int
httpStatus = Int
a} :: BatchGetProjectsResponse)
instance Prelude.NFData BatchGetProjectsResponse