{-# 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.CodeStar.Types.CodeCommitCodeDestination
-- 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.CodeStar.Types.CodeCommitCodeDestination where

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

-- | Information about the AWS CodeCommit repository to be created in AWS
-- CodeStar. This is where the source code files provided with the project
-- request will be uploaded after project creation.
--
-- /See:/ 'newCodeCommitCodeDestination' smart constructor.
data CodeCommitCodeDestination = CodeCommitCodeDestination'
  { -- | The name of the AWS CodeCommit repository to be created in AWS CodeStar.
    CodeCommitCodeDestination -> Text
name :: Prelude.Text
  }
  deriving (CodeCommitCodeDestination -> CodeCommitCodeDestination -> Bool
(CodeCommitCodeDestination -> CodeCommitCodeDestination -> Bool)
-> (CodeCommitCodeDestination -> CodeCommitCodeDestination -> Bool)
-> Eq CodeCommitCodeDestination
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CodeCommitCodeDestination -> CodeCommitCodeDestination -> Bool
$c/= :: CodeCommitCodeDestination -> CodeCommitCodeDestination -> Bool
== :: CodeCommitCodeDestination -> CodeCommitCodeDestination -> Bool
$c== :: CodeCommitCodeDestination -> CodeCommitCodeDestination -> Bool
Prelude.Eq, ReadPrec [CodeCommitCodeDestination]
ReadPrec CodeCommitCodeDestination
Int -> ReadS CodeCommitCodeDestination
ReadS [CodeCommitCodeDestination]
(Int -> ReadS CodeCommitCodeDestination)
-> ReadS [CodeCommitCodeDestination]
-> ReadPrec CodeCommitCodeDestination
-> ReadPrec [CodeCommitCodeDestination]
-> Read CodeCommitCodeDestination
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CodeCommitCodeDestination]
$creadListPrec :: ReadPrec [CodeCommitCodeDestination]
readPrec :: ReadPrec CodeCommitCodeDestination
$creadPrec :: ReadPrec CodeCommitCodeDestination
readList :: ReadS [CodeCommitCodeDestination]
$creadList :: ReadS [CodeCommitCodeDestination]
readsPrec :: Int -> ReadS CodeCommitCodeDestination
$creadsPrec :: Int -> ReadS CodeCommitCodeDestination
Prelude.Read, Int -> CodeCommitCodeDestination -> ShowS
[CodeCommitCodeDestination] -> ShowS
CodeCommitCodeDestination -> String
(Int -> CodeCommitCodeDestination -> ShowS)
-> (CodeCommitCodeDestination -> String)
-> ([CodeCommitCodeDestination] -> ShowS)
-> Show CodeCommitCodeDestination
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CodeCommitCodeDestination] -> ShowS
$cshowList :: [CodeCommitCodeDestination] -> ShowS
show :: CodeCommitCodeDestination -> String
$cshow :: CodeCommitCodeDestination -> String
showsPrec :: Int -> CodeCommitCodeDestination -> ShowS
$cshowsPrec :: Int -> CodeCommitCodeDestination -> ShowS
Prelude.Show, (forall x.
 CodeCommitCodeDestination -> Rep CodeCommitCodeDestination x)
-> (forall x.
    Rep CodeCommitCodeDestination x -> CodeCommitCodeDestination)
-> Generic CodeCommitCodeDestination
forall x.
Rep CodeCommitCodeDestination x -> CodeCommitCodeDestination
forall x.
CodeCommitCodeDestination -> Rep CodeCommitCodeDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CodeCommitCodeDestination x -> CodeCommitCodeDestination
$cfrom :: forall x.
CodeCommitCodeDestination -> Rep CodeCommitCodeDestination x
Prelude.Generic)

-- |
-- Create a value of 'CodeCommitCodeDestination' 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', 'codeCommitCodeDestination_name' - The name of the AWS CodeCommit repository to be created in AWS CodeStar.
newCodeCommitCodeDestination ::
  -- | 'name'
  Prelude.Text ->
  CodeCommitCodeDestination
newCodeCommitCodeDestination :: Text -> CodeCommitCodeDestination
newCodeCommitCodeDestination Text
pName_ =
  CodeCommitCodeDestination' :: Text -> CodeCommitCodeDestination
CodeCommitCodeDestination' {$sel:name:CodeCommitCodeDestination' :: Text
name = Text
pName_}

-- | The name of the AWS CodeCommit repository to be created in AWS CodeStar.
codeCommitCodeDestination_name :: Lens.Lens' CodeCommitCodeDestination Prelude.Text
codeCommitCodeDestination_name :: (Text -> f Text)
-> CodeCommitCodeDestination -> f CodeCommitCodeDestination
codeCommitCodeDestination_name = (CodeCommitCodeDestination -> Text)
-> (CodeCommitCodeDestination -> Text -> CodeCommitCodeDestination)
-> Lens
     CodeCommitCodeDestination CodeCommitCodeDestination Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeCommitCodeDestination' {Text
name :: Text
$sel:name:CodeCommitCodeDestination' :: CodeCommitCodeDestination -> Text
name} -> Text
name) (\s :: CodeCommitCodeDestination
s@CodeCommitCodeDestination' {} Text
a -> CodeCommitCodeDestination
s {$sel:name:CodeCommitCodeDestination' :: Text
name = Text
a} :: CodeCommitCodeDestination)

instance Prelude.Hashable CodeCommitCodeDestination

instance Prelude.NFData CodeCommitCodeDestination

instance Core.ToJSON CodeCommitCodeDestination where
  toJSON :: CodeCommitCodeDestination -> Value
toJSON CodeCommitCodeDestination' {Text
name :: Text
$sel:name:CodeCommitCodeDestination' :: CodeCommitCodeDestination -> 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)]
      )