{-# 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.CodeArtifact.CreateRepository
(
CreateRepository (..),
newCreateRepository,
createRepository_description,
createRepository_domainOwner,
createRepository_tags,
createRepository_upstreams,
createRepository_domain,
createRepository_repository,
CreateRepositoryResponse (..),
newCreateRepositoryResponse,
createRepositoryResponse_repository,
createRepositoryResponse_httpStatus,
)
where
import Amazonka.CodeArtifact.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 CreateRepository = CreateRepository'
{
CreateRepository -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
CreateRepository -> Maybe Text
domainOwner :: Prelude.Maybe Prelude.Text,
CreateRepository -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateRepository -> Maybe [UpstreamRepository]
upstreams :: Prelude.Maybe [UpstreamRepository],
CreateRepository -> Text
domain :: Prelude.Text,
CreateRepository -> Text
repository :: Prelude.Text
}
deriving (CreateRepository -> CreateRepository -> Bool
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]
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
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. 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 ->
Prelude.Text ->
CreateRepository
newCreateRepository :: Text -> Text -> CreateRepository
newCreateRepository Text
pDomain_ Text
pRepository_ =
CreateRepository'
{ $sel:description:CreateRepository' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
$sel:domainOwner:CreateRepository' :: Maybe Text
domainOwner = forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateRepository' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
$sel:upstreams:CreateRepository' :: Maybe [UpstreamRepository]
upstreams = forall a. Maybe a
Prelude.Nothing,
$sel:domain:CreateRepository' :: Text
domain = Text
pDomain_,
$sel:repository:CreateRepository' :: Text
repository = Text
pRepository_
}
createRepository_description :: Lens.Lens' CreateRepository (Prelude.Maybe Prelude.Text)
createRepository_description :: Lens' CreateRepository (Maybe Text)
createRepository_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRepository' {Maybe Text
description :: Maybe Text
$sel:description:CreateRepository' :: CreateRepository -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateRepository
s@CreateRepository' {} Maybe Text
a -> CreateRepository
s {$sel:description:CreateRepository' :: Maybe Text
description = Maybe Text
a} :: CreateRepository)
createRepository_domainOwner :: Lens.Lens' CreateRepository (Prelude.Maybe Prelude.Text)
createRepository_domainOwner :: Lens' CreateRepository (Maybe Text)
createRepository_domainOwner = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRepository' {Maybe Text
domainOwner :: Maybe Text
$sel:domainOwner:CreateRepository' :: CreateRepository -> Maybe Text
domainOwner} -> Maybe Text
domainOwner) (\s :: CreateRepository
s@CreateRepository' {} Maybe Text
a -> CreateRepository
s {$sel:domainOwner:CreateRepository' :: Maybe Text
domainOwner = Maybe Text
a} :: CreateRepository)
createRepository_tags :: Lens.Lens' CreateRepository (Prelude.Maybe [Tag])
createRepository_tags :: Lens' CreateRepository (Maybe [Tag])
createRepository_tags = 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) 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
createRepository_upstreams :: Lens.Lens' CreateRepository (Prelude.Maybe [UpstreamRepository])
createRepository_upstreams :: Lens' CreateRepository (Maybe [UpstreamRepository])
createRepository_upstreams = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRepository' {Maybe [UpstreamRepository]
upstreams :: Maybe [UpstreamRepository]
$sel:upstreams:CreateRepository' :: CreateRepository -> Maybe [UpstreamRepository]
upstreams} -> Maybe [UpstreamRepository]
upstreams) (\s :: CreateRepository
s@CreateRepository' {} Maybe [UpstreamRepository]
a -> CreateRepository
s {$sel:upstreams:CreateRepository' :: Maybe [UpstreamRepository]
upstreams = Maybe [UpstreamRepository]
a} :: CreateRepository) 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
createRepository_domain :: Lens.Lens' CreateRepository Prelude.Text
createRepository_domain :: Lens' CreateRepository Text
createRepository_domain = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRepository' {Text
domain :: Text
$sel:domain:CreateRepository' :: CreateRepository -> Text
domain} -> Text
domain) (\s :: CreateRepository
s@CreateRepository' {} Text
a -> CreateRepository
s {$sel:domain:CreateRepository' :: Text
domain = Text
a} :: CreateRepository)
createRepository_repository :: Lens.Lens' CreateRepository Prelude.Text
createRepository_repository :: Lens' CreateRepository Text
createRepository_repository = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRepository' {Text
repository :: Text
$sel:repository:CreateRepository' :: CreateRepository -> Text
repository} -> Text
repository) (\s :: CreateRepository
s@CreateRepository' {} Text
a -> CreateRepository
s {$sel:repository:CreateRepository' :: Text
repository = Text
a} :: CreateRepository)
instance Core.AWSRequest CreateRepository where
type
AWSResponse CreateRepository =
CreateRepositoryResponse
request :: (Service -> Service)
-> CreateRepository -> Request CreateRepository
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 CreateRepository
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateRepository)))
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 RepositoryDescription -> Int -> CreateRepositoryResponse
CreateRepositoryResponse'
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
"repository")
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 CreateRepository where
hashWithSalt :: Int -> CreateRepository -> Int
hashWithSalt Int
_salt CreateRepository' {Maybe [Tag]
Maybe [UpstreamRepository]
Maybe Text
Text
repository :: Text
domain :: Text
upstreams :: Maybe [UpstreamRepository]
tags :: Maybe [Tag]
domainOwner :: Maybe Text
description :: Maybe Text
$sel:repository:CreateRepository' :: CreateRepository -> Text
$sel:domain:CreateRepository' :: CreateRepository -> Text
$sel:upstreams:CreateRepository' :: CreateRepository -> Maybe [UpstreamRepository]
$sel:tags:CreateRepository' :: CreateRepository -> Maybe [Tag]
$sel:domainOwner:CreateRepository' :: CreateRepository -> Maybe Text
$sel:description:CreateRepository' :: CreateRepository -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
domainOwner
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [UpstreamRepository]
upstreams
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
domain
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
repository
instance Prelude.NFData CreateRepository where
rnf :: CreateRepository -> ()
rnf CreateRepository' {Maybe [Tag]
Maybe [UpstreamRepository]
Maybe Text
Text
repository :: Text
domain :: Text
upstreams :: Maybe [UpstreamRepository]
tags :: Maybe [Tag]
domainOwner :: Maybe Text
description :: Maybe Text
$sel:repository:CreateRepository' :: CreateRepository -> Text
$sel:domain:CreateRepository' :: CreateRepository -> Text
$sel:upstreams:CreateRepository' :: CreateRepository -> Maybe [UpstreamRepository]
$sel:tags:CreateRepository' :: CreateRepository -> Maybe [Tag]
$sel:domainOwner:CreateRepository' :: CreateRepository -> Maybe Text
$sel:description:CreateRepository' :: CreateRepository -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
domainOwner
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [UpstreamRepository]
upstreams
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
domain
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
repository
instance Data.ToHeaders CreateRepository where
toHeaders :: CreateRepository -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON CreateRepository where
toJSON :: CreateRepository -> Value
toJSON CreateRepository' {Maybe [Tag]
Maybe [UpstreamRepository]
Maybe Text
Text
repository :: Text
domain :: Text
upstreams :: Maybe [UpstreamRepository]
tags :: Maybe [Tag]
domainOwner :: Maybe Text
description :: Maybe Text
$sel:repository:CreateRepository' :: CreateRepository -> Text
$sel:domain:CreateRepository' :: CreateRepository -> Text
$sel:upstreams:CreateRepository' :: CreateRepository -> Maybe [UpstreamRepository]
$sel:tags:CreateRepository' :: CreateRepository -> Maybe [Tag]
$sel:domainOwner:CreateRepository' :: CreateRepository -> Maybe Text
$sel:description:CreateRepository' :: CreateRepository -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"description" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
(Key
"tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
(Key
"upstreams" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [UpstreamRepository]
upstreams
]
)
instance Data.ToPath CreateRepository where
toPath :: CreateRepository -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/v1/repository"
instance Data.ToQuery CreateRepository where
toQuery :: CreateRepository -> QueryString
toQuery CreateRepository' {Maybe [Tag]
Maybe [UpstreamRepository]
Maybe Text
Text
repository :: Text
domain :: Text
upstreams :: Maybe [UpstreamRepository]
tags :: Maybe [Tag]
domainOwner :: Maybe Text
description :: Maybe Text
$sel:repository:CreateRepository' :: CreateRepository -> Text
$sel:domain:CreateRepository' :: CreateRepository -> Text
$sel:upstreams:CreateRepository' :: CreateRepository -> Maybe [UpstreamRepository]
$sel:tags:CreateRepository' :: CreateRepository -> Maybe [Tag]
$sel:domainOwner:CreateRepository' :: CreateRepository -> Maybe Text
$sel:description:CreateRepository' :: CreateRepository -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"domain-owner" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
domainOwner,
ByteString
"domain" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
domain,
ByteString
"repository" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
repository
]
data CreateRepositoryResponse = CreateRepositoryResponse'
{
CreateRepositoryResponse -> Maybe RepositoryDescription
repository :: Prelude.Maybe RepositoryDescription,
CreateRepositoryResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateRepositoryResponse -> CreateRepositoryResponse -> Bool
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]
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
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.
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'
{ $sel:repository:CreateRepositoryResponse' :: Maybe RepositoryDescription
repository =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateRepositoryResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createRepositoryResponse_repository :: Lens.Lens' CreateRepositoryResponse (Prelude.Maybe RepositoryDescription)
createRepositoryResponse_repository :: Lens' CreateRepositoryResponse (Maybe RepositoryDescription)
createRepositoryResponse_repository = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRepositoryResponse' {Maybe RepositoryDescription
repository :: Maybe RepositoryDescription
$sel:repository:CreateRepositoryResponse' :: CreateRepositoryResponse -> Maybe RepositoryDescription
repository} -> Maybe RepositoryDescription
repository) (\s :: CreateRepositoryResponse
s@CreateRepositoryResponse' {} Maybe RepositoryDescription
a -> CreateRepositoryResponse
s {$sel:repository:CreateRepositoryResponse' :: Maybe RepositoryDescription
repository = Maybe RepositoryDescription
a} :: CreateRepositoryResponse)
createRepositoryResponse_httpStatus :: Lens.Lens' CreateRepositoryResponse Prelude.Int
createRepositoryResponse_httpStatus :: Lens' CreateRepositoryResponse Int
createRepositoryResponse_httpStatus = 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 where
rnf :: CreateRepositoryResponse -> ()
rnf CreateRepositoryResponse' {Int
Maybe RepositoryDescription
httpStatus :: Int
repository :: Maybe RepositoryDescription
$sel:httpStatus:CreateRepositoryResponse' :: CreateRepositoryResponse -> Int
$sel:repository:CreateRepositoryResponse' :: CreateRepositoryResponse -> Maybe RepositoryDescription
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe RepositoryDescription
repository
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus