{-# 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.GitHubCodeDestination
-- 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.GitHubCodeDestination where

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

-- | Information about the GitHub 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:/ 'newGitHubCodeDestination' smart constructor.
data GitHubCodeDestination = GitHubCodeDestination'
  { -- | Description for the GitHub repository to be created in AWS CodeStar.
    -- This description displays in GitHub after the repository is created.
    GitHubCodeDestination -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Name of the GitHub repository to be created in AWS CodeStar.
    GitHubCodeDestination -> Text
name :: Prelude.Text,
    -- | The type of GitHub repository to be created in AWS CodeStar. Valid
    -- values are User or Organization.
    GitHubCodeDestination -> Text
type' :: Prelude.Text,
    -- | The GitHub username for the owner of the GitHub repository to be created
    -- in AWS CodeStar. If this repository should be owned by a GitHub
    -- organization, provide its name.
    GitHubCodeDestination -> Text
owner :: Prelude.Text,
    -- | Whether the GitHub repository is to be a private repository.
    GitHubCodeDestination -> Bool
privateRepository :: Prelude.Bool,
    -- | Whether to enable issues for the GitHub repository.
    GitHubCodeDestination -> Bool
issuesEnabled :: Prelude.Bool,
    -- | The GitHub user\'s personal access token for the GitHub repository.
    GitHubCodeDestination -> Sensitive Text
token :: Core.Sensitive Prelude.Text
  }
  deriving (GitHubCodeDestination -> GitHubCodeDestination -> Bool
(GitHubCodeDestination -> GitHubCodeDestination -> Bool)
-> (GitHubCodeDestination -> GitHubCodeDestination -> Bool)
-> Eq GitHubCodeDestination
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GitHubCodeDestination -> GitHubCodeDestination -> Bool
$c/= :: GitHubCodeDestination -> GitHubCodeDestination -> Bool
== :: GitHubCodeDestination -> GitHubCodeDestination -> Bool
$c== :: GitHubCodeDestination -> GitHubCodeDestination -> Bool
Prelude.Eq, Int -> GitHubCodeDestination -> ShowS
[GitHubCodeDestination] -> ShowS
GitHubCodeDestination -> String
(Int -> GitHubCodeDestination -> ShowS)
-> (GitHubCodeDestination -> String)
-> ([GitHubCodeDestination] -> ShowS)
-> Show GitHubCodeDestination
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GitHubCodeDestination] -> ShowS
$cshowList :: [GitHubCodeDestination] -> ShowS
show :: GitHubCodeDestination -> String
$cshow :: GitHubCodeDestination -> String
showsPrec :: Int -> GitHubCodeDestination -> ShowS
$cshowsPrec :: Int -> GitHubCodeDestination -> ShowS
Prelude.Show, (forall x. GitHubCodeDestination -> Rep GitHubCodeDestination x)
-> (forall x. Rep GitHubCodeDestination x -> GitHubCodeDestination)
-> Generic GitHubCodeDestination
forall x. Rep GitHubCodeDestination x -> GitHubCodeDestination
forall x. GitHubCodeDestination -> Rep GitHubCodeDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GitHubCodeDestination x -> GitHubCodeDestination
$cfrom :: forall x. GitHubCodeDestination -> Rep GitHubCodeDestination x
Prelude.Generic)

-- |
-- Create a value of 'GitHubCodeDestination' 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:
--
-- 'description', 'gitHubCodeDestination_description' - Description for the GitHub repository to be created in AWS CodeStar.
-- This description displays in GitHub after the repository is created.
--
-- 'name', 'gitHubCodeDestination_name' - Name of the GitHub repository to be created in AWS CodeStar.
--
-- 'type'', 'gitHubCodeDestination_type' - The type of GitHub repository to be created in AWS CodeStar. Valid
-- values are User or Organization.
--
-- 'owner', 'gitHubCodeDestination_owner' - The GitHub username for the owner of the GitHub repository to be created
-- in AWS CodeStar. If this repository should be owned by a GitHub
-- organization, provide its name.
--
-- 'privateRepository', 'gitHubCodeDestination_privateRepository' - Whether the GitHub repository is to be a private repository.
--
-- 'issuesEnabled', 'gitHubCodeDestination_issuesEnabled' - Whether to enable issues for the GitHub repository.
--
-- 'token', 'gitHubCodeDestination_token' - The GitHub user\'s personal access token for the GitHub repository.
newGitHubCodeDestination ::
  -- | 'name'
  Prelude.Text ->
  -- | 'type''
  Prelude.Text ->
  -- | 'owner'
  Prelude.Text ->
  -- | 'privateRepository'
  Prelude.Bool ->
  -- | 'issuesEnabled'
  Prelude.Bool ->
  -- | 'token'
  Prelude.Text ->
  GitHubCodeDestination
newGitHubCodeDestination :: Text
-> Text -> Text -> Bool -> Bool -> Text -> GitHubCodeDestination
newGitHubCodeDestination
  Text
pName_
  Text
pType_
  Text
pOwner_
  Bool
pPrivateRepository_
  Bool
pIssuesEnabled_
  Text
pToken_ =
    GitHubCodeDestination' :: Maybe Text
-> Text
-> Text
-> Text
-> Bool
-> Bool
-> Sensitive Text
-> GitHubCodeDestination
GitHubCodeDestination'
      { $sel:description:GitHubCodeDestination' :: Maybe Text
description =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:name:GitHubCodeDestination' :: Text
name = Text
pName_,
        $sel:type':GitHubCodeDestination' :: Text
type' = Text
pType_,
        $sel:owner:GitHubCodeDestination' :: Text
owner = Text
pOwner_,
        $sel:privateRepository:GitHubCodeDestination' :: Bool
privateRepository = Bool
pPrivateRepository_,
        $sel:issuesEnabled:GitHubCodeDestination' :: Bool
issuesEnabled = Bool
pIssuesEnabled_,
        $sel:token:GitHubCodeDestination' :: Sensitive Text
token = Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
 -> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pToken_
      }

-- | Description for the GitHub repository to be created in AWS CodeStar.
-- This description displays in GitHub after the repository is created.
gitHubCodeDestination_description :: Lens.Lens' GitHubCodeDestination (Prelude.Maybe Prelude.Text)
gitHubCodeDestination_description :: (Maybe Text -> f (Maybe Text))
-> GitHubCodeDestination -> f GitHubCodeDestination
gitHubCodeDestination_description = (GitHubCodeDestination -> Maybe Text)
-> (GitHubCodeDestination -> Maybe Text -> GitHubCodeDestination)
-> Lens
     GitHubCodeDestination
     GitHubCodeDestination
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GitHubCodeDestination' {Maybe Text
description :: Maybe Text
$sel:description:GitHubCodeDestination' :: GitHubCodeDestination -> Maybe Text
description} -> Maybe Text
description) (\s :: GitHubCodeDestination
s@GitHubCodeDestination' {} Maybe Text
a -> GitHubCodeDestination
s {$sel:description:GitHubCodeDestination' :: Maybe Text
description = Maybe Text
a} :: GitHubCodeDestination)

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

-- | The type of GitHub repository to be created in AWS CodeStar. Valid
-- values are User or Organization.
gitHubCodeDestination_type :: Lens.Lens' GitHubCodeDestination Prelude.Text
gitHubCodeDestination_type :: (Text -> f Text)
-> GitHubCodeDestination -> f GitHubCodeDestination
gitHubCodeDestination_type = (GitHubCodeDestination -> Text)
-> (GitHubCodeDestination -> Text -> GitHubCodeDestination)
-> Lens GitHubCodeDestination GitHubCodeDestination Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GitHubCodeDestination' {Text
type' :: Text
$sel:type':GitHubCodeDestination' :: GitHubCodeDestination -> Text
type'} -> Text
type') (\s :: GitHubCodeDestination
s@GitHubCodeDestination' {} Text
a -> GitHubCodeDestination
s {$sel:type':GitHubCodeDestination' :: Text
type' = Text
a} :: GitHubCodeDestination)

-- | The GitHub username for the owner of the GitHub repository to be created
-- in AWS CodeStar. If this repository should be owned by a GitHub
-- organization, provide its name.
gitHubCodeDestination_owner :: Lens.Lens' GitHubCodeDestination Prelude.Text
gitHubCodeDestination_owner :: (Text -> f Text)
-> GitHubCodeDestination -> f GitHubCodeDestination
gitHubCodeDestination_owner = (GitHubCodeDestination -> Text)
-> (GitHubCodeDestination -> Text -> GitHubCodeDestination)
-> Lens GitHubCodeDestination GitHubCodeDestination Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GitHubCodeDestination' {Text
owner :: Text
$sel:owner:GitHubCodeDestination' :: GitHubCodeDestination -> Text
owner} -> Text
owner) (\s :: GitHubCodeDestination
s@GitHubCodeDestination' {} Text
a -> GitHubCodeDestination
s {$sel:owner:GitHubCodeDestination' :: Text
owner = Text
a} :: GitHubCodeDestination)

-- | Whether the GitHub repository is to be a private repository.
gitHubCodeDestination_privateRepository :: Lens.Lens' GitHubCodeDestination Prelude.Bool
gitHubCodeDestination_privateRepository :: (Bool -> f Bool)
-> GitHubCodeDestination -> f GitHubCodeDestination
gitHubCodeDestination_privateRepository = (GitHubCodeDestination -> Bool)
-> (GitHubCodeDestination -> Bool -> GitHubCodeDestination)
-> Lens GitHubCodeDestination GitHubCodeDestination Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GitHubCodeDestination' {Bool
privateRepository :: Bool
$sel:privateRepository:GitHubCodeDestination' :: GitHubCodeDestination -> Bool
privateRepository} -> Bool
privateRepository) (\s :: GitHubCodeDestination
s@GitHubCodeDestination' {} Bool
a -> GitHubCodeDestination
s {$sel:privateRepository:GitHubCodeDestination' :: Bool
privateRepository = Bool
a} :: GitHubCodeDestination)

-- | Whether to enable issues for the GitHub repository.
gitHubCodeDestination_issuesEnabled :: Lens.Lens' GitHubCodeDestination Prelude.Bool
gitHubCodeDestination_issuesEnabled :: (Bool -> f Bool)
-> GitHubCodeDestination -> f GitHubCodeDestination
gitHubCodeDestination_issuesEnabled = (GitHubCodeDestination -> Bool)
-> (GitHubCodeDestination -> Bool -> GitHubCodeDestination)
-> Lens GitHubCodeDestination GitHubCodeDestination Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GitHubCodeDestination' {Bool
issuesEnabled :: Bool
$sel:issuesEnabled:GitHubCodeDestination' :: GitHubCodeDestination -> Bool
issuesEnabled} -> Bool
issuesEnabled) (\s :: GitHubCodeDestination
s@GitHubCodeDestination' {} Bool
a -> GitHubCodeDestination
s {$sel:issuesEnabled:GitHubCodeDestination' :: Bool
issuesEnabled = Bool
a} :: GitHubCodeDestination)

-- | The GitHub user\'s personal access token for the GitHub repository.
gitHubCodeDestination_token :: Lens.Lens' GitHubCodeDestination Prelude.Text
gitHubCodeDestination_token :: (Text -> f Text)
-> GitHubCodeDestination -> f GitHubCodeDestination
gitHubCodeDestination_token = (GitHubCodeDestination -> Sensitive Text)
-> (GitHubCodeDestination
    -> Sensitive Text -> GitHubCodeDestination)
-> Lens
     GitHubCodeDestination
     GitHubCodeDestination
     (Sensitive Text)
     (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GitHubCodeDestination' {Sensitive Text
token :: Sensitive Text
$sel:token:GitHubCodeDestination' :: GitHubCodeDestination -> Sensitive Text
token} -> Sensitive Text
token) (\s :: GitHubCodeDestination
s@GitHubCodeDestination' {} Sensitive Text
a -> GitHubCodeDestination
s {$sel:token:GitHubCodeDestination' :: Sensitive Text
token = Sensitive Text
a} :: GitHubCodeDestination) ((Sensitive Text -> f (Sensitive Text))
 -> GitHubCodeDestination -> f GitHubCodeDestination)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> GitHubCodeDestination
-> f GitHubCodeDestination
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive

instance Prelude.Hashable GitHubCodeDestination

instance Prelude.NFData GitHubCodeDestination

instance Core.ToJSON GitHubCodeDestination where
  toJSON :: GitHubCodeDestination -> Value
toJSON GitHubCodeDestination' {Bool
Maybe Text
Text
Sensitive Text
token :: Sensitive Text
issuesEnabled :: Bool
privateRepository :: Bool
owner :: Text
type' :: Text
name :: Text
description :: Maybe Text
$sel:token:GitHubCodeDestination' :: GitHubCodeDestination -> Sensitive Text
$sel:issuesEnabled:GitHubCodeDestination' :: GitHubCodeDestination -> Bool
$sel:privateRepository:GitHubCodeDestination' :: GitHubCodeDestination -> Bool
$sel:owner:GitHubCodeDestination' :: GitHubCodeDestination -> Text
$sel:type':GitHubCodeDestination' :: GitHubCodeDestination -> Text
$sel:name:GitHubCodeDestination' :: GitHubCodeDestination -> Text
$sel:description:GitHubCodeDestination' :: GitHubCodeDestination -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"description" 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
description,
            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),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"type" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
type'),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"owner" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
owner),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"privateRepository" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Bool
privateRepository),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"issuesEnabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Bool
issuesEnabled),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"token" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
token)
          ]
      )