{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

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

-- |
-- Module      : Amazonka.CodeGuruReviewer.Types.CodeCommitRepository
-- 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)
module Amazonka.CodeGuruReviewer.Types.CodeCommitRepository where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about an Amazon Web Services CodeCommit repository. The
-- CodeCommit repository must be in the same Amazon Web Services Region and
-- Amazon Web Services account where its CodeGuru Reviewer code reviews are
-- configured.
--
-- /See:/ 'newCodeCommitRepository' smart constructor.
data CodeCommitRepository = CodeCommitRepository'
  { -- | The name of the Amazon Web Services CodeCommit repository. For more
    -- information, see
    -- <https://docs.aws.amazon.com/codecommit/latest/APIReference/API_GetRepository.html#CodeCommit-GetRepository-request-repositoryName repositoryName>
    -- in the /Amazon Web Services CodeCommit API Reference/.
    CodeCommitRepository -> Text
name :: Prelude.Text
  }
  deriving (CodeCommitRepository -> CodeCommitRepository -> Bool
(CodeCommitRepository -> CodeCommitRepository -> Bool)
-> (CodeCommitRepository -> CodeCommitRepository -> Bool)
-> Eq CodeCommitRepository
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CodeCommitRepository -> CodeCommitRepository -> Bool
$c/= :: CodeCommitRepository -> CodeCommitRepository -> Bool
== :: CodeCommitRepository -> CodeCommitRepository -> Bool
$c== :: CodeCommitRepository -> CodeCommitRepository -> Bool
Prelude.Eq, ReadPrec [CodeCommitRepository]
ReadPrec CodeCommitRepository
Int -> ReadS CodeCommitRepository
ReadS [CodeCommitRepository]
(Int -> ReadS CodeCommitRepository)
-> ReadS [CodeCommitRepository]
-> ReadPrec CodeCommitRepository
-> ReadPrec [CodeCommitRepository]
-> Read CodeCommitRepository
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CodeCommitRepository]
$creadListPrec :: ReadPrec [CodeCommitRepository]
readPrec :: ReadPrec CodeCommitRepository
$creadPrec :: ReadPrec CodeCommitRepository
readList :: ReadS [CodeCommitRepository]
$creadList :: ReadS [CodeCommitRepository]
readsPrec :: Int -> ReadS CodeCommitRepository
$creadsPrec :: Int -> ReadS CodeCommitRepository
Prelude.Read, Int -> CodeCommitRepository -> ShowS
[CodeCommitRepository] -> ShowS
CodeCommitRepository -> String
(Int -> CodeCommitRepository -> ShowS)
-> (CodeCommitRepository -> String)
-> ([CodeCommitRepository] -> ShowS)
-> Show CodeCommitRepository
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CodeCommitRepository] -> ShowS
$cshowList :: [CodeCommitRepository] -> ShowS
show :: CodeCommitRepository -> String
$cshow :: CodeCommitRepository -> String
showsPrec :: Int -> CodeCommitRepository -> ShowS
$cshowsPrec :: Int -> CodeCommitRepository -> ShowS
Prelude.Show, (forall x. CodeCommitRepository -> Rep CodeCommitRepository x)
-> (forall x. Rep CodeCommitRepository x -> CodeCommitRepository)
-> Generic CodeCommitRepository
forall x. Rep CodeCommitRepository x -> CodeCommitRepository
forall x. CodeCommitRepository -> Rep CodeCommitRepository x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CodeCommitRepository x -> CodeCommitRepository
$cfrom :: forall x. CodeCommitRepository -> Rep CodeCommitRepository x
Prelude.Generic)

-- |
-- Create a value of 'CodeCommitRepository' 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:
--
-- 'name', 'codeCommitRepository_name' - The name of the Amazon Web Services CodeCommit repository. For more
-- information, see
-- <https://docs.aws.amazon.com/codecommit/latest/APIReference/API_GetRepository.html#CodeCommit-GetRepository-request-repositoryName repositoryName>
-- in the /Amazon Web Services CodeCommit API Reference/.
newCodeCommitRepository ::
  -- | 'name'
  Prelude.Text ->
  CodeCommitRepository
newCodeCommitRepository :: Text -> CodeCommitRepository
newCodeCommitRepository Text
pName_ =
  CodeCommitRepository' :: Text -> CodeCommitRepository
CodeCommitRepository' {$sel:name:CodeCommitRepository' :: Text
name = Text
pName_}

-- | The name of the Amazon Web Services CodeCommit repository. For more
-- information, see
-- <https://docs.aws.amazon.com/codecommit/latest/APIReference/API_GetRepository.html#CodeCommit-GetRepository-request-repositoryName repositoryName>
-- in the /Amazon Web Services CodeCommit API Reference/.
codeCommitRepository_name :: Lens.Lens' CodeCommitRepository Prelude.Text
codeCommitRepository_name :: (Text -> f Text) -> CodeCommitRepository -> f CodeCommitRepository
codeCommitRepository_name = (CodeCommitRepository -> Text)
-> (CodeCommitRepository -> Text -> CodeCommitRepository)
-> Lens CodeCommitRepository CodeCommitRepository Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeCommitRepository' {Text
name :: Text
$sel:name:CodeCommitRepository' :: CodeCommitRepository -> Text
name} -> Text
name) (\s :: CodeCommitRepository
s@CodeCommitRepository' {} Text
a -> CodeCommitRepository
s {$sel:name:CodeCommitRepository' :: Text
name = Text
a} :: CodeCommitRepository)

instance Prelude.Hashable CodeCommitRepository

instance Prelude.NFData CodeCommitRepository

instance Core.ToJSON CodeCommitRepository where
  toJSON :: CodeCommitRepository -> Value
toJSON CodeCommitRepository' {Text
name :: Text
$sel:name:CodeCommitRepository' :: CodeCommitRepository -> 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
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)]
      )