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

-- | Information about the build environment of the build project.
--
-- /See:/ 'newProjectEnvironment' smart constructor.
data ProjectEnvironment = 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 -> 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 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 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
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]
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
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. 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:
--
-- '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.
--
-- '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.
--
-- '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'
    { $sel:certificate:ProjectEnvironment' :: Maybe Text
certificate = forall a. Maybe a
Prelude.Nothing,
      $sel:environmentVariables:ProjectEnvironment' :: Maybe [EnvironmentVariable]
environmentVariables = forall a. Maybe a
Prelude.Nothing,
      $sel:imagePullCredentialsType:ProjectEnvironment' :: Maybe ImagePullCredentialsType
imagePullCredentialsType = forall a. Maybe a
Prelude.Nothing,
      $sel:privilegedMode:ProjectEnvironment' :: Maybe Bool
privilegedMode = forall a. Maybe a
Prelude.Nothing,
      $sel:registryCredential:ProjectEnvironment' :: Maybe RegistryCredential
registryCredential = 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 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 :: Lens' ProjectEnvironment (Maybe Text)
projectEnvironment_certificate = 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 :: Lens' ProjectEnvironment (Maybe [EnvironmentVariable])
projectEnvironment_environmentVariables = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: Lens' ProjectEnvironment (Maybe ImagePullCredentialsType)
projectEnvironment_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 :: Lens' ProjectEnvironment (Maybe Bool)
projectEnvironment_privilegedMode = 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 :: Lens' ProjectEnvironment (Maybe RegistryCredential)
projectEnvironment_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 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 :: Lens' ProjectEnvironment EnvironmentType
projectEnvironment_type = 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 :: Lens' ProjectEnvironment Text
projectEnvironment_image = 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 :: Lens' ProjectEnvironment ComputeType
projectEnvironment_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 Data.FromJSON ProjectEnvironment where
  parseJSON :: Value -> Parser ProjectEnvironment
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ProjectEnvironment"
      ( \Object
x ->
          Maybe Text
-> Maybe [EnvironmentVariable]
-> Maybe ImagePullCredentialsType
-> Maybe Bool
-> Maybe RegistryCredential
-> EnvironmentType
-> Text
-> ComputeType
-> ProjectEnvironment
ProjectEnvironment'
            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
"certificate")
            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
"environmentVariables"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"imagePullCredentialsType")
            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
"privilegedMode")
            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
"registryCredential")
            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")
            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
"image")
            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
"computeType")
      )

instance Prelude.Hashable ProjectEnvironment where
  hashWithSalt :: Int -> ProjectEnvironment -> Int
hashWithSalt Int
_salt ProjectEnvironment' {Maybe Bool
Maybe [EnvironmentVariable]
Maybe Text
Maybe ImagePullCredentialsType
Maybe RegistryCredential
Text
ComputeType
EnvironmentType
computeType :: ComputeType
image :: Text
type' :: EnvironmentType
registryCredential :: Maybe RegistryCredential
privilegedMode :: Maybe Bool
imagePullCredentialsType :: Maybe ImagePullCredentialsType
environmentVariables :: Maybe [EnvironmentVariable]
certificate :: Maybe Text
$sel:computeType:ProjectEnvironment' :: ProjectEnvironment -> ComputeType
$sel:image:ProjectEnvironment' :: ProjectEnvironment -> Text
$sel:type':ProjectEnvironment' :: ProjectEnvironment -> EnvironmentType
$sel:registryCredential:ProjectEnvironment' :: ProjectEnvironment -> Maybe RegistryCredential
$sel:privilegedMode:ProjectEnvironment' :: ProjectEnvironment -> Maybe Bool
$sel:imagePullCredentialsType:ProjectEnvironment' :: ProjectEnvironment -> Maybe ImagePullCredentialsType
$sel:environmentVariables:ProjectEnvironment' :: ProjectEnvironment -> Maybe [EnvironmentVariable]
$sel:certificate:ProjectEnvironment' :: ProjectEnvironment -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
certificate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [EnvironmentVariable]
environmentVariables
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ImagePullCredentialsType
imagePullCredentialsType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
privilegedMode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RegistryCredential
registryCredential
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` EnvironmentType
type'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
image
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ComputeType
computeType

instance Prelude.NFData ProjectEnvironment where
  rnf :: ProjectEnvironment -> ()
rnf ProjectEnvironment' {Maybe Bool
Maybe [EnvironmentVariable]
Maybe Text
Maybe ImagePullCredentialsType
Maybe RegistryCredential
Text
ComputeType
EnvironmentType
computeType :: ComputeType
image :: Text
type' :: EnvironmentType
registryCredential :: Maybe RegistryCredential
privilegedMode :: Maybe Bool
imagePullCredentialsType :: Maybe ImagePullCredentialsType
environmentVariables :: Maybe [EnvironmentVariable]
certificate :: Maybe Text
$sel:computeType:ProjectEnvironment' :: ProjectEnvironment -> ComputeType
$sel:image:ProjectEnvironment' :: ProjectEnvironment -> Text
$sel:type':ProjectEnvironment' :: ProjectEnvironment -> EnvironmentType
$sel:registryCredential:ProjectEnvironment' :: ProjectEnvironment -> Maybe RegistryCredential
$sel:privilegedMode:ProjectEnvironment' :: ProjectEnvironment -> Maybe Bool
$sel:imagePullCredentialsType:ProjectEnvironment' :: ProjectEnvironment -> Maybe ImagePullCredentialsType
$sel:environmentVariables:ProjectEnvironment' :: ProjectEnvironment -> Maybe [EnvironmentVariable]
$sel:certificate:ProjectEnvironment' :: ProjectEnvironment -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
certificate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [EnvironmentVariable]
environmentVariables
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ImagePullCredentialsType
imagePullCredentialsType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
privilegedMode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RegistryCredential
registryCredential
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf EnvironmentType
type'
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
image
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ComputeType
computeType

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