{-# 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-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.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.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about the build input source code for the build project.
--
-- /See:/ 'newProjectSource' smart constructor.
data ProjectSource = 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 -> Maybe Bool
reportBuildStatus :: Prelude.Maybe Prelude.Bool,
    -- | 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,
    -- | 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,
    -- | 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,
    -- | 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,
    -- | 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,
    -- | 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 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
(ProjectSource -> ProjectSource -> Bool)
-> (ProjectSource -> ProjectSource -> Bool) -> Eq ProjectSource
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]
(Int -> ReadS ProjectSource)
-> ReadS [ProjectSource]
-> ReadPrec ProjectSource
-> ReadPrec [ProjectSource]
-> Read 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
(Int -> ProjectSource -> ShowS)
-> (ProjectSource -> String)
-> ([ProjectSource] -> ShowS)
-> Show ProjectSource
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. ProjectSource -> Rep ProjectSource x)
-> (forall x. Rep ProjectSource x -> ProjectSource)
-> Generic ProjectSource
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:
--
-- '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.
--
-- '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@.
--
-- '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.
--
-- '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>.
--
-- '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.
--
-- '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.
--
-- '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@.
--
-- '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' :: Maybe Bool
-> Maybe Bool
-> Maybe Text
-> Maybe SourceAuth
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe GitSubmodulesConfig
-> Maybe BuildStatusConfig
-> SourceType
-> ProjectSource
ProjectSource'
    { $sel:reportBuildStatus:ProjectSource' :: Maybe Bool
reportBuildStatus = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:insecureSsl:ProjectSource' :: Maybe Bool
insecureSsl = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:location:ProjectSource' :: Maybe Text
location = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:auth:ProjectSource' :: Maybe SourceAuth
auth = Maybe SourceAuth
forall a. Maybe a
Prelude.Nothing,
      $sel:buildspec:ProjectSource' :: Maybe Text
buildspec = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sourceIdentifier:ProjectSource' :: Maybe Text
sourceIdentifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:gitCloneDepth:ProjectSource' :: Maybe Natural
gitCloneDepth = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:gitSubmodulesConfig:ProjectSource' :: Maybe GitSubmodulesConfig
gitSubmodulesConfig = Maybe GitSubmodulesConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:buildStatusConfig:ProjectSource' :: Maybe BuildStatusConfig
buildStatusConfig = Maybe BuildStatusConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:type':ProjectSource' :: SourceType
type' = SourceType
pType_
    }

-- | 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 :: (Maybe Bool -> f (Maybe Bool)) -> ProjectSource -> f ProjectSource
projectSource_reportBuildStatus = (ProjectSource -> Maybe Bool)
-> (ProjectSource -> Maybe Bool -> ProjectSource)
-> Lens ProjectSource ProjectSource (Maybe Bool) (Maybe Bool)
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)

-- | 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 :: (Maybe Bool -> f (Maybe Bool)) -> ProjectSource -> f ProjectSource
projectSource_insecureSsl = (ProjectSource -> Maybe Bool)
-> (ProjectSource -> Maybe Bool -> ProjectSource)
-> Lens ProjectSource ProjectSource (Maybe Bool) (Maybe Bool)
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 :: (Maybe Text -> f (Maybe Text)) -> ProjectSource -> f ProjectSource
projectSource_location = (ProjectSource -> Maybe Text)
-> (ProjectSource -> Maybe Text -> ProjectSource)
-> Lens ProjectSource ProjectSource (Maybe Text) (Maybe Text)
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)

-- | 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 :: (Maybe SourceAuth -> f (Maybe SourceAuth))
-> ProjectSource -> f ProjectSource
projectSource_auth = (ProjectSource -> Maybe SourceAuth)
-> (ProjectSource -> Maybe SourceAuth -> ProjectSource)
-> Lens
     ProjectSource ProjectSource (Maybe SourceAuth) (Maybe SourceAuth)
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)

-- | 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 :: (Maybe Text -> f (Maybe Text)) -> ProjectSource -> f ProjectSource
projectSource_buildspec = (ProjectSource -> Maybe Text)
-> (ProjectSource -> Maybe Text -> ProjectSource)
-> Lens ProjectSource ProjectSource (Maybe Text) (Maybe Text)
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)

-- | 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 :: (Maybe Text -> f (Maybe Text)) -> ProjectSource -> f ProjectSource
projectSource_sourceIdentifier = (ProjectSource -> Maybe Text)
-> (ProjectSource -> Maybe Text -> ProjectSource)
-> Lens ProjectSource ProjectSource (Maybe Text) (Maybe Text)
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)

-- | Information about the Git clone depth for the build project.
projectSource_gitCloneDepth :: Lens.Lens' ProjectSource (Prelude.Maybe Prelude.Natural)
projectSource_gitCloneDepth :: (Maybe Natural -> f (Maybe Natural))
-> ProjectSource -> f ProjectSource
projectSource_gitCloneDepth = (ProjectSource -> Maybe Natural)
-> (ProjectSource -> Maybe Natural -> ProjectSource)
-> Lens ProjectSource ProjectSource (Maybe Natural) (Maybe Natural)
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 :: (Maybe GitSubmodulesConfig -> f (Maybe GitSubmodulesConfig))
-> ProjectSource -> f ProjectSource
projectSource_gitSubmodulesConfig = (ProjectSource -> Maybe GitSubmodulesConfig)
-> (ProjectSource -> Maybe GitSubmodulesConfig -> ProjectSource)
-> Lens
     ProjectSource
     ProjectSource
     (Maybe GitSubmodulesConfig)
     (Maybe 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)

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

instance Prelude.Hashable ProjectSource

instance Prelude.NFData ProjectSource

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