{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.ECR.CreateRepository
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a repository. For more information, see
-- <https://docs.aws.amazon.com/AmazonECR/latest/userguide/Repositories.html Amazon ECR repositories>
-- in the /Amazon Elastic Container Registry User Guide/.
module Amazonka.ECR.CreateRepository
  ( -- * Creating a Request
    CreateRepository (..),
    newCreateRepository,

    -- * Request Lenses
    createRepository_registryId,
    createRepository_imageScanningConfiguration,
    createRepository_encryptionConfiguration,
    createRepository_imageTagMutability,
    createRepository_tags,
    createRepository_repositoryName,

    -- * Destructuring the Response
    CreateRepositoryResponse (..),
    newCreateRepositoryResponse,

    -- * Response Lenses
    createRepositoryResponse_repository,
    createRepositoryResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.ECR.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

-- | /See:/ 'newCreateRepository' smart constructor.
data CreateRepository = CreateRepository'
  { -- | The AWS account ID associated with the registry to create the
    -- repository. If you do not specify a registry, the default registry is
    -- assumed.
    CreateRepository -> Maybe Text
registryId :: Prelude.Maybe Prelude.Text,
    -- | The image scanning configuration for the repository. This determines
    -- whether images are scanned for known vulnerabilities after being pushed
    -- to the repository.
    CreateRepository -> Maybe ImageScanningConfiguration
imageScanningConfiguration :: Prelude.Maybe ImageScanningConfiguration,
    -- | The encryption configuration for the repository. This determines how the
    -- contents of your repository are encrypted at rest.
    CreateRepository -> Maybe EncryptionConfiguration
encryptionConfiguration :: Prelude.Maybe EncryptionConfiguration,
    -- | The tag mutability setting for the repository. If this parameter is
    -- omitted, the default setting of @MUTABLE@ will be used which will allow
    -- image tags to be overwritten. If @IMMUTABLE@ is specified, all image
    -- tags within the repository will be immutable which will prevent them
    -- from being overwritten.
    CreateRepository -> Maybe ImageTagMutability
imageTagMutability :: Prelude.Maybe ImageTagMutability,
    -- | The metadata that you apply to the repository to help you categorize and
    -- organize them. Each tag consists of a key and an optional value, both of
    -- which you define. Tag keys can have a maximum character length of 128
    -- characters, and tag values can have a maximum length of 256 characters.
    CreateRepository -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The name to use for the repository. The repository name may be specified
    -- on its own (such as @nginx-web-app@) or it can be prepended with a
    -- namespace to group the repository into a category (such as
    -- @project-a\/nginx-web-app@).
    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)

-- |
-- Create a value of 'CreateRepository' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'registryId', 'createRepository_registryId' - The AWS account ID associated with the registry to create the
-- repository. If you do not specify a registry, the default registry is
-- assumed.
--
-- 'imageScanningConfiguration', 'createRepository_imageScanningConfiguration' - The image scanning configuration for the repository. This determines
-- whether images are scanned for known vulnerabilities after being pushed
-- to the repository.
--
-- 'encryptionConfiguration', 'createRepository_encryptionConfiguration' - The encryption configuration for the repository. This determines how the
-- contents of your repository are encrypted at rest.
--
-- 'imageTagMutability', 'createRepository_imageTagMutability' - The tag mutability setting for the repository. If this parameter is
-- omitted, the default setting of @MUTABLE@ will be used which will allow
-- image tags to be overwritten. If @IMMUTABLE@ is specified, all image
-- tags within the repository will be immutable which will prevent them
-- from being overwritten.
--
-- 'tags', 'createRepository_tags' - The metadata that you apply to the repository to help you categorize and
-- organize them. Each tag consists of a key and an optional value, both of
-- which you define. Tag keys can have a maximum character length of 128
-- characters, and tag values can have a maximum length of 256 characters.
--
-- 'repositoryName', 'createRepository_repositoryName' - The name to use for the repository. The repository name may be specified
-- on its own (such as @nginx-web-app@) or it can be prepended with a
-- namespace to group the repository into a category (such as
-- @project-a\/nginx-web-app@).
newCreateRepository ::
  -- | 'repositoryName'
  Prelude.Text ->
  CreateRepository
newCreateRepository :: Text -> CreateRepository
newCreateRepository Text
pRepositoryName_ =
  CreateRepository' :: Maybe Text
-> Maybe ImageScanningConfiguration
-> Maybe EncryptionConfiguration
-> Maybe ImageTagMutability
-> Maybe [Tag]
-> Text
-> CreateRepository
CreateRepository'
    { $sel:registryId:CreateRepository' :: Maybe Text
registryId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:imageScanningConfiguration:CreateRepository' :: Maybe ImageScanningConfiguration
imageScanningConfiguration = Maybe ImageScanningConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:encryptionConfiguration:CreateRepository' :: Maybe EncryptionConfiguration
encryptionConfiguration = Maybe EncryptionConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:imageTagMutability:CreateRepository' :: Maybe ImageTagMutability
imageTagMutability = Maybe ImageTagMutability
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_
    }

-- | The AWS account ID associated with the registry to create the
-- repository. If you do not specify a registry, the default registry is
-- assumed.
createRepository_registryId :: Lens.Lens' CreateRepository (Prelude.Maybe Prelude.Text)
createRepository_registryId :: (Maybe Text -> f (Maybe Text))
-> CreateRepository -> f CreateRepository
createRepository_registryId = (CreateRepository -> Maybe Text)
-> (CreateRepository -> Maybe Text -> CreateRepository)
-> Lens CreateRepository CreateRepository (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRepository' {Maybe Text
registryId :: Maybe Text
$sel:registryId:CreateRepository' :: CreateRepository -> Maybe Text
registryId} -> Maybe Text
registryId) (\s :: CreateRepository
s@CreateRepository' {} Maybe Text
a -> CreateRepository
s {$sel:registryId:CreateRepository' :: Maybe Text
registryId = Maybe Text
a} :: CreateRepository)

-- | The image scanning configuration for the repository. This determines
-- whether images are scanned for known vulnerabilities after being pushed
-- to the repository.
createRepository_imageScanningConfiguration :: Lens.Lens' CreateRepository (Prelude.Maybe ImageScanningConfiguration)
createRepository_imageScanningConfiguration :: (Maybe ImageScanningConfiguration
 -> f (Maybe ImageScanningConfiguration))
-> CreateRepository -> f CreateRepository
createRepository_imageScanningConfiguration = (CreateRepository -> Maybe ImageScanningConfiguration)
-> (CreateRepository
    -> Maybe ImageScanningConfiguration -> CreateRepository)
-> Lens
     CreateRepository
     CreateRepository
     (Maybe ImageScanningConfiguration)
     (Maybe ImageScanningConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRepository' {Maybe ImageScanningConfiguration
imageScanningConfiguration :: Maybe ImageScanningConfiguration
$sel:imageScanningConfiguration:CreateRepository' :: CreateRepository -> Maybe ImageScanningConfiguration
imageScanningConfiguration} -> Maybe ImageScanningConfiguration
imageScanningConfiguration) (\s :: CreateRepository
s@CreateRepository' {} Maybe ImageScanningConfiguration
a -> CreateRepository
s {$sel:imageScanningConfiguration:CreateRepository' :: Maybe ImageScanningConfiguration
imageScanningConfiguration = Maybe ImageScanningConfiguration
a} :: CreateRepository)

-- | The encryption configuration for the repository. This determines how the
-- contents of your repository are encrypted at rest.
createRepository_encryptionConfiguration :: Lens.Lens' CreateRepository (Prelude.Maybe EncryptionConfiguration)
createRepository_encryptionConfiguration :: (Maybe EncryptionConfiguration
 -> f (Maybe EncryptionConfiguration))
-> CreateRepository -> f CreateRepository
createRepository_encryptionConfiguration = (CreateRepository -> Maybe EncryptionConfiguration)
-> (CreateRepository
    -> Maybe EncryptionConfiguration -> CreateRepository)
-> Lens
     CreateRepository
     CreateRepository
     (Maybe EncryptionConfiguration)
     (Maybe EncryptionConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRepository' {Maybe EncryptionConfiguration
encryptionConfiguration :: Maybe EncryptionConfiguration
$sel:encryptionConfiguration:CreateRepository' :: CreateRepository -> Maybe EncryptionConfiguration
encryptionConfiguration} -> Maybe EncryptionConfiguration
encryptionConfiguration) (\s :: CreateRepository
s@CreateRepository' {} Maybe EncryptionConfiguration
a -> CreateRepository
s {$sel:encryptionConfiguration:CreateRepository' :: Maybe EncryptionConfiguration
encryptionConfiguration = Maybe EncryptionConfiguration
a} :: CreateRepository)

-- | The tag mutability setting for the repository. If this parameter is
-- omitted, the default setting of @MUTABLE@ will be used which will allow
-- image tags to be overwritten. If @IMMUTABLE@ is specified, all image
-- tags within the repository will be immutable which will prevent them
-- from being overwritten.
createRepository_imageTagMutability :: Lens.Lens' CreateRepository (Prelude.Maybe ImageTagMutability)
createRepository_imageTagMutability :: (Maybe ImageTagMutability -> f (Maybe ImageTagMutability))
-> CreateRepository -> f CreateRepository
createRepository_imageTagMutability = (CreateRepository -> Maybe ImageTagMutability)
-> (CreateRepository
    -> Maybe ImageTagMutability -> CreateRepository)
-> Lens
     CreateRepository
     CreateRepository
     (Maybe ImageTagMutability)
     (Maybe ImageTagMutability)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRepository' {Maybe ImageTagMutability
imageTagMutability :: Maybe ImageTagMutability
$sel:imageTagMutability:CreateRepository' :: CreateRepository -> Maybe ImageTagMutability
imageTagMutability} -> Maybe ImageTagMutability
imageTagMutability) (\s :: CreateRepository
s@CreateRepository' {} Maybe ImageTagMutability
a -> CreateRepository
s {$sel:imageTagMutability:CreateRepository' :: Maybe ImageTagMutability
imageTagMutability = Maybe ImageTagMutability
a} :: CreateRepository)

-- | The metadata that you apply to the repository to help you categorize and
-- organize them. Each tag consists of a key and an optional value, both of
-- which you define. Tag keys can have a maximum character length of 128
-- characters, and tag values can have a maximum length of 256 characters.
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

-- | The name to use for the repository. The repository name may be specified
-- on its own (such as @nginx-web-app@) or it can be prepended with a
-- namespace to group the repository into a category (such as
-- @project-a\/nginx-web-app@).
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 -> Int -> CreateRepositoryResponse
CreateRepositoryResponse'
            (Maybe Repository -> Int -> CreateRepositoryResponse)
-> Either String (Maybe Repository)
-> Either String (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 (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
"AmazonEC2ContainerRegistry_V20150921.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 Text
Maybe EncryptionConfiguration
Maybe ImageScanningConfiguration
Maybe ImageTagMutability
Text
repositoryName :: Text
tags :: Maybe [Tag]
imageTagMutability :: Maybe ImageTagMutability
encryptionConfiguration :: Maybe EncryptionConfiguration
imageScanningConfiguration :: Maybe ImageScanningConfiguration
registryId :: Maybe Text
$sel:repositoryName:CreateRepository' :: CreateRepository -> Text
$sel:tags:CreateRepository' :: CreateRepository -> Maybe [Tag]
$sel:imageTagMutability:CreateRepository' :: CreateRepository -> Maybe ImageTagMutability
$sel:encryptionConfiguration:CreateRepository' :: CreateRepository -> Maybe EncryptionConfiguration
$sel:imageScanningConfiguration:CreateRepository' :: CreateRepository -> Maybe ImageScanningConfiguration
$sel:registryId:CreateRepository' :: CreateRepository -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"registryId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
registryId,
            (Text
"imageScanningConfiguration" Text -> ImageScanningConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ImageScanningConfiguration -> Pair)
-> Maybe ImageScanningConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ImageScanningConfiguration
imageScanningConfiguration,
            (Text
"encryptionConfiguration" Text -> EncryptionConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (EncryptionConfiguration -> Pair)
-> Maybe EncryptionConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EncryptionConfiguration
encryptionConfiguration,
            (Text
"imageTagMutability" Text -> ImageTagMutability -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ImageTagMutability -> Pair)
-> Maybe ImageTagMutability -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ImageTagMutability
imageTagMutability,
            (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

-- | /See:/ 'newCreateRepositoryResponse' smart constructor.
data CreateRepositoryResponse = CreateRepositoryResponse'
  { -- | The repository that was created.
    CreateRepositoryResponse -> Maybe Repository
repository :: Prelude.Maybe Repository,
    -- | The response's http status code.
    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)

-- |
-- Create a value of 'CreateRepositoryResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'repository', 'createRepositoryResponse_repository' - The repository that was created.
--
-- 'httpStatus', 'createRepositoryResponse_httpStatus' - The response's http status code.
newCreateRepositoryResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateRepositoryResponse
newCreateRepositoryResponse :: Int -> CreateRepositoryResponse
newCreateRepositoryResponse Int
pHttpStatus_ =
  CreateRepositoryResponse' :: Maybe Repository -> Int -> CreateRepositoryResponse
CreateRepositoryResponse'
    { $sel:repository:CreateRepositoryResponse' :: Maybe Repository
repository =
        Maybe Repository
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateRepositoryResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The repository that was created.
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)

-- | The response's http status code.
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