{-# 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.ElasticBeanstalk.Types.BuildConfiguration
-- 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.ElasticBeanstalk.Types.BuildConfiguration where

import qualified Amazonka.Core as Core
import Amazonka.ElasticBeanstalk.Types.ComputeType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Settings for an AWS CodeBuild build.
--
-- /See:/ 'newBuildConfiguration' smart constructor.
data BuildConfiguration = BuildConfiguration'
  { -- | The name of the artifact of the CodeBuild build. If provided, Elastic
    -- Beanstalk stores the build artifact in the S3 location
    -- /S3-bucket/\/resources\//application-name/\/codebuild\/codebuild-/version-label/-/artifact-name/.zip.
    -- If not provided, Elastic Beanstalk stores the build artifact in the S3
    -- location
    -- /S3-bucket/\/resources\//application-name/\/codebuild\/codebuild-/version-label/.zip.
    BuildConfiguration -> Maybe Text
artifactName :: Prelude.Maybe Prelude.Text,
    -- | Information about the compute resources the build project will use.
    --
    -- -   @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 15 GB memory and 8 vCPUs for builds@
    BuildConfiguration -> Maybe ComputeType
computeType :: Prelude.Maybe ComputeType,
    -- | How long in minutes, from 5 to 480 (8 hours), for AWS CodeBuild to wait
    -- until timing out any related build that does not get marked as
    -- completed. The default is 60 minutes.
    BuildConfiguration -> Maybe Int
timeoutInMinutes :: Prelude.Maybe Prelude.Int,
    -- | The Amazon Resource Name (ARN) of the AWS Identity and Access Management
    -- (IAM) role that enables AWS CodeBuild to interact with dependent AWS
    -- services on behalf of the AWS account.
    BuildConfiguration -> Text
codeBuildServiceRole :: Prelude.Text,
    -- | The ID of the Docker image to use for this build project.
    BuildConfiguration -> Text
image :: Prelude.Text
  }
  deriving (BuildConfiguration -> BuildConfiguration -> Bool
(BuildConfiguration -> BuildConfiguration -> Bool)
-> (BuildConfiguration -> BuildConfiguration -> Bool)
-> Eq BuildConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BuildConfiguration -> BuildConfiguration -> Bool
$c/= :: BuildConfiguration -> BuildConfiguration -> Bool
== :: BuildConfiguration -> BuildConfiguration -> Bool
$c== :: BuildConfiguration -> BuildConfiguration -> Bool
Prelude.Eq, ReadPrec [BuildConfiguration]
ReadPrec BuildConfiguration
Int -> ReadS BuildConfiguration
ReadS [BuildConfiguration]
(Int -> ReadS BuildConfiguration)
-> ReadS [BuildConfiguration]
-> ReadPrec BuildConfiguration
-> ReadPrec [BuildConfiguration]
-> Read BuildConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BuildConfiguration]
$creadListPrec :: ReadPrec [BuildConfiguration]
readPrec :: ReadPrec BuildConfiguration
$creadPrec :: ReadPrec BuildConfiguration
readList :: ReadS [BuildConfiguration]
$creadList :: ReadS [BuildConfiguration]
readsPrec :: Int -> ReadS BuildConfiguration
$creadsPrec :: Int -> ReadS BuildConfiguration
Prelude.Read, Int -> BuildConfiguration -> ShowS
[BuildConfiguration] -> ShowS
BuildConfiguration -> String
(Int -> BuildConfiguration -> ShowS)
-> (BuildConfiguration -> String)
-> ([BuildConfiguration] -> ShowS)
-> Show BuildConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BuildConfiguration] -> ShowS
$cshowList :: [BuildConfiguration] -> ShowS
show :: BuildConfiguration -> String
$cshow :: BuildConfiguration -> String
showsPrec :: Int -> BuildConfiguration -> ShowS
$cshowsPrec :: Int -> BuildConfiguration -> ShowS
Prelude.Show, (forall x. BuildConfiguration -> Rep BuildConfiguration x)
-> (forall x. Rep BuildConfiguration x -> BuildConfiguration)
-> Generic BuildConfiguration
forall x. Rep BuildConfiguration x -> BuildConfiguration
forall x. BuildConfiguration -> Rep BuildConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BuildConfiguration x -> BuildConfiguration
$cfrom :: forall x. BuildConfiguration -> Rep BuildConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'BuildConfiguration' 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:
--
-- 'artifactName', 'buildConfiguration_artifactName' - The name of the artifact of the CodeBuild build. If provided, Elastic
-- Beanstalk stores the build artifact in the S3 location
-- /S3-bucket/\/resources\//application-name/\/codebuild\/codebuild-/version-label/-/artifact-name/.zip.
-- If not provided, Elastic Beanstalk stores the build artifact in the S3
-- location
-- /S3-bucket/\/resources\//application-name/\/codebuild\/codebuild-/version-label/.zip.
--
-- 'computeType', 'buildConfiguration_computeType' - Information about the compute resources the build project will use.
--
-- -   @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 15 GB memory and 8 vCPUs for builds@
--
-- 'timeoutInMinutes', 'buildConfiguration_timeoutInMinutes' - How long in minutes, from 5 to 480 (8 hours), for AWS CodeBuild to wait
-- until timing out any related build that does not get marked as
-- completed. The default is 60 minutes.
--
-- 'codeBuildServiceRole', 'buildConfiguration_codeBuildServiceRole' - The Amazon Resource Name (ARN) of the AWS Identity and Access Management
-- (IAM) role that enables AWS CodeBuild to interact with dependent AWS
-- services on behalf of the AWS account.
--
-- 'image', 'buildConfiguration_image' - The ID of the Docker image to use for this build project.
newBuildConfiguration ::
  -- | 'codeBuildServiceRole'
  Prelude.Text ->
  -- | 'image'
  Prelude.Text ->
  BuildConfiguration
newBuildConfiguration :: Text -> Text -> BuildConfiguration
newBuildConfiguration Text
pCodeBuildServiceRole_ Text
pImage_ =
  BuildConfiguration' :: Maybe Text
-> Maybe ComputeType
-> Maybe Int
-> Text
-> Text
-> BuildConfiguration
BuildConfiguration'
    { $sel:artifactName:BuildConfiguration' :: Maybe Text
artifactName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:computeType:BuildConfiguration' :: Maybe ComputeType
computeType = Maybe ComputeType
forall a. Maybe a
Prelude.Nothing,
      $sel:timeoutInMinutes:BuildConfiguration' :: Maybe Int
timeoutInMinutes = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:codeBuildServiceRole:BuildConfiguration' :: Text
codeBuildServiceRole = Text
pCodeBuildServiceRole_,
      $sel:image:BuildConfiguration' :: Text
image = Text
pImage_
    }

-- | The name of the artifact of the CodeBuild build. If provided, Elastic
-- Beanstalk stores the build artifact in the S3 location
-- /S3-bucket/\/resources\//application-name/\/codebuild\/codebuild-/version-label/-/artifact-name/.zip.
-- If not provided, Elastic Beanstalk stores the build artifact in the S3
-- location
-- /S3-bucket/\/resources\//application-name/\/codebuild\/codebuild-/version-label/.zip.
buildConfiguration_artifactName :: Lens.Lens' BuildConfiguration (Prelude.Maybe Prelude.Text)
buildConfiguration_artifactName :: (Maybe Text -> f (Maybe Text))
-> BuildConfiguration -> f BuildConfiguration
buildConfiguration_artifactName = (BuildConfiguration -> Maybe Text)
-> (BuildConfiguration -> Maybe Text -> BuildConfiguration)
-> Lens
     BuildConfiguration BuildConfiguration (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BuildConfiguration' {Maybe Text
artifactName :: Maybe Text
$sel:artifactName:BuildConfiguration' :: BuildConfiguration -> Maybe Text
artifactName} -> Maybe Text
artifactName) (\s :: BuildConfiguration
s@BuildConfiguration' {} Maybe Text
a -> BuildConfiguration
s {$sel:artifactName:BuildConfiguration' :: Maybe Text
artifactName = Maybe Text
a} :: BuildConfiguration)

-- | Information about the compute resources the build project will use.
--
-- -   @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 15 GB memory and 8 vCPUs for builds@
buildConfiguration_computeType :: Lens.Lens' BuildConfiguration (Prelude.Maybe ComputeType)
buildConfiguration_computeType :: (Maybe ComputeType -> f (Maybe ComputeType))
-> BuildConfiguration -> f BuildConfiguration
buildConfiguration_computeType = (BuildConfiguration -> Maybe ComputeType)
-> (BuildConfiguration -> Maybe ComputeType -> BuildConfiguration)
-> Lens
     BuildConfiguration
     BuildConfiguration
     (Maybe ComputeType)
     (Maybe ComputeType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BuildConfiguration' {Maybe ComputeType
computeType :: Maybe ComputeType
$sel:computeType:BuildConfiguration' :: BuildConfiguration -> Maybe ComputeType
computeType} -> Maybe ComputeType
computeType) (\s :: BuildConfiguration
s@BuildConfiguration' {} Maybe ComputeType
a -> BuildConfiguration
s {$sel:computeType:BuildConfiguration' :: Maybe ComputeType
computeType = Maybe ComputeType
a} :: BuildConfiguration)

-- | How long in minutes, from 5 to 480 (8 hours), for AWS CodeBuild to wait
-- until timing out any related build that does not get marked as
-- completed. The default is 60 minutes.
buildConfiguration_timeoutInMinutes :: Lens.Lens' BuildConfiguration (Prelude.Maybe Prelude.Int)
buildConfiguration_timeoutInMinutes :: (Maybe Int -> f (Maybe Int))
-> BuildConfiguration -> f BuildConfiguration
buildConfiguration_timeoutInMinutes = (BuildConfiguration -> Maybe Int)
-> (BuildConfiguration -> Maybe Int -> BuildConfiguration)
-> Lens
     BuildConfiguration BuildConfiguration (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BuildConfiguration' {Maybe Int
timeoutInMinutes :: Maybe Int
$sel:timeoutInMinutes:BuildConfiguration' :: BuildConfiguration -> Maybe Int
timeoutInMinutes} -> Maybe Int
timeoutInMinutes) (\s :: BuildConfiguration
s@BuildConfiguration' {} Maybe Int
a -> BuildConfiguration
s {$sel:timeoutInMinutes:BuildConfiguration' :: Maybe Int
timeoutInMinutes = Maybe Int
a} :: BuildConfiguration)

-- | The Amazon Resource Name (ARN) of the AWS Identity and Access Management
-- (IAM) role that enables AWS CodeBuild to interact with dependent AWS
-- services on behalf of the AWS account.
buildConfiguration_codeBuildServiceRole :: Lens.Lens' BuildConfiguration Prelude.Text
buildConfiguration_codeBuildServiceRole :: (Text -> f Text) -> BuildConfiguration -> f BuildConfiguration
buildConfiguration_codeBuildServiceRole = (BuildConfiguration -> Text)
-> (BuildConfiguration -> Text -> BuildConfiguration)
-> Lens BuildConfiguration BuildConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BuildConfiguration' {Text
codeBuildServiceRole :: Text
$sel:codeBuildServiceRole:BuildConfiguration' :: BuildConfiguration -> Text
codeBuildServiceRole} -> Text
codeBuildServiceRole) (\s :: BuildConfiguration
s@BuildConfiguration' {} Text
a -> BuildConfiguration
s {$sel:codeBuildServiceRole:BuildConfiguration' :: Text
codeBuildServiceRole = Text
a} :: BuildConfiguration)

-- | The ID of the Docker image to use for this build project.
buildConfiguration_image :: Lens.Lens' BuildConfiguration Prelude.Text
buildConfiguration_image :: (Text -> f Text) -> BuildConfiguration -> f BuildConfiguration
buildConfiguration_image = (BuildConfiguration -> Text)
-> (BuildConfiguration -> Text -> BuildConfiguration)
-> Lens BuildConfiguration BuildConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BuildConfiguration' {Text
image :: Text
$sel:image:BuildConfiguration' :: BuildConfiguration -> Text
image} -> Text
image) (\s :: BuildConfiguration
s@BuildConfiguration' {} Text
a -> BuildConfiguration
s {$sel:image:BuildConfiguration' :: Text
image = Text
a} :: BuildConfiguration)

instance Prelude.Hashable BuildConfiguration

instance Prelude.NFData BuildConfiguration

instance Core.ToQuery BuildConfiguration where
  toQuery :: BuildConfiguration -> QueryString
toQuery BuildConfiguration' {Maybe Int
Maybe Text
Maybe ComputeType
Text
image :: Text
codeBuildServiceRole :: Text
timeoutInMinutes :: Maybe Int
computeType :: Maybe ComputeType
artifactName :: Maybe Text
$sel:image:BuildConfiguration' :: BuildConfiguration -> Text
$sel:codeBuildServiceRole:BuildConfiguration' :: BuildConfiguration -> Text
$sel:timeoutInMinutes:BuildConfiguration' :: BuildConfiguration -> Maybe Int
$sel:computeType:BuildConfiguration' :: BuildConfiguration -> Maybe ComputeType
$sel:artifactName:BuildConfiguration' :: BuildConfiguration -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"ArtifactName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
artifactName,
        ByteString
"ComputeType" ByteString -> Maybe ComputeType -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe ComputeType
computeType,
        ByteString
"TimeoutInMinutes" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
timeoutInMinutes,
        ByteString
"CodeBuildServiceRole" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
codeBuildServiceRole,
        ByteString
"Image" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
image
      ]