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

import Amazonka.CodeBuild.Types.ComputeType
import Amazonka.CodeBuild.Types.EnvironmentType
import Amazonka.CodeBuild.Types.EnvironmentVariable
import Amazonka.CodeBuild.Types.ImagePullCredentialsType
import Amazonka.CodeBuild.Types.RegistryCredential
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about the build environment of the build project.
--
-- /See:/ 'newProjectEnvironment' smart constructor.
data ProjectEnvironment = ProjectEnvironment'
  { -- | The type of credentials CodeBuild uses to pull images in your build.
    -- There are two valid values:
    --
    -- -   @CODEBUILD@ specifies that CodeBuild uses its own credentials. This
    --     requires that you modify your ECR repository policy to trust
    --     CodeBuild service principal.
    --
    -- -   @SERVICE_ROLE@ specifies that CodeBuild uses your build project\'s
    --     service role.
    --
    -- When you use a cross-account or private registry image, you must use
    -- SERVICE_ROLE credentials. When you use an CodeBuild curated image, you
    -- must use CODEBUILD credentials.
    ProjectEnvironment -> Maybe ImagePullCredentialsType
imagePullCredentialsType :: Prelude.Maybe ImagePullCredentialsType,
    -- | Enables running the Docker daemon inside a Docker container. Set to true
    -- only if the build project is used to build Docker images. Otherwise, a
    -- build that attempts to interact with the Docker daemon fails. The
    -- default setting is @false@.
    --
    -- You can initialize the Docker daemon during the install phase of your
    -- build by adding one of the following sets of commands to the install
    -- phase of your buildspec file:
    --
    -- If the operating system\'s base image is Ubuntu Linux:
    --
    -- @- nohup \/usr\/local\/bin\/dockerd --host=unix:\/\/\/var\/run\/docker.sock --host=tcp:\/\/0.0.0.0:2375 --storage-driver=overlay&@
    --
    -- @- timeout 15 sh -c \"until docker info; do echo .; sleep 1; done\"@
    --
    -- If the operating system\'s base image is Alpine Linux and the previous
    -- command does not work, add the @-t@ argument to @timeout@:
    --
    -- @- nohup \/usr\/local\/bin\/dockerd --host=unix:\/\/\/var\/run\/docker.sock --host=tcp:\/\/0.0.0.0:2375 --storage-driver=overlay&@
    --
    -- @- timeout -t 15 sh -c \"until docker info; do echo .; sleep 1; done\"@
    ProjectEnvironment -> Maybe Bool
privilegedMode :: Prelude.Maybe Prelude.Bool,
    -- | The credentials for access to a private registry.
    ProjectEnvironment -> Maybe RegistryCredential
registryCredential :: Prelude.Maybe RegistryCredential,
    -- | The ARN of the Amazon S3 bucket, path prefix, and object key that
    -- contains the PEM-encoded certificate for the build project. For more
    -- information, see
    -- <https://docs.aws.amazon.com/codebuild/latest/userguide/create-project-cli.html#cli.environment.certificate certificate>
    -- in the /CodeBuild User Guide/.
    ProjectEnvironment -> Maybe Text
certificate :: Prelude.Maybe Prelude.Text,
    -- | A set of environment variables to make available to builds for this
    -- build project.
    ProjectEnvironment -> Maybe [EnvironmentVariable]
environmentVariables :: Prelude.Maybe [EnvironmentVariable],
    -- | The type of build environment to use for related builds.
    --
    -- -   The environment type @ARM_CONTAINER@ is available only in regions US
    --     East (N. Virginia), US East (Ohio), US West (Oregon), EU (Ireland),
    --     Asia Pacific (Mumbai), Asia Pacific (Tokyo), Asia Pacific (Sydney),
    --     and EU (Frankfurt).
    --
    -- -   The environment type @LINUX_CONTAINER@ with compute type
    --     @build.general1.2xlarge@ is available only in regions US East (N.
    --     Virginia), US East (Ohio), US West (Oregon), Canada (Central), EU
    --     (Ireland), EU (London), EU (Frankfurt), Asia Pacific (Tokyo), Asia
    --     Pacific (Seoul), Asia Pacific (Singapore), Asia Pacific (Sydney),
    --     China (Beijing), and China (Ningxia).
    --
    -- -   The environment type @LINUX_GPU_CONTAINER@ is available only in
    --     regions US East (N. Virginia), US East (Ohio), US West (Oregon),
    --     Canada (Central), EU (Ireland), EU (London), EU (Frankfurt), Asia
    --     Pacific (Tokyo), Asia Pacific (Seoul), Asia Pacific (Singapore),
    --     Asia Pacific (Sydney) , China (Beijing), and China (Ningxia).
    --
    -- -   The environment types @WINDOWS_CONTAINER@ and
    --     @WINDOWS_SERVER_2019_CONTAINER@ are available only in regions US
    --     East (N. Virginia), US East (Ohio), US West (Oregon), and EU
    --     (Ireland).
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-compute-types.html Build environment compute types>
    -- in the /CodeBuild user guide/.
    ProjectEnvironment -> EnvironmentType
type' :: EnvironmentType,
    -- | The image tag or image digest that identifies the Docker image to use
    -- for this build project. Use the following formats:
    --
    -- -   For an image tag: @\<registry>\/\<repository>:\<tag>@. For example,
    --     in the Docker repository that CodeBuild uses to manage its Docker
    --     images, this would be @aws\/codebuild\/standard:4.0@.
    --
    -- -   For an image digest: @\<registry>\/\<repository>\@\<digest>@. For
    --     example, to specify an image with the digest
    --     \"sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf,\"
    --     use
    --     @\<registry>\/\<repository>\@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf@.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-available.html Docker images provided by CodeBuild>
    -- in the /CodeBuild user guide/.
    ProjectEnvironment -> Text
image :: Prelude.Text,
    -- | Information about the compute resources the build project uses.
    -- Available values include:
    --
    -- -   @BUILD_GENERAL1_SMALL@: Use up to 3 GB memory and 2 vCPUs for
    --     builds.
    --
    -- -   @BUILD_GENERAL1_MEDIUM@: Use up to 7 GB memory and 4 vCPUs for
    --     builds.
    --
    -- -   @BUILD_GENERAL1_LARGE@: Use up to 16 GB memory and 8 vCPUs for
    --     builds, depending on your environment type.
    --
    -- -   @BUILD_GENERAL1_2XLARGE@: Use up to 145 GB memory, 72 vCPUs, and 824
    --     GB of SSD storage for builds. This compute type supports Docker
    --     images up to 100 GB uncompressed.
    --
    -- If you use @BUILD_GENERAL1_LARGE@:
    --
    -- -   For environment type @LINUX_CONTAINER@, you can use up to 15 GB
    --     memory and 8 vCPUs for builds.
    --
    -- -   For environment type @LINUX_GPU_CONTAINER@, you can use up to 255 GB
    --     memory, 32 vCPUs, and 4 NVIDIA Tesla V100 GPUs for builds.
    --
    -- -   For environment type @ARM_CONTAINER@, you can use up to 16 GB memory
    --     and 8 vCPUs on ARM-based processors for builds.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-compute-types.html Build Environment Compute Types>
    -- in the /CodeBuild User Guide./
    ProjectEnvironment -> ComputeType
computeType :: ComputeType
  }
  deriving (ProjectEnvironment -> ProjectEnvironment -> Bool
(ProjectEnvironment -> ProjectEnvironment -> Bool)
-> (ProjectEnvironment -> ProjectEnvironment -> Bool)
-> Eq ProjectEnvironment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProjectEnvironment -> ProjectEnvironment -> Bool
$c/= :: ProjectEnvironment -> ProjectEnvironment -> Bool
== :: ProjectEnvironment -> ProjectEnvironment -> Bool
$c== :: ProjectEnvironment -> ProjectEnvironment -> Bool
Prelude.Eq, ReadPrec [ProjectEnvironment]
ReadPrec ProjectEnvironment
Int -> ReadS ProjectEnvironment
ReadS [ProjectEnvironment]
(Int -> ReadS ProjectEnvironment)
-> ReadS [ProjectEnvironment]
-> ReadPrec ProjectEnvironment
-> ReadPrec [ProjectEnvironment]
-> Read ProjectEnvironment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProjectEnvironment]
$creadListPrec :: ReadPrec [ProjectEnvironment]
readPrec :: ReadPrec ProjectEnvironment
$creadPrec :: ReadPrec ProjectEnvironment
readList :: ReadS [ProjectEnvironment]
$creadList :: ReadS [ProjectEnvironment]
readsPrec :: Int -> ReadS ProjectEnvironment
$creadsPrec :: Int -> ReadS ProjectEnvironment
Prelude.Read, Int -> ProjectEnvironment -> ShowS
[ProjectEnvironment] -> ShowS
ProjectEnvironment -> String
(Int -> ProjectEnvironment -> ShowS)
-> (ProjectEnvironment -> String)
-> ([ProjectEnvironment] -> ShowS)
-> Show ProjectEnvironment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProjectEnvironment] -> ShowS
$cshowList :: [ProjectEnvironment] -> ShowS
show :: ProjectEnvironment -> String
$cshow :: ProjectEnvironment -> String
showsPrec :: Int -> ProjectEnvironment -> ShowS
$cshowsPrec :: Int -> ProjectEnvironment -> ShowS
Prelude.Show, (forall x. ProjectEnvironment -> Rep ProjectEnvironment x)
-> (forall x. Rep ProjectEnvironment x -> ProjectEnvironment)
-> Generic ProjectEnvironment
forall x. Rep ProjectEnvironment x -> ProjectEnvironment
forall x. ProjectEnvironment -> Rep ProjectEnvironment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProjectEnvironment x -> ProjectEnvironment
$cfrom :: forall x. ProjectEnvironment -> Rep ProjectEnvironment x
Prelude.Generic)

-- |
-- Create a value of 'ProjectEnvironment' 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:
--
-- 'imagePullCredentialsType', 'projectEnvironment_imagePullCredentialsType' - The type of credentials CodeBuild uses to pull images in your build.
-- There are two valid values:
--
-- -   @CODEBUILD@ specifies that CodeBuild uses its own credentials. This
--     requires that you modify your ECR repository policy to trust
--     CodeBuild service principal.
--
-- -   @SERVICE_ROLE@ specifies that CodeBuild uses your build project\'s
--     service role.
--
-- When you use a cross-account or private registry image, you must use
-- SERVICE_ROLE credentials. When you use an CodeBuild curated image, you
-- must use CODEBUILD credentials.
--
-- 'privilegedMode', 'projectEnvironment_privilegedMode' - Enables running the Docker daemon inside a Docker container. Set to true
-- only if the build project is used to build Docker images. Otherwise, a
-- build that attempts to interact with the Docker daemon fails. The
-- default setting is @false@.
--
-- You can initialize the Docker daemon during the install phase of your
-- build by adding one of the following sets of commands to the install
-- phase of your buildspec file:
--
-- If the operating system\'s base image is Ubuntu Linux:
--
-- @- nohup \/usr\/local\/bin\/dockerd --host=unix:\/\/\/var\/run\/docker.sock --host=tcp:\/\/0.0.0.0:2375 --storage-driver=overlay&@
--
-- @- timeout 15 sh -c \"until docker info; do echo .; sleep 1; done\"@
--
-- If the operating system\'s base image is Alpine Linux and the previous
-- command does not work, add the @-t@ argument to @timeout@:
--
-- @- nohup \/usr\/local\/bin\/dockerd --host=unix:\/\/\/var\/run\/docker.sock --host=tcp:\/\/0.0.0.0:2375 --storage-driver=overlay&@
--
-- @- timeout -t 15 sh -c \"until docker info; do echo .; sleep 1; done\"@
--
-- 'registryCredential', 'projectEnvironment_registryCredential' - The credentials for access to a private registry.
--
-- 'certificate', 'projectEnvironment_certificate' - The ARN of the Amazon S3 bucket, path prefix, and object key that
-- contains the PEM-encoded certificate for the build project. For more
-- information, see
-- <https://docs.aws.amazon.com/codebuild/latest/userguide/create-project-cli.html#cli.environment.certificate certificate>
-- in the /CodeBuild User Guide/.
--
-- 'environmentVariables', 'projectEnvironment_environmentVariables' - A set of environment variables to make available to builds for this
-- build project.
--
-- 'type'', 'projectEnvironment_type' - The type of build environment to use for related builds.
--
-- -   The environment type @ARM_CONTAINER@ is available only in regions US
--     East (N. Virginia), US East (Ohio), US West (Oregon), EU (Ireland),
--     Asia Pacific (Mumbai), Asia Pacific (Tokyo), Asia Pacific (Sydney),
--     and EU (Frankfurt).
--
-- -   The environment type @LINUX_CONTAINER@ with compute type
--     @build.general1.2xlarge@ is available only in regions US East (N.
--     Virginia), US East (Ohio), US West (Oregon), Canada (Central), EU
--     (Ireland), EU (London), EU (Frankfurt), Asia Pacific (Tokyo), Asia
--     Pacific (Seoul), Asia Pacific (Singapore), Asia Pacific (Sydney),
--     China (Beijing), and China (Ningxia).
--
-- -   The environment type @LINUX_GPU_CONTAINER@ is available only in
--     regions US East (N. Virginia), US East (Ohio), US West (Oregon),
--     Canada (Central), EU (Ireland), EU (London), EU (Frankfurt), Asia
--     Pacific (Tokyo), Asia Pacific (Seoul), Asia Pacific (Singapore),
--     Asia Pacific (Sydney) , China (Beijing), and China (Ningxia).
--
-- -   The environment types @WINDOWS_CONTAINER@ and
--     @WINDOWS_SERVER_2019_CONTAINER@ are available only in regions US
--     East (N. Virginia), US East (Ohio), US West (Oregon), and EU
--     (Ireland).
--
-- For more information, see
-- <https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-compute-types.html Build environment compute types>
-- in the /CodeBuild user guide/.
--
-- 'image', 'projectEnvironment_image' - The image tag or image digest that identifies the Docker image to use
-- for this build project. Use the following formats:
--
-- -   For an image tag: @\<registry>\/\<repository>:\<tag>@. For example,
--     in the Docker repository that CodeBuild uses to manage its Docker
--     images, this would be @aws\/codebuild\/standard:4.0@.
--
-- -   For an image digest: @\<registry>\/\<repository>\@\<digest>@. For
--     example, to specify an image with the digest
--     \"sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf,\"
--     use
--     @\<registry>\/\<repository>\@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf@.
--
-- For more information, see
-- <https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-available.html Docker images provided by CodeBuild>
-- in the /CodeBuild user guide/.
--
-- 'computeType', 'projectEnvironment_computeType' - Information about the compute resources the build project uses.
-- Available values include:
--
-- -   @BUILD_GENERAL1_SMALL@: Use up to 3 GB memory and 2 vCPUs for
--     builds.
--
-- -   @BUILD_GENERAL1_MEDIUM@: Use up to 7 GB memory and 4 vCPUs for
--     builds.
--
-- -   @BUILD_GENERAL1_LARGE@: Use up to 16 GB memory and 8 vCPUs for
--     builds, depending on your environment type.
--
-- -   @BUILD_GENERAL1_2XLARGE@: Use up to 145 GB memory, 72 vCPUs, and 824
--     GB of SSD storage for builds. This compute type supports Docker
--     images up to 100 GB uncompressed.
--
-- If you use @BUILD_GENERAL1_LARGE@:
--
-- -   For environment type @LINUX_CONTAINER@, you can use up to 15 GB
--     memory and 8 vCPUs for builds.
--
-- -   For environment type @LINUX_GPU_CONTAINER@, you can use up to 255 GB
--     memory, 32 vCPUs, and 4 NVIDIA Tesla V100 GPUs for builds.
--
-- -   For environment type @ARM_CONTAINER@, you can use up to 16 GB memory
--     and 8 vCPUs on ARM-based processors for builds.
--
-- For more information, see
-- <https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-compute-types.html Build Environment Compute Types>
-- in the /CodeBuild User Guide./
newProjectEnvironment ::
  -- | 'type''
  EnvironmentType ->
  -- | 'image'
  Prelude.Text ->
  -- | 'computeType'
  ComputeType ->
  ProjectEnvironment
newProjectEnvironment :: EnvironmentType -> Text -> ComputeType -> ProjectEnvironment
newProjectEnvironment EnvironmentType
pType_ Text
pImage_ ComputeType
pComputeType_ =
  ProjectEnvironment' :: Maybe ImagePullCredentialsType
-> Maybe Bool
-> Maybe RegistryCredential
-> Maybe Text
-> Maybe [EnvironmentVariable]
-> EnvironmentType
-> Text
-> ComputeType
-> ProjectEnvironment
ProjectEnvironment'
    { $sel:imagePullCredentialsType:ProjectEnvironment' :: Maybe ImagePullCredentialsType
imagePullCredentialsType =
        Maybe ImagePullCredentialsType
forall a. Maybe a
Prelude.Nothing,
      $sel:privilegedMode:ProjectEnvironment' :: Maybe Bool
privilegedMode = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:registryCredential:ProjectEnvironment' :: Maybe RegistryCredential
registryCredential = Maybe RegistryCredential
forall a. Maybe a
Prelude.Nothing,
      $sel:certificate:ProjectEnvironment' :: Maybe Text
certificate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:environmentVariables:ProjectEnvironment' :: Maybe [EnvironmentVariable]
environmentVariables = Maybe [EnvironmentVariable]
forall a. Maybe a
Prelude.Nothing,
      $sel:type':ProjectEnvironment' :: EnvironmentType
type' = EnvironmentType
pType_,
      $sel:image:ProjectEnvironment' :: Text
image = Text
pImage_,
      $sel:computeType:ProjectEnvironment' :: ComputeType
computeType = ComputeType
pComputeType_
    }

-- | The type of credentials CodeBuild uses to pull images in your build.
-- There are two valid values:
--
-- -   @CODEBUILD@ specifies that CodeBuild uses its own credentials. This
--     requires that you modify your ECR repository policy to trust
--     CodeBuild service principal.
--
-- -   @SERVICE_ROLE@ specifies that CodeBuild uses your build project\'s
--     service role.
--
-- When you use a cross-account or private registry image, you must use
-- SERVICE_ROLE credentials. When you use an CodeBuild curated image, you
-- must use CODEBUILD credentials.
projectEnvironment_imagePullCredentialsType :: Lens.Lens' ProjectEnvironment (Prelude.Maybe ImagePullCredentialsType)
projectEnvironment_imagePullCredentialsType :: (Maybe ImagePullCredentialsType
 -> f (Maybe ImagePullCredentialsType))
-> ProjectEnvironment -> f ProjectEnvironment
projectEnvironment_imagePullCredentialsType = (ProjectEnvironment -> Maybe ImagePullCredentialsType)
-> (ProjectEnvironment
    -> Maybe ImagePullCredentialsType -> ProjectEnvironment)
-> Lens
     ProjectEnvironment
     ProjectEnvironment
     (Maybe ImagePullCredentialsType)
     (Maybe ImagePullCredentialsType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectEnvironment' {Maybe ImagePullCredentialsType
imagePullCredentialsType :: Maybe ImagePullCredentialsType
$sel:imagePullCredentialsType:ProjectEnvironment' :: ProjectEnvironment -> Maybe ImagePullCredentialsType
imagePullCredentialsType} -> Maybe ImagePullCredentialsType
imagePullCredentialsType) (\s :: ProjectEnvironment
s@ProjectEnvironment' {} Maybe ImagePullCredentialsType
a -> ProjectEnvironment
s {$sel:imagePullCredentialsType:ProjectEnvironment' :: Maybe ImagePullCredentialsType
imagePullCredentialsType = Maybe ImagePullCredentialsType
a} :: ProjectEnvironment)

-- | Enables running the Docker daemon inside a Docker container. Set to true
-- only if the build project is used to build Docker images. Otherwise, a
-- build that attempts to interact with the Docker daemon fails. The
-- default setting is @false@.
--
-- You can initialize the Docker daemon during the install phase of your
-- build by adding one of the following sets of commands to the install
-- phase of your buildspec file:
--
-- If the operating system\'s base image is Ubuntu Linux:
--
-- @- nohup \/usr\/local\/bin\/dockerd --host=unix:\/\/\/var\/run\/docker.sock --host=tcp:\/\/0.0.0.0:2375 --storage-driver=overlay&@
--
-- @- timeout 15 sh -c \"until docker info; do echo .; sleep 1; done\"@
--
-- If the operating system\'s base image is Alpine Linux and the previous
-- command does not work, add the @-t@ argument to @timeout@:
--
-- @- nohup \/usr\/local\/bin\/dockerd --host=unix:\/\/\/var\/run\/docker.sock --host=tcp:\/\/0.0.0.0:2375 --storage-driver=overlay&@
--
-- @- timeout -t 15 sh -c \"until docker info; do echo .; sleep 1; done\"@
projectEnvironment_privilegedMode :: Lens.Lens' ProjectEnvironment (Prelude.Maybe Prelude.Bool)
projectEnvironment_privilegedMode :: (Maybe Bool -> f (Maybe Bool))
-> ProjectEnvironment -> f ProjectEnvironment
projectEnvironment_privilegedMode = (ProjectEnvironment -> Maybe Bool)
-> (ProjectEnvironment -> Maybe Bool -> ProjectEnvironment)
-> Lens
     ProjectEnvironment ProjectEnvironment (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectEnvironment' {Maybe Bool
privilegedMode :: Maybe Bool
$sel:privilegedMode:ProjectEnvironment' :: ProjectEnvironment -> Maybe Bool
privilegedMode} -> Maybe Bool
privilegedMode) (\s :: ProjectEnvironment
s@ProjectEnvironment' {} Maybe Bool
a -> ProjectEnvironment
s {$sel:privilegedMode:ProjectEnvironment' :: Maybe Bool
privilegedMode = Maybe Bool
a} :: ProjectEnvironment)

-- | The credentials for access to a private registry.
projectEnvironment_registryCredential :: Lens.Lens' ProjectEnvironment (Prelude.Maybe RegistryCredential)
projectEnvironment_registryCredential :: (Maybe RegistryCredential -> f (Maybe RegistryCredential))
-> ProjectEnvironment -> f ProjectEnvironment
projectEnvironment_registryCredential = (ProjectEnvironment -> Maybe RegistryCredential)
-> (ProjectEnvironment
    -> Maybe RegistryCredential -> ProjectEnvironment)
-> Lens
     ProjectEnvironment
     ProjectEnvironment
     (Maybe RegistryCredential)
     (Maybe RegistryCredential)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectEnvironment' {Maybe RegistryCredential
registryCredential :: Maybe RegistryCredential
$sel:registryCredential:ProjectEnvironment' :: ProjectEnvironment -> Maybe RegistryCredential
registryCredential} -> Maybe RegistryCredential
registryCredential) (\s :: ProjectEnvironment
s@ProjectEnvironment' {} Maybe RegistryCredential
a -> ProjectEnvironment
s {$sel:registryCredential:ProjectEnvironment' :: Maybe RegistryCredential
registryCredential = Maybe RegistryCredential
a} :: ProjectEnvironment)

-- | The ARN of the Amazon S3 bucket, path prefix, and object key that
-- contains the PEM-encoded certificate for the build project. For more
-- information, see
-- <https://docs.aws.amazon.com/codebuild/latest/userguide/create-project-cli.html#cli.environment.certificate certificate>
-- in the /CodeBuild User Guide/.
projectEnvironment_certificate :: Lens.Lens' ProjectEnvironment (Prelude.Maybe Prelude.Text)
projectEnvironment_certificate :: (Maybe Text -> f (Maybe Text))
-> ProjectEnvironment -> f ProjectEnvironment
projectEnvironment_certificate = (ProjectEnvironment -> Maybe Text)
-> (ProjectEnvironment -> Maybe Text -> ProjectEnvironment)
-> Lens
     ProjectEnvironment ProjectEnvironment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectEnvironment' {Maybe Text
certificate :: Maybe Text
$sel:certificate:ProjectEnvironment' :: ProjectEnvironment -> Maybe Text
certificate} -> Maybe Text
certificate) (\s :: ProjectEnvironment
s@ProjectEnvironment' {} Maybe Text
a -> ProjectEnvironment
s {$sel:certificate:ProjectEnvironment' :: Maybe Text
certificate = Maybe Text
a} :: ProjectEnvironment)

-- | A set of environment variables to make available to builds for this
-- build project.
projectEnvironment_environmentVariables :: Lens.Lens' ProjectEnvironment (Prelude.Maybe [EnvironmentVariable])
projectEnvironment_environmentVariables :: (Maybe [EnvironmentVariable] -> f (Maybe [EnvironmentVariable]))
-> ProjectEnvironment -> f ProjectEnvironment
projectEnvironment_environmentVariables = (ProjectEnvironment -> Maybe [EnvironmentVariable])
-> (ProjectEnvironment
    -> Maybe [EnvironmentVariable] -> ProjectEnvironment)
-> Lens
     ProjectEnvironment
     ProjectEnvironment
     (Maybe [EnvironmentVariable])
     (Maybe [EnvironmentVariable])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectEnvironment' {Maybe [EnvironmentVariable]
environmentVariables :: Maybe [EnvironmentVariable]
$sel:environmentVariables:ProjectEnvironment' :: ProjectEnvironment -> Maybe [EnvironmentVariable]
environmentVariables} -> Maybe [EnvironmentVariable]
environmentVariables) (\s :: ProjectEnvironment
s@ProjectEnvironment' {} Maybe [EnvironmentVariable]
a -> ProjectEnvironment
s {$sel:environmentVariables:ProjectEnvironment' :: Maybe [EnvironmentVariable]
environmentVariables = Maybe [EnvironmentVariable]
a} :: ProjectEnvironment) ((Maybe [EnvironmentVariable] -> f (Maybe [EnvironmentVariable]))
 -> ProjectEnvironment -> f ProjectEnvironment)
-> ((Maybe [EnvironmentVariable]
     -> f (Maybe [EnvironmentVariable]))
    -> Maybe [EnvironmentVariable] -> f (Maybe [EnvironmentVariable]))
-> (Maybe [EnvironmentVariable] -> f (Maybe [EnvironmentVariable]))
-> ProjectEnvironment
-> f ProjectEnvironment
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [EnvironmentVariable]
  [EnvironmentVariable]
  [EnvironmentVariable]
  [EnvironmentVariable]
-> Iso
     (Maybe [EnvironmentVariable])
     (Maybe [EnvironmentVariable])
     (Maybe [EnvironmentVariable])
     (Maybe [EnvironmentVariable])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [EnvironmentVariable]
  [EnvironmentVariable]
  [EnvironmentVariable]
  [EnvironmentVariable]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The type of build environment to use for related builds.
--
-- -   The environment type @ARM_CONTAINER@ is available only in regions US
--     East (N. Virginia), US East (Ohio), US West (Oregon), EU (Ireland),
--     Asia Pacific (Mumbai), Asia Pacific (Tokyo), Asia Pacific (Sydney),
--     and EU (Frankfurt).
--
-- -   The environment type @LINUX_CONTAINER@ with compute type
--     @build.general1.2xlarge@ is available only in regions US East (N.
--     Virginia), US East (Ohio), US West (Oregon), Canada (Central), EU
--     (Ireland), EU (London), EU (Frankfurt), Asia Pacific (Tokyo), Asia
--     Pacific (Seoul), Asia Pacific (Singapore), Asia Pacific (Sydney),
--     China (Beijing), and China (Ningxia).
--
-- -   The environment type @LINUX_GPU_CONTAINER@ is available only in
--     regions US East (N. Virginia), US East (Ohio), US West (Oregon),
--     Canada (Central), EU (Ireland), EU (London), EU (Frankfurt), Asia
--     Pacific (Tokyo), Asia Pacific (Seoul), Asia Pacific (Singapore),
--     Asia Pacific (Sydney) , China (Beijing), and China (Ningxia).
--
-- -   The environment types @WINDOWS_CONTAINER@ and
--     @WINDOWS_SERVER_2019_CONTAINER@ are available only in regions US
--     East (N. Virginia), US East (Ohio), US West (Oregon), and EU
--     (Ireland).
--
-- For more information, see
-- <https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-compute-types.html Build environment compute types>
-- in the /CodeBuild user guide/.
projectEnvironment_type :: Lens.Lens' ProjectEnvironment EnvironmentType
projectEnvironment_type :: (EnvironmentType -> f EnvironmentType)
-> ProjectEnvironment -> f ProjectEnvironment
projectEnvironment_type = (ProjectEnvironment -> EnvironmentType)
-> (ProjectEnvironment -> EnvironmentType -> ProjectEnvironment)
-> Lens
     ProjectEnvironment
     ProjectEnvironment
     EnvironmentType
     EnvironmentType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectEnvironment' {EnvironmentType
type' :: EnvironmentType
$sel:type':ProjectEnvironment' :: ProjectEnvironment -> EnvironmentType
type'} -> EnvironmentType
type') (\s :: ProjectEnvironment
s@ProjectEnvironment' {} EnvironmentType
a -> ProjectEnvironment
s {$sel:type':ProjectEnvironment' :: EnvironmentType
type' = EnvironmentType
a} :: ProjectEnvironment)

-- | The image tag or image digest that identifies the Docker image to use
-- for this build project. Use the following formats:
--
-- -   For an image tag: @\<registry>\/\<repository>:\<tag>@. For example,
--     in the Docker repository that CodeBuild uses to manage its Docker
--     images, this would be @aws\/codebuild\/standard:4.0@.
--
-- -   For an image digest: @\<registry>\/\<repository>\@\<digest>@. For
--     example, to specify an image with the digest
--     \"sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf,\"
--     use
--     @\<registry>\/\<repository>\@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf@.
--
-- For more information, see
-- <https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-available.html Docker images provided by CodeBuild>
-- in the /CodeBuild user guide/.
projectEnvironment_image :: Lens.Lens' ProjectEnvironment Prelude.Text
projectEnvironment_image :: (Text -> f Text) -> ProjectEnvironment -> f ProjectEnvironment
projectEnvironment_image = (ProjectEnvironment -> Text)
-> (ProjectEnvironment -> Text -> ProjectEnvironment)
-> Lens ProjectEnvironment ProjectEnvironment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectEnvironment' {Text
image :: Text
$sel:image:ProjectEnvironment' :: ProjectEnvironment -> Text
image} -> Text
image) (\s :: ProjectEnvironment
s@ProjectEnvironment' {} Text
a -> ProjectEnvironment
s {$sel:image:ProjectEnvironment' :: Text
image = Text
a} :: ProjectEnvironment)

-- | Information about the compute resources the build project uses.
-- Available values include:
--
-- -   @BUILD_GENERAL1_SMALL@: Use up to 3 GB memory and 2 vCPUs for
--     builds.
--
-- -   @BUILD_GENERAL1_MEDIUM@: Use up to 7 GB memory and 4 vCPUs for
--     builds.
--
-- -   @BUILD_GENERAL1_LARGE@: Use up to 16 GB memory and 8 vCPUs for
--     builds, depending on your environment type.
--
-- -   @BUILD_GENERAL1_2XLARGE@: Use up to 145 GB memory, 72 vCPUs, and 824
--     GB of SSD storage for builds. This compute type supports Docker
--     images up to 100 GB uncompressed.
--
-- If you use @BUILD_GENERAL1_LARGE@:
--
-- -   For environment type @LINUX_CONTAINER@, you can use up to 15 GB
--     memory and 8 vCPUs for builds.
--
-- -   For environment type @LINUX_GPU_CONTAINER@, you can use up to 255 GB
--     memory, 32 vCPUs, and 4 NVIDIA Tesla V100 GPUs for builds.
--
-- -   For environment type @ARM_CONTAINER@, you can use up to 16 GB memory
--     and 8 vCPUs on ARM-based processors for builds.
--
-- For more information, see
-- <https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-compute-types.html Build Environment Compute Types>
-- in the /CodeBuild User Guide./
projectEnvironment_computeType :: Lens.Lens' ProjectEnvironment ComputeType
projectEnvironment_computeType :: (ComputeType -> f ComputeType)
-> ProjectEnvironment -> f ProjectEnvironment
projectEnvironment_computeType = (ProjectEnvironment -> ComputeType)
-> (ProjectEnvironment -> ComputeType -> ProjectEnvironment)
-> Lens
     ProjectEnvironment ProjectEnvironment ComputeType ComputeType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectEnvironment' {ComputeType
computeType :: ComputeType
$sel:computeType:ProjectEnvironment' :: ProjectEnvironment -> ComputeType
computeType} -> ComputeType
computeType) (\s :: ProjectEnvironment
s@ProjectEnvironment' {} ComputeType
a -> ProjectEnvironment
s {$sel:computeType:ProjectEnvironment' :: ComputeType
computeType = ComputeType
a} :: ProjectEnvironment)

instance Core.FromJSON ProjectEnvironment where
  parseJSON :: Value -> Parser ProjectEnvironment
parseJSON =
    String
-> (Object -> Parser ProjectEnvironment)
-> Value
-> Parser ProjectEnvironment
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ProjectEnvironment"
      ( \Object
x ->
          Maybe ImagePullCredentialsType
-> Maybe Bool
-> Maybe RegistryCredential
-> Maybe Text
-> Maybe [EnvironmentVariable]
-> EnvironmentType
-> Text
-> ComputeType
-> ProjectEnvironment
ProjectEnvironment'
            (Maybe ImagePullCredentialsType
 -> Maybe Bool
 -> Maybe RegistryCredential
 -> Maybe Text
 -> Maybe [EnvironmentVariable]
 -> EnvironmentType
 -> Text
 -> ComputeType
 -> ProjectEnvironment)
-> Parser (Maybe ImagePullCredentialsType)
-> Parser
     (Maybe Bool
      -> Maybe RegistryCredential
      -> Maybe Text
      -> Maybe [EnvironmentVariable]
      -> EnvironmentType
      -> Text
      -> ComputeType
      -> ProjectEnvironment)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ImagePullCredentialsType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"imagePullCredentialsType")
            Parser
  (Maybe Bool
   -> Maybe RegistryCredential
   -> Maybe Text
   -> Maybe [EnvironmentVariable]
   -> EnvironmentType
   -> Text
   -> ComputeType
   -> ProjectEnvironment)
-> Parser (Maybe Bool)
-> Parser
     (Maybe RegistryCredential
      -> Maybe Text
      -> Maybe [EnvironmentVariable]
      -> EnvironmentType
      -> Text
      -> ComputeType
      -> ProjectEnvironment)
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
"privilegedMode")
            Parser
  (Maybe RegistryCredential
   -> Maybe Text
   -> Maybe [EnvironmentVariable]
   -> EnvironmentType
   -> Text
   -> ComputeType
   -> ProjectEnvironment)
-> Parser (Maybe RegistryCredential)
-> Parser
     (Maybe Text
      -> Maybe [EnvironmentVariable]
      -> EnvironmentType
      -> Text
      -> ComputeType
      -> ProjectEnvironment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe RegistryCredential)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"registryCredential")
            Parser
  (Maybe Text
   -> Maybe [EnvironmentVariable]
   -> EnvironmentType
   -> Text
   -> ComputeType
   -> ProjectEnvironment)
-> Parser (Maybe Text)
-> Parser
     (Maybe [EnvironmentVariable]
      -> EnvironmentType -> Text -> ComputeType -> ProjectEnvironment)
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
"certificate")
            Parser
  (Maybe [EnvironmentVariable]
   -> EnvironmentType -> Text -> ComputeType -> ProjectEnvironment)
-> Parser (Maybe [EnvironmentVariable])
-> Parser
     (EnvironmentType -> Text -> ComputeType -> ProjectEnvironment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [EnvironmentVariable]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"environmentVariables"
                            Parser (Maybe (Maybe [EnvironmentVariable]))
-> Maybe [EnvironmentVariable]
-> Parser (Maybe [EnvironmentVariable])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [EnvironmentVariable]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (EnvironmentType -> Text -> ComputeType -> ProjectEnvironment)
-> Parser EnvironmentType
-> Parser (Text -> ComputeType -> ProjectEnvironment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser EnvironmentType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"type")
            Parser (Text -> ComputeType -> ProjectEnvironment)
-> Parser Text -> Parser (ComputeType -> ProjectEnvironment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"image")
            Parser (ComputeType -> ProjectEnvironment)
-> Parser ComputeType -> Parser ProjectEnvironment
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ComputeType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"computeType")
      )

instance Prelude.Hashable ProjectEnvironment

instance Prelude.NFData ProjectEnvironment

instance Core.ToJSON ProjectEnvironment where
  toJSON :: ProjectEnvironment -> Value
toJSON ProjectEnvironment' {Maybe Bool
Maybe [EnvironmentVariable]
Maybe Text
Maybe ImagePullCredentialsType
Maybe RegistryCredential
Text
ComputeType
EnvironmentType
computeType :: ComputeType
image :: Text
type' :: EnvironmentType
environmentVariables :: Maybe [EnvironmentVariable]
certificate :: Maybe Text
registryCredential :: Maybe RegistryCredential
privilegedMode :: Maybe Bool
imagePullCredentialsType :: Maybe ImagePullCredentialsType
$sel:computeType:ProjectEnvironment' :: ProjectEnvironment -> ComputeType
$sel:image:ProjectEnvironment' :: ProjectEnvironment -> Text
$sel:type':ProjectEnvironment' :: ProjectEnvironment -> EnvironmentType
$sel:environmentVariables:ProjectEnvironment' :: ProjectEnvironment -> Maybe [EnvironmentVariable]
$sel:certificate:ProjectEnvironment' :: ProjectEnvironment -> Maybe Text
$sel:registryCredential:ProjectEnvironment' :: ProjectEnvironment -> Maybe RegistryCredential
$sel:privilegedMode:ProjectEnvironment' :: ProjectEnvironment -> Maybe Bool
$sel:imagePullCredentialsType:ProjectEnvironment' :: ProjectEnvironment -> Maybe ImagePullCredentialsType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"imagePullCredentialsType" Text -> ImagePullCredentialsType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ImagePullCredentialsType -> Pair)
-> Maybe ImagePullCredentialsType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ImagePullCredentialsType
imagePullCredentialsType,
            (Text
"privilegedMode" 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
privilegedMode,
            (Text
"registryCredential" Text -> RegistryCredential -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (RegistryCredential -> Pair)
-> Maybe RegistryCredential -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RegistryCredential
registryCredential,
            (Text
"certificate" 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
certificate,
            (Text
"environmentVariables" Text -> [EnvironmentVariable] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([EnvironmentVariable] -> Pair)
-> Maybe [EnvironmentVariable] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [EnvironmentVariable]
environmentVariables,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"type" Text -> EnvironmentType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= EnvironmentType
type'),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"image" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
image),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"computeType" Text -> ComputeType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ComputeType
computeType)
          ]
      )