{-# 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_projects,
batchGetProjectsResponse_projectsNotFound,
batchGetProjectsResponse_httpStatus,
)
where
import Amazonka.CodeBuild.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:names:BatchGetProjects' :: NonEmpty Text
names =
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pNames_
}
batchGetProjects_names :: Lens.Lens' BatchGetProjects (Prelude.NonEmpty Prelude.Text)
batchGetProjects_names :: Lens' BatchGetProjects (NonEmpty Text)
batchGetProjects_names = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 :: (Service -> Service)
-> BatchGetProjects -> Request BatchGetProjects
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy BatchGetProjects
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse BatchGetProjects)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [Project]
-> Maybe (NonEmpty Text) -> Int -> BatchGetProjectsResponse
BatchGetProjectsResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"projects" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"projectsNotFound")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable BatchGetProjects where
hashWithSalt :: Int -> BatchGetProjects -> Int
hashWithSalt Int
_salt BatchGetProjects' {NonEmpty Text
names :: NonEmpty Text
$sel:names:BatchGetProjects' :: BatchGetProjects -> NonEmpty Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
names
instance Prelude.NFData BatchGetProjects where
rnf :: BatchGetProjects -> ()
rnf BatchGetProjects' {NonEmpty Text
names :: NonEmpty Text
$sel:names:BatchGetProjects' :: BatchGetProjects -> NonEmpty Text
..} = forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
names
instance Data.ToHeaders BatchGetProjects where
toHeaders :: BatchGetProjects -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"CodeBuild_20161006.BatchGetProjects" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON BatchGetProjects where
toJSON :: BatchGetProjects -> Value
toJSON BatchGetProjects' {NonEmpty Text
names :: NonEmpty Text
$sel:names:BatchGetProjects' :: BatchGetProjects -> NonEmpty Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"names" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
names)]
)
instance Data.ToPath BatchGetProjects where
toPath :: BatchGetProjects -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery BatchGetProjects where
toQuery :: BatchGetProjects -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data BatchGetProjectsResponse = BatchGetProjectsResponse'
{
BatchGetProjectsResponse -> Maybe [Project]
projects :: Prelude.Maybe [Project],
BatchGetProjectsResponse -> Maybe (NonEmpty Text)
projectsNotFound :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
BatchGetProjectsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (BatchGetProjectsResponse -> BatchGetProjectsResponse -> Bool
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]
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
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.
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'
{ $sel:projects:BatchGetProjectsResponse' :: Maybe [Project]
projects =
forall a. Maybe a
Prelude.Nothing,
$sel:projectsNotFound:BatchGetProjectsResponse' :: Maybe (NonEmpty Text)
projectsNotFound = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchGetProjectsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchGetProjectsResponse_projects :: Lens.Lens' BatchGetProjectsResponse (Prelude.Maybe [Project])
batchGetProjectsResponse_projects :: Lens' BatchGetProjectsResponse (Maybe [Project])
batchGetProjectsResponse_projects = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchGetProjectsResponse_projectsNotFound :: Lens.Lens' BatchGetProjectsResponse (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
batchGetProjectsResponse_projectsNotFound :: Lens' BatchGetProjectsResponse (Maybe (NonEmpty Text))
batchGetProjectsResponse_projectsNotFound = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' BatchGetProjectsResponse Int
batchGetProjectsResponse_httpStatus = 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 where
rnf :: BatchGetProjectsResponse -> ()
rnf BatchGetProjectsResponse' {Int
Maybe [Project]
Maybe (NonEmpty Text)
httpStatus :: Int
projectsNotFound :: Maybe (NonEmpty Text)
projects :: Maybe [Project]
$sel:httpStatus:BatchGetProjectsResponse' :: BatchGetProjectsResponse -> Int
$sel:projectsNotFound:BatchGetProjectsResponse' :: BatchGetProjectsResponse -> Maybe (NonEmpty Text)
$sel:projects:BatchGetProjectsResponse' :: BatchGetProjectsResponse -> Maybe [Project]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Project]
projects
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
projectsNotFound
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus