{-# 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.CodeBuild.Types.ProjectSource
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.CodeBuild.Types.ProjectSource where

import Amazonka.CodeBuild.Types.BuildStatusConfig
import Amazonka.CodeBuild.Types.GitSubmodulesConfig
import Amazonka.CodeBuild.Types.SourceAuth
import Amazonka.CodeBuild.Types.SourceType
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

-- | Information about the build input source code for the build project.
--
-- /See:/ 'newProjectSource' smart constructor.
data ProjectSource = ProjectSource'
  { -- | Information about the authorization settings for CodeBuild to access the
    -- source code to be built.
    --
    -- This information is for the CodeBuild console\'s use only. Your code
    -- should not get or set this information directly.
    ProjectSource -> Maybe SourceAuth
auth :: Prelude.Maybe SourceAuth,
    -- | Contains information that defines how the build project reports the
    -- build status to the source provider. This option is only used when the
    -- source provider is @GITHUB@, @GITHUB_ENTERPRISE@, or @BITBUCKET@.
    ProjectSource -> Maybe BuildStatusConfig
buildStatusConfig :: Prelude.Maybe BuildStatusConfig,
    -- | The buildspec file declaration to use for the builds in this build
    -- project.
    --
    -- If this value is set, it can be either an inline buildspec definition,
    -- the path to an alternate buildspec file relative to the value of the
    -- built-in @CODEBUILD_SRC_DIR@ environment variable, or the path to an S3
    -- bucket. The bucket must be in the same Amazon Web Services Region as the
    -- build project. Specify the buildspec file using its ARN (for example,
    -- @arn:aws:s3:::my-codebuild-sample2\/buildspec.yml@). If this value is
    -- not provided or is set to an empty string, the source code must contain
    -- a buildspec file in its root directory. For more information, see
    -- <https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec-ref-name-storage Buildspec File Name and Storage Location>.
    ProjectSource -> Maybe Text
buildspec :: Prelude.Maybe Prelude.Text,
    -- | Information about the Git clone depth for the build project.
    ProjectSource -> Maybe Natural
gitCloneDepth :: Prelude.Maybe Prelude.Natural,
    -- | Information about the Git submodules configuration for the build
    -- project.
    ProjectSource -> Maybe GitSubmodulesConfig
gitSubmodulesConfig :: Prelude.Maybe GitSubmodulesConfig,
    -- | Enable this flag to ignore SSL warnings while connecting to the project
    -- source code.
    ProjectSource -> Maybe Bool
insecureSsl :: Prelude.Maybe Prelude.Bool,
    -- | Information about the location of the source code to be built. Valid
    -- values include:
    --
    -- -   For source code settings that are specified in the source action of
    --     a pipeline in CodePipeline, @location@ should not be specified. If
    --     it is specified, CodePipeline ignores it. This is because
    --     CodePipeline uses the settings in a pipeline\'s source action
    --     instead of this value.
    --
    -- -   For source code in an CodeCommit repository, the HTTPS clone URL to
    --     the repository that contains the source code and the buildspec file
    --     (for example,
    --     @https:\/\/git-codecommit.\<region-ID>.amazonaws.com\/v1\/repos\/\<repo-name>@).
    --
    -- -   For source code in an Amazon S3 input bucket, one of the following.
    --
    --     -   The path to the ZIP file that contains the source code (for
    --         example, @\<bucket-name>\/\<path>\/\<object-name>.zip@).
    --
    --     -   The path to the folder that contains the source code (for
    --         example, @\<bucket-name>\/\<path-to-source-code>\/\<folder>\/@).
    --
    -- -   For source code in a GitHub repository, the HTTPS clone URL to the
    --     repository that contains the source and the buildspec file. You must
    --     connect your Amazon Web Services account to your GitHub account. Use
    --     the CodeBuild console to start creating a build project. When you
    --     use the console to connect (or reconnect) with GitHub, on the GitHub
    --     __Authorize application__ page, for __Organization access__, choose
    --     __Request access__ next to each repository you want to allow
    --     CodeBuild to have access to, and then choose __Authorize
    --     application__. (After you have connected to your GitHub account, you
    --     do not need to finish creating the build project. You can leave the
    --     CodeBuild console.) To instruct CodeBuild to use this connection, in
    --     the @source@ object, set the @auth@ object\'s @type@ value to
    --     @OAUTH@.
    --
    -- -   For source code in a Bitbucket repository, the HTTPS clone URL to
    --     the repository that contains the source and the buildspec file. You
    --     must connect your Amazon Web Services account to your Bitbucket
    --     account. Use the CodeBuild console to start creating a build
    --     project. When you use the console to connect (or reconnect) with
    --     Bitbucket, on the Bitbucket __Confirm access to your account__ page,
    --     choose __Grant access__. (After you have connected to your Bitbucket
    --     account, you do not need to finish creating the build project. You
    --     can leave the CodeBuild console.) To instruct CodeBuild to use this
    --     connection, in the @source@ object, set the @auth@ object\'s @type@
    --     value to @OAUTH@.
    --
    -- If you specify @CODEPIPELINE@ for the @Type@ property, don\'t specify
    -- this property. For all of the other types, you must specify @Location@.
    ProjectSource -> Maybe Text
location :: Prelude.Maybe Prelude.Text,
    -- | Set to true to report the status of a build\'s start and finish to your
    -- source provider. This option is valid only when your source provider is
    -- GitHub, GitHub Enterprise, or Bitbucket. If this is set and you use a
    -- different source provider, an @invalidInputException@ is thrown.
    --
    -- To be able to report the build status to the source provider, the user
    -- associated with the source provider must have write access to the repo.
    -- If the user does not have write access, the build status cannot be
    -- updated. For more information, see
    -- <https://docs.aws.amazon.com/codebuild/latest/userguide/access-tokens.html Source provider access>
    -- in the /CodeBuild User Guide/.
    --
    -- The status of a build triggered by a webhook is always reported to your
    -- source provider.
    --
    -- If your project\'s builds are triggered by a webhook, you must push a
    -- new commit to the repo for a change to this property to take effect.
    ProjectSource -> Maybe Bool
reportBuildStatus :: Prelude.Maybe Prelude.Bool,
    -- | An identifier for this project source. The identifier can only contain
    -- alphanumeric characters and underscores, and must be less than 128
    -- characters in length.
    ProjectSource -> Maybe Text
sourceIdentifier :: Prelude.Maybe Prelude.Text,
    -- | The type of repository that contains the source code to be built. Valid
    -- values include:
    --
    -- -   @BITBUCKET@: The source code is in a Bitbucket repository.
    --
    -- -   @CODECOMMIT@: The source code is in an CodeCommit repository.
    --
    -- -   @CODEPIPELINE@: The source code settings are specified in the source
    --     action of a pipeline in CodePipeline.
    --
    -- -   @GITHUB@: The source code is in a GitHub or GitHub Enterprise Cloud
    --     repository.
    --
    -- -   @GITHUB_ENTERPRISE@: The source code is in a GitHub Enterprise
    --     Server repository.
    --
    -- -   @NO_SOURCE@: The project does not have input source code.
    --
    -- -   @S3@: The source code is in an Amazon S3 bucket.
    ProjectSource -> SourceType
type' :: SourceType
  }
  deriving (ProjectSource -> ProjectSource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProjectSource -> ProjectSource -> Bool
$c/= :: ProjectSource -> ProjectSource -> Bool
== :: ProjectSource -> ProjectSource -> Bool
$c== :: ProjectSource -> ProjectSource -> Bool
Prelude.Eq, ReadPrec [ProjectSource]
ReadPrec ProjectSource
Int -> ReadS ProjectSource
ReadS [ProjectSource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProjectSource]
$creadListPrec :: ReadPrec [ProjectSource]
readPrec :: ReadPrec ProjectSource
$creadPrec :: ReadPrec ProjectSource
readList :: ReadS [ProjectSource]
$creadList :: ReadS [ProjectSource]
readsPrec :: Int -> ReadS ProjectSource
$creadsPrec :: Int -> ReadS ProjectSource
Prelude.Read, Int -> ProjectSource -> ShowS
[ProjectSource] -> ShowS
ProjectSource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProjectSource] -> ShowS
$cshowList :: [ProjectSource] -> ShowS
show :: ProjectSource -> String
$cshow :: ProjectSource -> String
showsPrec :: Int -> ProjectSource -> ShowS
$cshowsPrec :: Int -> ProjectSource -> ShowS
Prelude.Show, forall x. Rep ProjectSource x -> ProjectSource
forall x. ProjectSource -> Rep ProjectSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProjectSource x -> ProjectSource
$cfrom :: forall x. ProjectSource -> Rep ProjectSource x
Prelude.Generic)

-- |
-- Create a value of 'ProjectSource' 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:
--
-- 'auth', 'projectSource_auth' - Information about the authorization settings for CodeBuild to access the
-- source code to be built.
--
-- This information is for the CodeBuild console\'s use only. Your code
-- should not get or set this information directly.
--
-- 'buildStatusConfig', 'projectSource_buildStatusConfig' - Contains information that defines how the build project reports the
-- build status to the source provider. This option is only used when the
-- source provider is @GITHUB@, @GITHUB_ENTERPRISE@, or @BITBUCKET@.
--
-- 'buildspec', 'projectSource_buildspec' - The buildspec file declaration to use for the builds in this build
-- project.
--
-- If this value is set, it can be either an inline buildspec definition,
-- the path to an alternate buildspec file relative to the value of the
-- built-in @CODEBUILD_SRC_DIR@ environment variable, or the path to an S3
-- bucket. The bucket must be in the same Amazon Web Services Region as the
-- build project. Specify the buildspec file using its ARN (for example,
-- @arn:aws:s3:::my-codebuild-sample2\/buildspec.yml@). If this value is
-- not provided or is set to an empty string, the source code must contain
-- a buildspec file in its root directory. For more information, see
-- <https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec-ref-name-storage Buildspec File Name and Storage Location>.
--
-- 'gitCloneDepth', 'projectSource_gitCloneDepth' - Information about the Git clone depth for the build project.
--
-- 'gitSubmodulesConfig', 'projectSource_gitSubmodulesConfig' - Information about the Git submodules configuration for the build
-- project.
--
-- 'insecureSsl', 'projectSource_insecureSsl' - Enable this flag to ignore SSL warnings while connecting to the project
-- source code.
--
-- 'location', 'projectSource_location' - Information about the location of the source code to be built. Valid
-- values include:
--
-- -   For source code settings that are specified in the source action of
--     a pipeline in CodePipeline, @location@ should not be specified. If
--     it is specified, CodePipeline ignores it. This is because
--     CodePipeline uses the settings in a pipeline\'s source action
--     instead of this value.
--
-- -   For source code in an CodeCommit repository, the HTTPS clone URL to
--     the repository that contains the source code and the buildspec file
--     (for example,
--     @https:\/\/git-codecommit.\<region-ID>.amazonaws.com\/v1\/repos\/\<repo-name>@).
--
-- -   For source code in an Amazon S3 input bucket, one of the following.
--
--     -   The path to the ZIP file that contains the source code (for
--         example, @\<bucket-name>\/\<path>\/\<object-name>.zip@).
--
--     -   The path to the folder that contains the source code (for
--         example, @\<bucket-name>\/\<path-to-source-code>\/\<folder>\/@).
--
-- -   For source code in a GitHub repository, the HTTPS clone URL to the
--     repository that contains the source and the buildspec file. You must
--     connect your Amazon Web Services account to your GitHub account. Use
--     the CodeBuild console to start creating a build project. When you
--     use the console to connect (or reconnect) with GitHub, on the GitHub
--     __Authorize application__ page, for __Organization access__, choose
--     __Request access__ next to each repository you want to allow
--     CodeBuild to have access to, and then choose __Authorize
--     application__. (After you have connected to your GitHub account, you
--     do not need to finish creating the build project. You can leave the
--     CodeBuild console.) To instruct CodeBuild to use this connection, in
--     the @source@ object, set the @auth@ object\'s @type@ value to
--     @OAUTH@.
--
-- -   For source code in a Bitbucket repository, the HTTPS clone URL to
--     the repository that contains the source and the buildspec file. You
--     must connect your Amazon Web Services account to your Bitbucket
--     account. Use the CodeBuild console to start creating a build
--     project. When you use the console to connect (or reconnect) with
--     Bitbucket, on the Bitbucket __Confirm access to your account__ page,
--     choose __Grant access__. (After you have connected to your Bitbucket
--     account, you do not need to finish creating the build project. You
--     can leave the CodeBuild console.) To instruct CodeBuild to use this
--     connection, in the @source@ object, set the @auth@ object\'s @type@
--     value to @OAUTH@.
--
-- If you specify @CODEPIPELINE@ for the @Type@ property, don\'t specify
-- this property. For all of the other types, you must specify @Location@.
--
-- 'reportBuildStatus', 'projectSource_reportBuildStatus' - Set to true to report the status of a build\'s start and finish to your
-- source provider. This option is valid only when your source provider is
-- GitHub, GitHub Enterprise, or Bitbucket. If this is set and you use a
-- different source provider, an @invalidInputException@ is thrown.
--
-- To be able to report the build status to the source provider, the user
-- associated with the source provider must have write access to the repo.
-- If the user does not have write access, the build status cannot be
-- updated. For more information, see
-- <https://docs.aws.amazon.com/codebuild/latest/userguide/access-tokens.html Source provider access>
-- in the /CodeBuild User Guide/.
--
-- The status of a build triggered by a webhook is always reported to your
-- source provider.
--
-- If your project\'s builds are triggered by a webhook, you must push a
-- new commit to the repo for a change to this property to take effect.
--
-- 'sourceIdentifier', 'projectSource_sourceIdentifier' - An identifier for this project source. The identifier can only contain
-- alphanumeric characters and underscores, and must be less than 128
-- characters in length.
--
-- 'type'', 'projectSource_type' - The type of repository that contains the source code to be built. Valid
-- values include:
--
-- -   @BITBUCKET@: The source code is in a Bitbucket repository.
--
-- -   @CODECOMMIT@: The source code is in an CodeCommit repository.
--
-- -   @CODEPIPELINE@: The source code settings are specified in the source
--     action of a pipeline in CodePipeline.
--
-- -   @GITHUB@: The source code is in a GitHub or GitHub Enterprise Cloud
--     repository.
--
-- -   @GITHUB_ENTERPRISE@: The source code is in a GitHub Enterprise
--     Server repository.
--
-- -   @NO_SOURCE@: The project does not have input source code.
--
-- -   @S3@: The source code is in an Amazon S3 bucket.
newProjectSource ::
  -- | 'type''
  SourceType ->
  ProjectSource
newProjectSource :: SourceType -> ProjectSource
newProjectSource SourceType
pType_ =
  ProjectSource'
    { $sel:auth:ProjectSource' :: Maybe SourceAuth
auth = forall a. Maybe a
Prelude.Nothing,
      $sel:buildStatusConfig:ProjectSource' :: Maybe BuildStatusConfig
buildStatusConfig = forall a. Maybe a
Prelude.Nothing,
      $sel:buildspec:ProjectSource' :: Maybe Text
buildspec = forall a. Maybe a
Prelude.Nothing,
      $sel:gitCloneDepth:ProjectSource' :: Maybe Natural
gitCloneDepth = forall a. Maybe a
Prelude.Nothing,
      $sel:gitSubmodulesConfig:ProjectSource' :: Maybe GitSubmodulesConfig
gitSubmodulesConfig = forall a. Maybe a
Prelude.Nothing,
      $sel:insecureSsl:ProjectSource' :: Maybe Bool
insecureSsl = forall a. Maybe a
Prelude.Nothing,
      $sel:location:ProjectSource' :: Maybe Text
location = forall a. Maybe a
Prelude.Nothing,
      $sel:reportBuildStatus:ProjectSource' :: Maybe Bool
reportBuildStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:sourceIdentifier:ProjectSource' :: Maybe Text
sourceIdentifier = forall a. Maybe a
Prelude.Nothing,
      $sel:type':ProjectSource' :: SourceType
type' = SourceType
pType_
    }

-- | Information about the authorization settings for CodeBuild to access the
-- source code to be built.
--
-- This information is for the CodeBuild console\'s use only. Your code
-- should not get or set this information directly.
projectSource_auth :: Lens.Lens' ProjectSource (Prelude.Maybe SourceAuth)
projectSource_auth :: Lens' ProjectSource (Maybe SourceAuth)
projectSource_auth = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectSource' {Maybe SourceAuth
auth :: Maybe SourceAuth
$sel:auth:ProjectSource' :: ProjectSource -> Maybe SourceAuth
auth} -> Maybe SourceAuth
auth) (\s :: ProjectSource
s@ProjectSource' {} Maybe SourceAuth
a -> ProjectSource
s {$sel:auth:ProjectSource' :: Maybe SourceAuth
auth = Maybe SourceAuth
a} :: ProjectSource)

-- | Contains information that defines how the build project reports the
-- build status to the source provider. This option is only used when the
-- source provider is @GITHUB@, @GITHUB_ENTERPRISE@, or @BITBUCKET@.
projectSource_buildStatusConfig :: Lens.Lens' ProjectSource (Prelude.Maybe BuildStatusConfig)
projectSource_buildStatusConfig :: Lens' ProjectSource (Maybe BuildStatusConfig)
projectSource_buildStatusConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectSource' {Maybe BuildStatusConfig
buildStatusConfig :: Maybe BuildStatusConfig
$sel:buildStatusConfig:ProjectSource' :: ProjectSource -> Maybe BuildStatusConfig
buildStatusConfig} -> Maybe BuildStatusConfig
buildStatusConfig) (\s :: ProjectSource
s@ProjectSource' {} Maybe BuildStatusConfig
a -> ProjectSource
s {$sel:buildStatusConfig:ProjectSource' :: Maybe BuildStatusConfig
buildStatusConfig = Maybe BuildStatusConfig
a} :: ProjectSource)

-- | The buildspec file declaration to use for the builds in this build
-- project.
--
-- If this value is set, it can be either an inline buildspec definition,
-- the path to an alternate buildspec file relative to the value of the
-- built-in @CODEBUILD_SRC_DIR@ environment variable, or the path to an S3
-- bucket. The bucket must be in the same Amazon Web Services Region as the
-- build project. Specify the buildspec file using its ARN (for example,
-- @arn:aws:s3:::my-codebuild-sample2\/buildspec.yml@). If this value is
-- not provided or is set to an empty string, the source code must contain
-- a buildspec file in its root directory. For more information, see
-- <https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec-ref-name-storage Buildspec File Name and Storage Location>.
projectSource_buildspec :: Lens.Lens' ProjectSource (Prelude.Maybe Prelude.Text)
projectSource_buildspec :: Lens' ProjectSource (Maybe Text)
projectSource_buildspec = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectSource' {Maybe Text
buildspec :: Maybe Text
$sel:buildspec:ProjectSource' :: ProjectSource -> Maybe Text
buildspec} -> Maybe Text
buildspec) (\s :: ProjectSource
s@ProjectSource' {} Maybe Text
a -> ProjectSource
s {$sel:buildspec:ProjectSource' :: Maybe Text
buildspec = Maybe Text
a} :: ProjectSource)

-- | Information about the Git clone depth for the build project.
projectSource_gitCloneDepth :: Lens.Lens' ProjectSource (Prelude.Maybe Prelude.Natural)
projectSource_gitCloneDepth :: Lens' ProjectSource (Maybe Natural)
projectSource_gitCloneDepth = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectSource' {Maybe Natural
gitCloneDepth :: Maybe Natural
$sel:gitCloneDepth:ProjectSource' :: ProjectSource -> Maybe Natural
gitCloneDepth} -> Maybe Natural
gitCloneDepth) (\s :: ProjectSource
s@ProjectSource' {} Maybe Natural
a -> ProjectSource
s {$sel:gitCloneDepth:ProjectSource' :: Maybe Natural
gitCloneDepth = Maybe Natural
a} :: ProjectSource)

-- | Information about the Git submodules configuration for the build
-- project.
projectSource_gitSubmodulesConfig :: Lens.Lens' ProjectSource (Prelude.Maybe GitSubmodulesConfig)
projectSource_gitSubmodulesConfig :: Lens' ProjectSource (Maybe GitSubmodulesConfig)
projectSource_gitSubmodulesConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectSource' {Maybe GitSubmodulesConfig
gitSubmodulesConfig :: Maybe GitSubmodulesConfig
$sel:gitSubmodulesConfig:ProjectSource' :: ProjectSource -> Maybe GitSubmodulesConfig
gitSubmodulesConfig} -> Maybe GitSubmodulesConfig
gitSubmodulesConfig) (\s :: ProjectSource
s@ProjectSource' {} Maybe GitSubmodulesConfig
a -> ProjectSource
s {$sel:gitSubmodulesConfig:ProjectSource' :: Maybe GitSubmodulesConfig
gitSubmodulesConfig = Maybe GitSubmodulesConfig
a} :: ProjectSource)

-- | Enable this flag to ignore SSL warnings while connecting to the project
-- source code.
projectSource_insecureSsl :: Lens.Lens' ProjectSource (Prelude.Maybe Prelude.Bool)
projectSource_insecureSsl :: Lens' ProjectSource (Maybe Bool)
projectSource_insecureSsl = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectSource' {Maybe Bool
insecureSsl :: Maybe Bool
$sel:insecureSsl:ProjectSource' :: ProjectSource -> Maybe Bool
insecureSsl} -> Maybe Bool
insecureSsl) (\s :: ProjectSource
s@ProjectSource' {} Maybe Bool
a -> ProjectSource
s {$sel:insecureSsl:ProjectSource' :: Maybe Bool
insecureSsl = Maybe Bool
a} :: ProjectSource)

-- | Information about the location of the source code to be built. Valid
-- values include:
--
-- -   For source code settings that are specified in the source action of
--     a pipeline in CodePipeline, @location@ should not be specified. If
--     it is specified, CodePipeline ignores it. This is because
--     CodePipeline uses the settings in a pipeline\'s source action
--     instead of this value.
--
-- -   For source code in an CodeCommit repository, the HTTPS clone URL to
--     the repository that contains the source code and the buildspec file
--     (for example,
--     @https:\/\/git-codecommit.\<region-ID>.amazonaws.com\/v1\/repos\/\<repo-name>@).
--
-- -   For source code in an Amazon S3 input bucket, one of the following.
--
--     -   The path to the ZIP file that contains the source code (for
--         example, @\<bucket-name>\/\<path>\/\<object-name>.zip@).
--
--     -   The path to the folder that contains the source code (for
--         example, @\<bucket-name>\/\<path-to-source-code>\/\<folder>\/@).
--
-- -   For source code in a GitHub repository, the HTTPS clone URL to the
--     repository that contains the source and the buildspec file. You must
--     connect your Amazon Web Services account to your GitHub account. Use
--     the CodeBuild console to start creating a build project. When you
--     use the console to connect (or reconnect) with GitHub, on the GitHub
--     __Authorize application__ page, for __Organization access__, choose
--     __Request access__ next to each repository you want to allow
--     CodeBuild to have access to, and then choose __Authorize
--     application__. (After you have connected to your GitHub account, you
--     do not need to finish creating the build project. You can leave the
--     CodeBuild console.) To instruct CodeBuild to use this connection, in
--     the @source@ object, set the @auth@ object\'s @type@ value to
--     @OAUTH@.
--
-- -   For source code in a Bitbucket repository, the HTTPS clone URL to
--     the repository that contains the source and the buildspec file. You
--     must connect your Amazon Web Services account to your Bitbucket
--     account. Use the CodeBuild console to start creating a build
--     project. When you use the console to connect (or reconnect) with
--     Bitbucket, on the Bitbucket __Confirm access to your account__ page,
--     choose __Grant access__. (After you have connected to your Bitbucket
--     account, you do not need to finish creating the build project. You
--     can leave the CodeBuild console.) To instruct CodeBuild to use this
--     connection, in the @source@ object, set the @auth@ object\'s @type@
--     value to @OAUTH@.
--
-- If you specify @CODEPIPELINE@ for the @Type@ property, don\'t specify
-- this property. For all of the other types, you must specify @Location@.
projectSource_location :: Lens.Lens' ProjectSource (Prelude.Maybe Prelude.Text)
projectSource_location :: Lens' ProjectSource (Maybe Text)
projectSource_location = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectSource' {Maybe Text
location :: Maybe Text
$sel:location:ProjectSource' :: ProjectSource -> Maybe Text
location} -> Maybe Text
location) (\s :: ProjectSource
s@ProjectSource' {} Maybe Text
a -> ProjectSource
s {$sel:location:ProjectSource' :: Maybe Text
location = Maybe Text
a} :: ProjectSource)

-- | Set to true to report the status of a build\'s start and finish to your
-- source provider. This option is valid only when your source provider is
-- GitHub, GitHub Enterprise, or Bitbucket. If this is set and you use a
-- different source provider, an @invalidInputException@ is thrown.
--
-- To be able to report the build status to the source provider, the user
-- associated with the source provider must have write access to the repo.
-- If the user does not have write access, the build status cannot be
-- updated. For more information, see
-- <https://docs.aws.amazon.com/codebuild/latest/userguide/access-tokens.html Source provider access>
-- in the /CodeBuild User Guide/.
--
-- The status of a build triggered by a webhook is always reported to your
-- source provider.
--
-- If your project\'s builds are triggered by a webhook, you must push a
-- new commit to the repo for a change to this property to take effect.
projectSource_reportBuildStatus :: Lens.Lens' ProjectSource (Prelude.Maybe Prelude.Bool)
projectSource_reportBuildStatus :: Lens' ProjectSource (Maybe Bool)
projectSource_reportBuildStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectSource' {Maybe Bool
reportBuildStatus :: Maybe Bool
$sel:reportBuildStatus:ProjectSource' :: ProjectSource -> Maybe Bool
reportBuildStatus} -> Maybe Bool
reportBuildStatus) (\s :: ProjectSource
s@ProjectSource' {} Maybe Bool
a -> ProjectSource
s {$sel:reportBuildStatus:ProjectSource' :: Maybe Bool
reportBuildStatus = Maybe Bool
a} :: ProjectSource)

-- | An identifier for this project source. The identifier can only contain
-- alphanumeric characters and underscores, and must be less than 128
-- characters in length.
projectSource_sourceIdentifier :: Lens.Lens' ProjectSource (Prelude.Maybe Prelude.Text)
projectSource_sourceIdentifier :: Lens' ProjectSource (Maybe Text)
projectSource_sourceIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectSource' {Maybe Text
sourceIdentifier :: Maybe Text
$sel:sourceIdentifier:ProjectSource' :: ProjectSource -> Maybe Text
sourceIdentifier} -> Maybe Text
sourceIdentifier) (\s :: ProjectSource
s@ProjectSource' {} Maybe Text
a -> ProjectSource
s {$sel:sourceIdentifier:ProjectSource' :: Maybe Text
sourceIdentifier = Maybe Text
a} :: ProjectSource)

-- | The type of repository that contains the source code to be built. Valid
-- values include:
--
-- -   @BITBUCKET@: The source code is in a Bitbucket repository.
--
-- -   @CODECOMMIT@: The source code is in an CodeCommit repository.
--
-- -   @CODEPIPELINE@: The source code settings are specified in the source
--     action of a pipeline in CodePipeline.
--
-- -   @GITHUB@: The source code is in a GitHub or GitHub Enterprise Cloud
--     repository.
--
-- -   @GITHUB_ENTERPRISE@: The source code is in a GitHub Enterprise
--     Server repository.
--
-- -   @NO_SOURCE@: The project does not have input source code.
--
-- -   @S3@: The source code is in an Amazon S3 bucket.
projectSource_type :: Lens.Lens' ProjectSource SourceType
projectSource_type :: Lens' ProjectSource SourceType
projectSource_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectSource' {SourceType
type' :: SourceType
$sel:type':ProjectSource' :: ProjectSource -> SourceType
type'} -> SourceType
type') (\s :: ProjectSource
s@ProjectSource' {} SourceType
a -> ProjectSource
s {$sel:type':ProjectSource' :: SourceType
type' = SourceType
a} :: ProjectSource)

instance Data.FromJSON ProjectSource where
  parseJSON :: Value -> Parser ProjectSource
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ProjectSource"
      ( \Object
x ->
          Maybe SourceAuth
-> Maybe BuildStatusConfig
-> Maybe Text
-> Maybe Natural
-> Maybe GitSubmodulesConfig
-> Maybe Bool
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> SourceType
-> ProjectSource
ProjectSource'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"auth")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"buildStatusConfig")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"buildspec")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"gitCloneDepth")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"gitSubmodulesConfig")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"insecureSsl")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"location")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"reportBuildStatus")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"sourceIdentifier")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"type")
      )

instance Prelude.Hashable ProjectSource where
  hashWithSalt :: Int -> ProjectSource -> Int
hashWithSalt Int
_salt ProjectSource' {Maybe Bool
Maybe Natural
Maybe Text
Maybe BuildStatusConfig
Maybe GitSubmodulesConfig
Maybe SourceAuth
SourceType
type' :: SourceType
sourceIdentifier :: Maybe Text
reportBuildStatus :: Maybe Bool
location :: Maybe Text
insecureSsl :: Maybe Bool
gitSubmodulesConfig :: Maybe GitSubmodulesConfig
gitCloneDepth :: Maybe Natural
buildspec :: Maybe Text
buildStatusConfig :: Maybe BuildStatusConfig
auth :: Maybe SourceAuth
$sel:type':ProjectSource' :: ProjectSource -> SourceType
$sel:sourceIdentifier:ProjectSource' :: ProjectSource -> Maybe Text
$sel:reportBuildStatus:ProjectSource' :: ProjectSource -> Maybe Bool
$sel:location:ProjectSource' :: ProjectSource -> Maybe Text
$sel:insecureSsl:ProjectSource' :: ProjectSource -> Maybe Bool
$sel:gitSubmodulesConfig:ProjectSource' :: ProjectSource -> Maybe GitSubmodulesConfig
$sel:gitCloneDepth:ProjectSource' :: ProjectSource -> Maybe Natural
$sel:buildspec:ProjectSource' :: ProjectSource -> Maybe Text
$sel:buildStatusConfig:ProjectSource' :: ProjectSource -> Maybe BuildStatusConfig
$sel:auth:ProjectSource' :: ProjectSource -> Maybe SourceAuth
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SourceAuth
auth
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe BuildStatusConfig
buildStatusConfig
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
buildspec
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
gitCloneDepth
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe GitSubmodulesConfig
gitSubmodulesConfig
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
insecureSsl
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
location
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
reportBuildStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sourceIdentifier
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` SourceType
type'

instance Prelude.NFData ProjectSource where
  rnf :: ProjectSource -> ()
rnf ProjectSource' {Maybe Bool
Maybe Natural
Maybe Text
Maybe BuildStatusConfig
Maybe GitSubmodulesConfig
Maybe SourceAuth
SourceType
type' :: SourceType
sourceIdentifier :: Maybe Text
reportBuildStatus :: Maybe Bool
location :: Maybe Text
insecureSsl :: Maybe Bool
gitSubmodulesConfig :: Maybe GitSubmodulesConfig
gitCloneDepth :: Maybe Natural
buildspec :: Maybe Text
buildStatusConfig :: Maybe BuildStatusConfig
auth :: Maybe SourceAuth
$sel:type':ProjectSource' :: ProjectSource -> SourceType
$sel:sourceIdentifier:ProjectSource' :: ProjectSource -> Maybe Text
$sel:reportBuildStatus:ProjectSource' :: ProjectSource -> Maybe Bool
$sel:location:ProjectSource' :: ProjectSource -> Maybe Text
$sel:insecureSsl:ProjectSource' :: ProjectSource -> Maybe Bool
$sel:gitSubmodulesConfig:ProjectSource' :: ProjectSource -> Maybe GitSubmodulesConfig
$sel:gitCloneDepth:ProjectSource' :: ProjectSource -> Maybe Natural
$sel:buildspec:ProjectSource' :: ProjectSource -> Maybe Text
$sel:buildStatusConfig:ProjectSource' :: ProjectSource -> Maybe BuildStatusConfig
$sel:auth:ProjectSource' :: ProjectSource -> Maybe SourceAuth
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe SourceAuth
auth
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe BuildStatusConfig
buildStatusConfig
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
buildspec
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
gitCloneDepth
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe GitSubmodulesConfig
gitSubmodulesConfig
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
insecureSsl
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
location
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
reportBuildStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sourceIdentifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf SourceType
type'

instance Data.ToJSON ProjectSource where
  toJSON :: ProjectSource -> Value
toJSON ProjectSource' {Maybe Bool
Maybe Natural
Maybe Text
Maybe BuildStatusConfig
Maybe GitSubmodulesConfig
Maybe SourceAuth
SourceType
type' :: SourceType
sourceIdentifier :: Maybe Text
reportBuildStatus :: Maybe Bool
location :: Maybe Text
insecureSsl :: Maybe Bool
gitSubmodulesConfig :: Maybe GitSubmodulesConfig
gitCloneDepth :: Maybe Natural
buildspec :: Maybe Text
buildStatusConfig :: Maybe BuildStatusConfig
auth :: Maybe SourceAuth
$sel:type':ProjectSource' :: ProjectSource -> SourceType
$sel:sourceIdentifier:ProjectSource' :: ProjectSource -> Maybe Text
$sel:reportBuildStatus:ProjectSource' :: ProjectSource -> Maybe Bool
$sel:location:ProjectSource' :: ProjectSource -> Maybe Text
$sel:insecureSsl:ProjectSource' :: ProjectSource -> Maybe Bool
$sel:gitSubmodulesConfig:ProjectSource' :: ProjectSource -> Maybe GitSubmodulesConfig
$sel:gitCloneDepth:ProjectSource' :: ProjectSource -> Maybe Natural
$sel:buildspec:ProjectSource' :: ProjectSource -> Maybe Text
$sel:buildStatusConfig:ProjectSource' :: ProjectSource -> Maybe BuildStatusConfig
$sel:auth:ProjectSource' :: ProjectSource -> Maybe SourceAuth
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"auth" 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 SourceAuth
auth,
            (Key
"buildStatusConfig" 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 BuildStatusConfig
buildStatusConfig,
            (Key
"buildspec" 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
buildspec,
            (Key
"gitCloneDepth" 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 Natural
gitCloneDepth,
            (Key
"gitSubmodulesConfig" 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 GitSubmodulesConfig
gitSubmodulesConfig,
            (Key
"insecureSsl" 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 Bool
insecureSsl,
            (Key
"location" 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
location,
            (Key
"reportBuildStatus" 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 Bool
reportBuildStatus,
            (Key
"sourceIdentifier" 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
sourceIdentifier,
            forall a. a -> Maybe a
Prelude.Just (Key
"type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= SourceType
type')
          ]
      )