{-# 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.ECRPublic.CreateRepository
(
CreateRepository (..),
newCreateRepository,
createRepository_catalogData,
createRepository_tags,
createRepository_repositoryName,
CreateRepositoryResponse (..),
newCreateRepositoryResponse,
createRepositoryResponse_repository,
createRepositoryResponse_catalogData,
createRepositoryResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.ECRPublic.Types
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 CreateRepository = CreateRepository'
{
CreateRepository -> Maybe RepositoryCatalogDataInput
catalogData :: Prelude.Maybe RepositoryCatalogDataInput,
CreateRepository -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateRepository -> Text
repositoryName :: Prelude.Text
}
deriving (CreateRepository -> CreateRepository -> Bool
(CreateRepository -> CreateRepository -> Bool)
-> (CreateRepository -> CreateRepository -> Bool)
-> Eq CreateRepository
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateRepository -> CreateRepository -> Bool
$c/= :: CreateRepository -> CreateRepository -> Bool
== :: CreateRepository -> CreateRepository -> Bool
$c== :: CreateRepository -> CreateRepository -> Bool
Prelude.Eq, ReadPrec [CreateRepository]
ReadPrec CreateRepository
Int -> ReadS CreateRepository
ReadS [CreateRepository]
(Int -> ReadS CreateRepository)
-> ReadS [CreateRepository]
-> ReadPrec CreateRepository
-> ReadPrec [CreateRepository]
-> Read CreateRepository
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateRepository]
$creadListPrec :: ReadPrec [CreateRepository]
readPrec :: ReadPrec CreateRepository
$creadPrec :: ReadPrec CreateRepository
readList :: ReadS [CreateRepository]
$creadList :: ReadS [CreateRepository]
readsPrec :: Int -> ReadS CreateRepository
$creadsPrec :: Int -> ReadS CreateRepository
Prelude.Read, Int -> CreateRepository -> ShowS
[CreateRepository] -> ShowS
CreateRepository -> String
(Int -> CreateRepository -> ShowS)
-> (CreateRepository -> String)
-> ([CreateRepository] -> ShowS)
-> Show CreateRepository
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateRepository] -> ShowS
$cshowList :: [CreateRepository] -> ShowS
show :: CreateRepository -> String
$cshow :: CreateRepository -> String
showsPrec :: Int -> CreateRepository -> ShowS
$cshowsPrec :: Int -> CreateRepository -> ShowS
Prelude.Show, (forall x. CreateRepository -> Rep CreateRepository x)
-> (forall x. Rep CreateRepository x -> CreateRepository)
-> Generic CreateRepository
forall x. Rep CreateRepository x -> CreateRepository
forall x. CreateRepository -> Rep CreateRepository x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateRepository x -> CreateRepository
$cfrom :: forall x. CreateRepository -> Rep CreateRepository x
Prelude.Generic)
newCreateRepository ::
Prelude.Text ->
CreateRepository
newCreateRepository :: Text -> CreateRepository
newCreateRepository Text
pRepositoryName_ =
CreateRepository' :: Maybe RepositoryCatalogDataInput
-> Maybe [Tag] -> Text -> CreateRepository
CreateRepository'
{ $sel:catalogData:CreateRepository' :: Maybe RepositoryCatalogDataInput
catalogData = Maybe RepositoryCatalogDataInput
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateRepository' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:repositoryName:CreateRepository' :: Text
repositoryName = Text
pRepositoryName_
}
createRepository_catalogData :: Lens.Lens' CreateRepository (Prelude.Maybe RepositoryCatalogDataInput)
createRepository_catalogData :: (Maybe RepositoryCatalogDataInput
-> f (Maybe RepositoryCatalogDataInput))
-> CreateRepository -> f CreateRepository
createRepository_catalogData = (CreateRepository -> Maybe RepositoryCatalogDataInput)
-> (CreateRepository
-> Maybe RepositoryCatalogDataInput -> CreateRepository)
-> Lens
CreateRepository
CreateRepository
(Maybe RepositoryCatalogDataInput)
(Maybe RepositoryCatalogDataInput)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRepository' {Maybe RepositoryCatalogDataInput
catalogData :: Maybe RepositoryCatalogDataInput
$sel:catalogData:CreateRepository' :: CreateRepository -> Maybe RepositoryCatalogDataInput
catalogData} -> Maybe RepositoryCatalogDataInput
catalogData) (\s :: CreateRepository
s@CreateRepository' {} Maybe RepositoryCatalogDataInput
a -> CreateRepository
s {$sel:catalogData:CreateRepository' :: Maybe RepositoryCatalogDataInput
catalogData = Maybe RepositoryCatalogDataInput
a} :: CreateRepository)
createRepository_tags :: Lens.Lens' CreateRepository (Prelude.Maybe [Tag])
createRepository_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateRepository -> f CreateRepository
createRepository_tags = (CreateRepository -> Maybe [Tag])
-> (CreateRepository -> Maybe [Tag] -> CreateRepository)
-> Lens
CreateRepository CreateRepository (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRepository' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateRepository' :: CreateRepository -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateRepository
s@CreateRepository' {} Maybe [Tag]
a -> CreateRepository
s {$sel:tags:CreateRepository' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateRepository) ((Maybe [Tag] -> f (Maybe [Tag]))
-> CreateRepository -> f CreateRepository)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateRepository
-> f CreateRepository
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createRepository_repositoryName :: Lens.Lens' CreateRepository Prelude.Text
createRepository_repositoryName :: (Text -> f Text) -> CreateRepository -> f CreateRepository
createRepository_repositoryName = (CreateRepository -> Text)
-> (CreateRepository -> Text -> CreateRepository)
-> Lens CreateRepository CreateRepository Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRepository' {Text
repositoryName :: Text
$sel:repositoryName:CreateRepository' :: CreateRepository -> Text
repositoryName} -> Text
repositoryName) (\s :: CreateRepository
s@CreateRepository' {} Text
a -> CreateRepository
s {$sel:repositoryName:CreateRepository' :: Text
repositoryName = Text
a} :: CreateRepository)
instance Core.AWSRequest CreateRepository where
type
AWSResponse CreateRepository =
CreateRepositoryResponse
request :: CreateRepository -> Request CreateRepository
request = Service -> CreateRepository -> Request CreateRepository
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateRepository
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateRepository)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateRepository))
-> Logger
-> Service
-> Proxy CreateRepository
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateRepository)))
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 Repository
-> Maybe RepositoryCatalogData -> Int -> CreateRepositoryResponse
CreateRepositoryResponse'
(Maybe Repository
-> Maybe RepositoryCatalogData -> Int -> CreateRepositoryResponse)
-> Either String (Maybe Repository)
-> Either
String
(Maybe RepositoryCatalogData -> Int -> CreateRepositoryResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Repository)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"repository")
Either
String
(Maybe RepositoryCatalogData -> Int -> CreateRepositoryResponse)
-> Either String (Maybe RepositoryCatalogData)
-> Either String (Int -> CreateRepositoryResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe RepositoryCatalogData)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"catalogData")
Either String (Int -> CreateRepositoryResponse)
-> Either String Int -> Either String CreateRepositoryResponse
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 CreateRepository
instance Prelude.NFData CreateRepository
instance Core.ToHeaders CreateRepository where
toHeaders :: CreateRepository -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateRepository -> 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
"SpencerFrontendService.CreateRepository" ::
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 CreateRepository where
toJSON :: CreateRepository -> Value
toJSON CreateRepository' {Maybe [Tag]
Maybe RepositoryCatalogDataInput
Text
repositoryName :: Text
tags :: Maybe [Tag]
catalogData :: Maybe RepositoryCatalogDataInput
$sel:repositoryName:CreateRepository' :: CreateRepository -> Text
$sel:tags:CreateRepository' :: CreateRepository -> Maybe [Tag]
$sel:catalogData:CreateRepository' :: CreateRepository -> Maybe RepositoryCatalogDataInput
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"catalogData" Text -> RepositoryCatalogDataInput -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (RepositoryCatalogDataInput -> Pair)
-> Maybe RepositoryCatalogDataInput -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RepositoryCatalogDataInput
catalogData,
(Text
"tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"repositoryName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
repositoryName)
]
)
instance Core.ToPath CreateRepository where
toPath :: CreateRepository -> ByteString
toPath = ByteString -> CreateRepository -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateRepository where
toQuery :: CreateRepository -> QueryString
toQuery = QueryString -> CreateRepository -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateRepositoryResponse = CreateRepositoryResponse'
{
CreateRepositoryResponse -> Maybe Repository
repository :: Prelude.Maybe Repository,
CreateRepositoryResponse -> Maybe RepositoryCatalogData
catalogData :: Prelude.Maybe RepositoryCatalogData,
CreateRepositoryResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateRepositoryResponse -> CreateRepositoryResponse -> Bool
(CreateRepositoryResponse -> CreateRepositoryResponse -> Bool)
-> (CreateRepositoryResponse -> CreateRepositoryResponse -> Bool)
-> Eq CreateRepositoryResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateRepositoryResponse -> CreateRepositoryResponse -> Bool
$c/= :: CreateRepositoryResponse -> CreateRepositoryResponse -> Bool
== :: CreateRepositoryResponse -> CreateRepositoryResponse -> Bool
$c== :: CreateRepositoryResponse -> CreateRepositoryResponse -> Bool
Prelude.Eq, ReadPrec [CreateRepositoryResponse]
ReadPrec CreateRepositoryResponse
Int -> ReadS CreateRepositoryResponse
ReadS [CreateRepositoryResponse]
(Int -> ReadS CreateRepositoryResponse)
-> ReadS [CreateRepositoryResponse]
-> ReadPrec CreateRepositoryResponse
-> ReadPrec [CreateRepositoryResponse]
-> Read CreateRepositoryResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateRepositoryResponse]
$creadListPrec :: ReadPrec [CreateRepositoryResponse]
readPrec :: ReadPrec CreateRepositoryResponse
$creadPrec :: ReadPrec CreateRepositoryResponse
readList :: ReadS [CreateRepositoryResponse]
$creadList :: ReadS [CreateRepositoryResponse]
readsPrec :: Int -> ReadS CreateRepositoryResponse
$creadsPrec :: Int -> ReadS CreateRepositoryResponse
Prelude.Read, Int -> CreateRepositoryResponse -> ShowS
[CreateRepositoryResponse] -> ShowS
CreateRepositoryResponse -> String
(Int -> CreateRepositoryResponse -> ShowS)
-> (CreateRepositoryResponse -> String)
-> ([CreateRepositoryResponse] -> ShowS)
-> Show CreateRepositoryResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateRepositoryResponse] -> ShowS
$cshowList :: [CreateRepositoryResponse] -> ShowS
show :: CreateRepositoryResponse -> String
$cshow :: CreateRepositoryResponse -> String
showsPrec :: Int -> CreateRepositoryResponse -> ShowS
$cshowsPrec :: Int -> CreateRepositoryResponse -> ShowS
Prelude.Show, (forall x.
CreateRepositoryResponse -> Rep CreateRepositoryResponse x)
-> (forall x.
Rep CreateRepositoryResponse x -> CreateRepositoryResponse)
-> Generic CreateRepositoryResponse
forall x.
Rep CreateRepositoryResponse x -> CreateRepositoryResponse
forall x.
CreateRepositoryResponse -> Rep CreateRepositoryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateRepositoryResponse x -> CreateRepositoryResponse
$cfrom :: forall x.
CreateRepositoryResponse -> Rep CreateRepositoryResponse x
Prelude.Generic)
newCreateRepositoryResponse ::
Prelude.Int ->
CreateRepositoryResponse
newCreateRepositoryResponse :: Int -> CreateRepositoryResponse
newCreateRepositoryResponse Int
pHttpStatus_ =
CreateRepositoryResponse' :: Maybe Repository
-> Maybe RepositoryCatalogData -> Int -> CreateRepositoryResponse
CreateRepositoryResponse'
{ $sel:repository:CreateRepositoryResponse' :: Maybe Repository
repository =
Maybe Repository
forall a. Maybe a
Prelude.Nothing,
$sel:catalogData:CreateRepositoryResponse' :: Maybe RepositoryCatalogData
catalogData = Maybe RepositoryCatalogData
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateRepositoryResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createRepositoryResponse_repository :: Lens.Lens' CreateRepositoryResponse (Prelude.Maybe Repository)
createRepositoryResponse_repository :: (Maybe Repository -> f (Maybe Repository))
-> CreateRepositoryResponse -> f CreateRepositoryResponse
createRepositoryResponse_repository = (CreateRepositoryResponse -> Maybe Repository)
-> (CreateRepositoryResponse
-> Maybe Repository -> CreateRepositoryResponse)
-> Lens
CreateRepositoryResponse
CreateRepositoryResponse
(Maybe Repository)
(Maybe Repository)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRepositoryResponse' {Maybe Repository
repository :: Maybe Repository
$sel:repository:CreateRepositoryResponse' :: CreateRepositoryResponse -> Maybe Repository
repository} -> Maybe Repository
repository) (\s :: CreateRepositoryResponse
s@CreateRepositoryResponse' {} Maybe Repository
a -> CreateRepositoryResponse
s {$sel:repository:CreateRepositoryResponse' :: Maybe Repository
repository = Maybe Repository
a} :: CreateRepositoryResponse)
createRepositoryResponse_catalogData :: Lens.Lens' CreateRepositoryResponse (Prelude.Maybe RepositoryCatalogData)
createRepositoryResponse_catalogData :: (Maybe RepositoryCatalogData -> f (Maybe RepositoryCatalogData))
-> CreateRepositoryResponse -> f CreateRepositoryResponse
createRepositoryResponse_catalogData = (CreateRepositoryResponse -> Maybe RepositoryCatalogData)
-> (CreateRepositoryResponse
-> Maybe RepositoryCatalogData -> CreateRepositoryResponse)
-> Lens
CreateRepositoryResponse
CreateRepositoryResponse
(Maybe RepositoryCatalogData)
(Maybe RepositoryCatalogData)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRepositoryResponse' {Maybe RepositoryCatalogData
catalogData :: Maybe RepositoryCatalogData
$sel:catalogData:CreateRepositoryResponse' :: CreateRepositoryResponse -> Maybe RepositoryCatalogData
catalogData} -> Maybe RepositoryCatalogData
catalogData) (\s :: CreateRepositoryResponse
s@CreateRepositoryResponse' {} Maybe RepositoryCatalogData
a -> CreateRepositoryResponse
s {$sel:catalogData:CreateRepositoryResponse' :: Maybe RepositoryCatalogData
catalogData = Maybe RepositoryCatalogData
a} :: CreateRepositoryResponse)
createRepositoryResponse_httpStatus :: Lens.Lens' CreateRepositoryResponse Prelude.Int
createRepositoryResponse_httpStatus :: (Int -> f Int)
-> CreateRepositoryResponse -> f CreateRepositoryResponse
createRepositoryResponse_httpStatus = (CreateRepositoryResponse -> Int)
-> (CreateRepositoryResponse -> Int -> CreateRepositoryResponse)
-> Lens CreateRepositoryResponse CreateRepositoryResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRepositoryResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateRepositoryResponse' :: CreateRepositoryResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateRepositoryResponse
s@CreateRepositoryResponse' {} Int
a -> CreateRepositoryResponse
s {$sel:httpStatus:CreateRepositoryResponse' :: Int
httpStatus = Int
a} :: CreateRepositoryResponse)
instance Prelude.NFData CreateRepositoryResponse