{-# 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.CodeCommit.BatchGetRepositories
(
BatchGetRepositories (..),
newBatchGetRepositories,
batchGetRepositories_repositoryNames,
BatchGetRepositoriesResponse (..),
newBatchGetRepositoriesResponse,
batchGetRepositoriesResponse_repositories,
batchGetRepositoriesResponse_repositoriesNotFound,
batchGetRepositoriesResponse_httpStatus,
)
where
import Amazonka.CodeCommit.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 BatchGetRepositories = BatchGetRepositories'
{
BatchGetRepositories -> [Text]
repositoryNames :: [Prelude.Text]
}
deriving (BatchGetRepositories -> BatchGetRepositories -> Bool
(BatchGetRepositories -> BatchGetRepositories -> Bool)
-> (BatchGetRepositories -> BatchGetRepositories -> Bool)
-> Eq BatchGetRepositories
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetRepositories -> BatchGetRepositories -> Bool
$c/= :: BatchGetRepositories -> BatchGetRepositories -> Bool
== :: BatchGetRepositories -> BatchGetRepositories -> Bool
$c== :: BatchGetRepositories -> BatchGetRepositories -> Bool
Prelude.Eq, ReadPrec [BatchGetRepositories]
ReadPrec BatchGetRepositories
Int -> ReadS BatchGetRepositories
ReadS [BatchGetRepositories]
(Int -> ReadS BatchGetRepositories)
-> ReadS [BatchGetRepositories]
-> ReadPrec BatchGetRepositories
-> ReadPrec [BatchGetRepositories]
-> Read BatchGetRepositories
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGetRepositories]
$creadListPrec :: ReadPrec [BatchGetRepositories]
readPrec :: ReadPrec BatchGetRepositories
$creadPrec :: ReadPrec BatchGetRepositories
readList :: ReadS [BatchGetRepositories]
$creadList :: ReadS [BatchGetRepositories]
readsPrec :: Int -> ReadS BatchGetRepositories
$creadsPrec :: Int -> ReadS BatchGetRepositories
Prelude.Read, Int -> BatchGetRepositories -> ShowS
[BatchGetRepositories] -> ShowS
BatchGetRepositories -> String
(Int -> BatchGetRepositories -> ShowS)
-> (BatchGetRepositories -> String)
-> ([BatchGetRepositories] -> ShowS)
-> Show BatchGetRepositories
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetRepositories] -> ShowS
$cshowList :: [BatchGetRepositories] -> ShowS
show :: BatchGetRepositories -> String
$cshow :: BatchGetRepositories -> String
showsPrec :: Int -> BatchGetRepositories -> ShowS
$cshowsPrec :: Int -> BatchGetRepositories -> ShowS
Prelude.Show, (forall x. BatchGetRepositories -> Rep BatchGetRepositories x)
-> (forall x. Rep BatchGetRepositories x -> BatchGetRepositories)
-> Generic BatchGetRepositories
forall x. Rep BatchGetRepositories x -> BatchGetRepositories
forall x. BatchGetRepositories -> Rep BatchGetRepositories x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchGetRepositories x -> BatchGetRepositories
$cfrom :: forall x. BatchGetRepositories -> Rep BatchGetRepositories x
Prelude.Generic)
newBatchGetRepositories ::
BatchGetRepositories
newBatchGetRepositories :: BatchGetRepositories
newBatchGetRepositories =
BatchGetRepositories' :: [Text] -> BatchGetRepositories
BatchGetRepositories'
{ $sel:repositoryNames:BatchGetRepositories' :: [Text]
repositoryNames =
[Text]
forall a. Monoid a => a
Prelude.mempty
}
batchGetRepositories_repositoryNames :: Lens.Lens' BatchGetRepositories [Prelude.Text]
batchGetRepositories_repositoryNames :: ([Text] -> f [Text])
-> BatchGetRepositories -> f BatchGetRepositories
batchGetRepositories_repositoryNames = (BatchGetRepositories -> [Text])
-> (BatchGetRepositories -> [Text] -> BatchGetRepositories)
-> Lens BatchGetRepositories BatchGetRepositories [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetRepositories' {[Text]
repositoryNames :: [Text]
$sel:repositoryNames:BatchGetRepositories' :: BatchGetRepositories -> [Text]
repositoryNames} -> [Text]
repositoryNames) (\s :: BatchGetRepositories
s@BatchGetRepositories' {} [Text]
a -> BatchGetRepositories
s {$sel:repositoryNames:BatchGetRepositories' :: [Text]
repositoryNames = [Text]
a} :: BatchGetRepositories) (([Text] -> f [Text])
-> BatchGetRepositories -> f BatchGetRepositories)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> BatchGetRepositories
-> f BatchGetRepositories
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest BatchGetRepositories where
type
AWSResponse BatchGetRepositories =
BatchGetRepositoriesResponse
request :: BatchGetRepositories -> Request BatchGetRepositories
request = Service -> BatchGetRepositories -> Request BatchGetRepositories
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy BatchGetRepositories
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchGetRepositories)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse BatchGetRepositories))
-> Logger
-> Service
-> Proxy BatchGetRepositories
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchGetRepositories)))
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 [RepositoryMetadata]
-> Maybe [Text] -> Int -> BatchGetRepositoriesResponse
BatchGetRepositoriesResponse'
(Maybe [RepositoryMetadata]
-> Maybe [Text] -> Int -> BatchGetRepositoriesResponse)
-> Either String (Maybe [RepositoryMetadata])
-> Either
String (Maybe [Text] -> Int -> BatchGetRepositoriesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Either String (Maybe (Maybe [RepositoryMetadata]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"repositories" Either String (Maybe (Maybe [RepositoryMetadata]))
-> Maybe [RepositoryMetadata]
-> Either String (Maybe [RepositoryMetadata])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [RepositoryMetadata]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe [Text] -> Int -> BatchGetRepositoriesResponse)
-> Either String (Maybe [Text])
-> Either String (Int -> BatchGetRepositoriesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"repositoriesNotFound"
Either String (Maybe (Maybe [Text]))
-> Maybe [Text] -> Either String (Maybe [Text])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
)
Either String (Int -> BatchGetRepositoriesResponse)
-> Either String Int -> Either String BatchGetRepositoriesResponse
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 BatchGetRepositories
instance Prelude.NFData BatchGetRepositories
instance Core.ToHeaders BatchGetRepositories where
toHeaders :: BatchGetRepositories -> ResponseHeaders
toHeaders =
ResponseHeaders -> BatchGetRepositories -> 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
"CodeCommit_20150413.BatchGetRepositories" ::
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 BatchGetRepositories where
toJSON :: BatchGetRepositories -> Value
toJSON BatchGetRepositories' {[Text]
repositoryNames :: [Text]
$sel:repositoryNames:BatchGetRepositories' :: BatchGetRepositories -> [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
"repositoryNames" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
repositoryNames)
]
)
instance Core.ToPath BatchGetRepositories where
toPath :: BatchGetRepositories -> ByteString
toPath = ByteString -> BatchGetRepositories -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery BatchGetRepositories where
toQuery :: BatchGetRepositories -> QueryString
toQuery = QueryString -> BatchGetRepositories -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data BatchGetRepositoriesResponse = BatchGetRepositoriesResponse'
{
BatchGetRepositoriesResponse -> Maybe [RepositoryMetadata]
repositories :: Prelude.Maybe [RepositoryMetadata],
BatchGetRepositoriesResponse -> Maybe [Text]
repositoriesNotFound :: Prelude.Maybe [Prelude.Text],
BatchGetRepositoriesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (BatchGetRepositoriesResponse
-> BatchGetRepositoriesResponse -> Bool
(BatchGetRepositoriesResponse
-> BatchGetRepositoriesResponse -> Bool)
-> (BatchGetRepositoriesResponse
-> BatchGetRepositoriesResponse -> Bool)
-> Eq BatchGetRepositoriesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetRepositoriesResponse
-> BatchGetRepositoriesResponse -> Bool
$c/= :: BatchGetRepositoriesResponse
-> BatchGetRepositoriesResponse -> Bool
== :: BatchGetRepositoriesResponse
-> BatchGetRepositoriesResponse -> Bool
$c== :: BatchGetRepositoriesResponse
-> BatchGetRepositoriesResponse -> Bool
Prelude.Eq, ReadPrec [BatchGetRepositoriesResponse]
ReadPrec BatchGetRepositoriesResponse
Int -> ReadS BatchGetRepositoriesResponse
ReadS [BatchGetRepositoriesResponse]
(Int -> ReadS BatchGetRepositoriesResponse)
-> ReadS [BatchGetRepositoriesResponse]
-> ReadPrec BatchGetRepositoriesResponse
-> ReadPrec [BatchGetRepositoriesResponse]
-> Read BatchGetRepositoriesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGetRepositoriesResponse]
$creadListPrec :: ReadPrec [BatchGetRepositoriesResponse]
readPrec :: ReadPrec BatchGetRepositoriesResponse
$creadPrec :: ReadPrec BatchGetRepositoriesResponse
readList :: ReadS [BatchGetRepositoriesResponse]
$creadList :: ReadS [BatchGetRepositoriesResponse]
readsPrec :: Int -> ReadS BatchGetRepositoriesResponse
$creadsPrec :: Int -> ReadS BatchGetRepositoriesResponse
Prelude.Read, Int -> BatchGetRepositoriesResponse -> ShowS
[BatchGetRepositoriesResponse] -> ShowS
BatchGetRepositoriesResponse -> String
(Int -> BatchGetRepositoriesResponse -> ShowS)
-> (BatchGetRepositoriesResponse -> String)
-> ([BatchGetRepositoriesResponse] -> ShowS)
-> Show BatchGetRepositoriesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetRepositoriesResponse] -> ShowS
$cshowList :: [BatchGetRepositoriesResponse] -> ShowS
show :: BatchGetRepositoriesResponse -> String
$cshow :: BatchGetRepositoriesResponse -> String
showsPrec :: Int -> BatchGetRepositoriesResponse -> ShowS
$cshowsPrec :: Int -> BatchGetRepositoriesResponse -> ShowS
Prelude.Show, (forall x.
BatchGetRepositoriesResponse -> Rep BatchGetRepositoriesResponse x)
-> (forall x.
Rep BatchGetRepositoriesResponse x -> BatchGetRepositoriesResponse)
-> Generic BatchGetRepositoriesResponse
forall x.
Rep BatchGetRepositoriesResponse x -> BatchGetRepositoriesResponse
forall x.
BatchGetRepositoriesResponse -> Rep BatchGetRepositoriesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchGetRepositoriesResponse x -> BatchGetRepositoriesResponse
$cfrom :: forall x.
BatchGetRepositoriesResponse -> Rep BatchGetRepositoriesResponse x
Prelude.Generic)
newBatchGetRepositoriesResponse ::
Prelude.Int ->
BatchGetRepositoriesResponse
newBatchGetRepositoriesResponse :: Int -> BatchGetRepositoriesResponse
newBatchGetRepositoriesResponse Int
pHttpStatus_ =
BatchGetRepositoriesResponse' :: Maybe [RepositoryMetadata]
-> Maybe [Text] -> Int -> BatchGetRepositoriesResponse
BatchGetRepositoriesResponse'
{ $sel:repositories:BatchGetRepositoriesResponse' :: Maybe [RepositoryMetadata]
repositories =
Maybe [RepositoryMetadata]
forall a. Maybe a
Prelude.Nothing,
$sel:repositoriesNotFound:BatchGetRepositoriesResponse' :: Maybe [Text]
repositoriesNotFound = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchGetRepositoriesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchGetRepositoriesResponse_repositories :: Lens.Lens' BatchGetRepositoriesResponse (Prelude.Maybe [RepositoryMetadata])
batchGetRepositoriesResponse_repositories :: (Maybe [RepositoryMetadata] -> f (Maybe [RepositoryMetadata]))
-> BatchGetRepositoriesResponse -> f BatchGetRepositoriesResponse
batchGetRepositoriesResponse_repositories = (BatchGetRepositoriesResponse -> Maybe [RepositoryMetadata])
-> (BatchGetRepositoriesResponse
-> Maybe [RepositoryMetadata] -> BatchGetRepositoriesResponse)
-> Lens
BatchGetRepositoriesResponse
BatchGetRepositoriesResponse
(Maybe [RepositoryMetadata])
(Maybe [RepositoryMetadata])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetRepositoriesResponse' {Maybe [RepositoryMetadata]
repositories :: Maybe [RepositoryMetadata]
$sel:repositories:BatchGetRepositoriesResponse' :: BatchGetRepositoriesResponse -> Maybe [RepositoryMetadata]
repositories} -> Maybe [RepositoryMetadata]
repositories) (\s :: BatchGetRepositoriesResponse
s@BatchGetRepositoriesResponse' {} Maybe [RepositoryMetadata]
a -> BatchGetRepositoriesResponse
s {$sel:repositories:BatchGetRepositoriesResponse' :: Maybe [RepositoryMetadata]
repositories = Maybe [RepositoryMetadata]
a} :: BatchGetRepositoriesResponse) ((Maybe [RepositoryMetadata] -> f (Maybe [RepositoryMetadata]))
-> BatchGetRepositoriesResponse -> f BatchGetRepositoriesResponse)
-> ((Maybe [RepositoryMetadata] -> f (Maybe [RepositoryMetadata]))
-> Maybe [RepositoryMetadata] -> f (Maybe [RepositoryMetadata]))
-> (Maybe [RepositoryMetadata] -> f (Maybe [RepositoryMetadata]))
-> BatchGetRepositoriesResponse
-> f BatchGetRepositoriesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[RepositoryMetadata]
[RepositoryMetadata]
[RepositoryMetadata]
[RepositoryMetadata]
-> Iso
(Maybe [RepositoryMetadata])
(Maybe [RepositoryMetadata])
(Maybe [RepositoryMetadata])
(Maybe [RepositoryMetadata])
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
[RepositoryMetadata]
[RepositoryMetadata]
[RepositoryMetadata]
[RepositoryMetadata]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchGetRepositoriesResponse_repositoriesNotFound :: Lens.Lens' BatchGetRepositoriesResponse (Prelude.Maybe [Prelude.Text])
batchGetRepositoriesResponse_repositoriesNotFound :: (Maybe [Text] -> f (Maybe [Text]))
-> BatchGetRepositoriesResponse -> f BatchGetRepositoriesResponse
batchGetRepositoriesResponse_repositoriesNotFound = (BatchGetRepositoriesResponse -> Maybe [Text])
-> (BatchGetRepositoriesResponse
-> Maybe [Text] -> BatchGetRepositoriesResponse)
-> Lens
BatchGetRepositoriesResponse
BatchGetRepositoriesResponse
(Maybe [Text])
(Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetRepositoriesResponse' {Maybe [Text]
repositoriesNotFound :: Maybe [Text]
$sel:repositoriesNotFound:BatchGetRepositoriesResponse' :: BatchGetRepositoriesResponse -> Maybe [Text]
repositoriesNotFound} -> Maybe [Text]
repositoriesNotFound) (\s :: BatchGetRepositoriesResponse
s@BatchGetRepositoriesResponse' {} Maybe [Text]
a -> BatchGetRepositoriesResponse
s {$sel:repositoriesNotFound:BatchGetRepositoriesResponse' :: Maybe [Text]
repositoriesNotFound = Maybe [Text]
a} :: BatchGetRepositoriesResponse) ((Maybe [Text] -> f (Maybe [Text]))
-> BatchGetRepositoriesResponse -> f BatchGetRepositoriesResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> BatchGetRepositoriesResponse
-> f BatchGetRepositoriesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchGetRepositoriesResponse_httpStatus :: Lens.Lens' BatchGetRepositoriesResponse Prelude.Int
batchGetRepositoriesResponse_httpStatus :: (Int -> f Int)
-> BatchGetRepositoriesResponse -> f BatchGetRepositoriesResponse
batchGetRepositoriesResponse_httpStatus = (BatchGetRepositoriesResponse -> Int)
-> (BatchGetRepositoriesResponse
-> Int -> BatchGetRepositoriesResponse)
-> Lens
BatchGetRepositoriesResponse BatchGetRepositoriesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetRepositoriesResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchGetRepositoriesResponse' :: BatchGetRepositoriesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchGetRepositoriesResponse
s@BatchGetRepositoriesResponse' {} Int
a -> BatchGetRepositoriesResponse
s {$sel:httpStatus:BatchGetRepositoriesResponse' :: Int
httpStatus = Int
a} :: BatchGetRepositoriesResponse)
instance Prelude.NFData BatchGetRepositoriesResponse