{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Proton.CreateEnvironment
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deploy a new environment. An Proton environment is created from an
-- environment template that defines infrastructure and resources that can
-- be shared across services.
--
-- __You can provision environments using the following methods:__
--
-- -   Amazon Web Services-managed provisioning: Proton makes direct calls
--     to provision your resources.
--
-- -   Self-managed provisioning: Proton makes pull requests on your
--     repository to provide compiled infrastructure as code (IaC) files
--     that your IaC engine uses to provision resources.
--
-- For more information, see
-- <https://docs.aws.amazon.com/proton/latest/userguide/ag-environments.html Environments>
-- and
-- <https://docs.aws.amazon.com/proton/latest/userguide/ag-works-prov-methods.html Provisioning methods>
-- in the /Proton User Guide/.
module Amazonka.Proton.CreateEnvironment
  ( -- * Creating a Request
    CreateEnvironment (..),
    newCreateEnvironment,

    -- * Request Lenses
    createEnvironment_codebuildRoleArn,
    createEnvironment_componentRoleArn,
    createEnvironment_description,
    createEnvironment_environmentAccountConnectionId,
    createEnvironment_protonServiceRoleArn,
    createEnvironment_provisioningRepository,
    createEnvironment_tags,
    createEnvironment_templateMinorVersion,
    createEnvironment_name,
    createEnvironment_spec,
    createEnvironment_templateMajorVersion,
    createEnvironment_templateName,

    -- * Destructuring the Response
    CreateEnvironmentResponse (..),
    newCreateEnvironmentResponse,

    -- * Response Lenses
    createEnvironmentResponse_httpStatus,
    createEnvironmentResponse_environment,
  )
where

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
import Amazonka.Proton.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateEnvironment' smart constructor.
data CreateEnvironment = CreateEnvironment'
  { -- | The Amazon Resource Name (ARN) of the IAM service role that allows
    -- Proton to provision infrastructure using CodeBuild-based provisioning on
    -- your behalf.
    --
    -- To use CodeBuild-based provisioning for the environment or for any
    -- service instance running in the environment, specify either the
    -- @environmentAccountConnectionId@ or @codebuildRoleArn@ parameter.
    CreateEnvironment -> Maybe Text
codebuildRoleArn :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the IAM service role that Proton uses
    -- when provisioning directly defined components in this environment. It
    -- determines the scope of infrastructure that a component can provision.
    --
    -- You must specify @componentRoleArn@ to allow directly defined components
    -- to be associated with this environment.
    --
    -- For more information about components, see
    -- <https://docs.aws.amazon.com/proton/latest/userguide/ag-components.html Proton components>
    -- in the /Proton User Guide/.
    CreateEnvironment -> Maybe Text
componentRoleArn :: Prelude.Maybe Prelude.Text,
    -- | A description of the environment that\'s being created and deployed.
    CreateEnvironment -> Maybe (Sensitive Text)
description :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | The ID of the environment account connection that you provide if you\'re
    -- provisioning your environment infrastructure resources to an environment
    -- account. For more information, see
    -- <https://docs.aws.amazon.com/proton/latest/userguide/ag-env-account-connections.html Environment account connections>
    -- in the /Proton User guide/.
    --
    -- To use Amazon Web Services-managed provisioning for the environment,
    -- specify either the @environmentAccountConnectionId@ or
    -- @protonServiceRoleArn@ parameter and omit the @provisioningRepository@
    -- parameter.
    CreateEnvironment -> Maybe Text
environmentAccountConnectionId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the Proton service role that allows
    -- Proton to make calls to other services on your behalf.
    --
    -- To use Amazon Web Services-managed provisioning for the environment,
    -- specify either the @environmentAccountConnectionId@ or
    -- @protonServiceRoleArn@ parameter and omit the @provisioningRepository@
    -- parameter.
    CreateEnvironment -> Maybe Text
protonServiceRoleArn :: Prelude.Maybe Prelude.Text,
    -- | The linked repository that you use to host your rendered infrastructure
    -- templates for self-managed provisioning. A linked repository is a
    -- repository that has been registered with Proton. For more information,
    -- see CreateRepository.
    --
    -- To use self-managed provisioning for the environment, specify this
    -- parameter and omit the @environmentAccountConnectionId@ and
    -- @protonServiceRoleArn@ parameters.
    CreateEnvironment -> Maybe RepositoryBranchInput
provisioningRepository :: Prelude.Maybe RepositoryBranchInput,
    -- | An optional list of metadata items that you can associate with the
    -- Proton environment. A tag is a key-value pair.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/proton/latest/userguide/resources.html Proton resources and tagging>
    -- in the /Proton User Guide/.
    CreateEnvironment -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The minor version of the environment template.
    CreateEnvironment -> Maybe Text
templateMinorVersion :: Prelude.Maybe Prelude.Text,
    -- | The name of the environment.
    CreateEnvironment -> Text
name :: Prelude.Text,
    -- | A YAML formatted string that provides inputs as defined in the
    -- environment template bundle schema file. For more information, see
    -- <https://docs.aws.amazon.com/proton/latest/userguide/ag-environments.html Environments>
    -- in the /Proton User Guide/.
    CreateEnvironment -> Sensitive Text
spec :: Data.Sensitive Prelude.Text,
    -- | The major version of the environment template.
    CreateEnvironment -> Text
templateMajorVersion :: Prelude.Text,
    -- | The name of the environment template. For more information, see
    -- <https://docs.aws.amazon.com/proton/latest/userguide/ag-templates.html Environment Templates>
    -- in the /Proton User Guide/.
    CreateEnvironment -> Text
templateName :: Prelude.Text
  }
  deriving (CreateEnvironment -> CreateEnvironment -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateEnvironment -> CreateEnvironment -> Bool
$c/= :: CreateEnvironment -> CreateEnvironment -> Bool
== :: CreateEnvironment -> CreateEnvironment -> Bool
$c== :: CreateEnvironment -> CreateEnvironment -> Bool
Prelude.Eq, Int -> CreateEnvironment -> ShowS
[CreateEnvironment] -> ShowS
CreateEnvironment -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateEnvironment] -> ShowS
$cshowList :: [CreateEnvironment] -> ShowS
show :: CreateEnvironment -> String
$cshow :: CreateEnvironment -> String
showsPrec :: Int -> CreateEnvironment -> ShowS
$cshowsPrec :: Int -> CreateEnvironment -> ShowS
Prelude.Show, forall x. Rep CreateEnvironment x -> CreateEnvironment
forall x. CreateEnvironment -> Rep CreateEnvironment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateEnvironment x -> CreateEnvironment
$cfrom :: forall x. CreateEnvironment -> Rep CreateEnvironment x
Prelude.Generic)

-- |
-- Create a value of 'CreateEnvironment' 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:
--
-- 'codebuildRoleArn', 'createEnvironment_codebuildRoleArn' - The Amazon Resource Name (ARN) of the IAM service role that allows
-- Proton to provision infrastructure using CodeBuild-based provisioning on
-- your behalf.
--
-- To use CodeBuild-based provisioning for the environment or for any
-- service instance running in the environment, specify either the
-- @environmentAccountConnectionId@ or @codebuildRoleArn@ parameter.
--
-- 'componentRoleArn', 'createEnvironment_componentRoleArn' - The Amazon Resource Name (ARN) of the IAM service role that Proton uses
-- when provisioning directly defined components in this environment. It
-- determines the scope of infrastructure that a component can provision.
--
-- You must specify @componentRoleArn@ to allow directly defined components
-- to be associated with this environment.
--
-- For more information about components, see
-- <https://docs.aws.amazon.com/proton/latest/userguide/ag-components.html Proton components>
-- in the /Proton User Guide/.
--
-- 'description', 'createEnvironment_description' - A description of the environment that\'s being created and deployed.
--
-- 'environmentAccountConnectionId', 'createEnvironment_environmentAccountConnectionId' - The ID of the environment account connection that you provide if you\'re
-- provisioning your environment infrastructure resources to an environment
-- account. For more information, see
-- <https://docs.aws.amazon.com/proton/latest/userguide/ag-env-account-connections.html Environment account connections>
-- in the /Proton User guide/.
--
-- To use Amazon Web Services-managed provisioning for the environment,
-- specify either the @environmentAccountConnectionId@ or
-- @protonServiceRoleArn@ parameter and omit the @provisioningRepository@
-- parameter.
--
-- 'protonServiceRoleArn', 'createEnvironment_protonServiceRoleArn' - The Amazon Resource Name (ARN) of the Proton service role that allows
-- Proton to make calls to other services on your behalf.
--
-- To use Amazon Web Services-managed provisioning for the environment,
-- specify either the @environmentAccountConnectionId@ or
-- @protonServiceRoleArn@ parameter and omit the @provisioningRepository@
-- parameter.
--
-- 'provisioningRepository', 'createEnvironment_provisioningRepository' - The linked repository that you use to host your rendered infrastructure
-- templates for self-managed provisioning. A linked repository is a
-- repository that has been registered with Proton. For more information,
-- see CreateRepository.
--
-- To use self-managed provisioning for the environment, specify this
-- parameter and omit the @environmentAccountConnectionId@ and
-- @protonServiceRoleArn@ parameters.
--
-- 'tags', 'createEnvironment_tags' - An optional list of metadata items that you can associate with the
-- Proton environment. A tag is a key-value pair.
--
-- For more information, see
-- <https://docs.aws.amazon.com/proton/latest/userguide/resources.html Proton resources and tagging>
-- in the /Proton User Guide/.
--
-- 'templateMinorVersion', 'createEnvironment_templateMinorVersion' - The minor version of the environment template.
--
-- 'name', 'createEnvironment_name' - The name of the environment.
--
-- 'spec', 'createEnvironment_spec' - A YAML formatted string that provides inputs as defined in the
-- environment template bundle schema file. For more information, see
-- <https://docs.aws.amazon.com/proton/latest/userguide/ag-environments.html Environments>
-- in the /Proton User Guide/.
--
-- 'templateMajorVersion', 'createEnvironment_templateMajorVersion' - The major version of the environment template.
--
-- 'templateName', 'createEnvironment_templateName' - The name of the environment template. For more information, see
-- <https://docs.aws.amazon.com/proton/latest/userguide/ag-templates.html Environment Templates>
-- in the /Proton User Guide/.
newCreateEnvironment ::
  -- | 'name'
  Prelude.Text ->
  -- | 'spec'
  Prelude.Text ->
  -- | 'templateMajorVersion'
  Prelude.Text ->
  -- | 'templateName'
  Prelude.Text ->
  CreateEnvironment
newCreateEnvironment :: Text -> Text -> Text -> Text -> CreateEnvironment
newCreateEnvironment
  Text
pName_
  Text
pSpec_
  Text
pTemplateMajorVersion_
  Text
pTemplateName_ =
    CreateEnvironment'
      { $sel:codebuildRoleArn:CreateEnvironment' :: Maybe Text
codebuildRoleArn =
          forall a. Maybe a
Prelude.Nothing,
        $sel:componentRoleArn:CreateEnvironment' :: Maybe Text
componentRoleArn = forall a. Maybe a
Prelude.Nothing,
        $sel:description:CreateEnvironment' :: Maybe (Sensitive Text)
description = forall a. Maybe a
Prelude.Nothing,
        $sel:environmentAccountConnectionId:CreateEnvironment' :: Maybe Text
environmentAccountConnectionId = forall a. Maybe a
Prelude.Nothing,
        $sel:protonServiceRoleArn:CreateEnvironment' :: Maybe Text
protonServiceRoleArn = forall a. Maybe a
Prelude.Nothing,
        $sel:provisioningRepository:CreateEnvironment' :: Maybe RepositoryBranchInput
provisioningRepository = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateEnvironment' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:templateMinorVersion:CreateEnvironment' :: Maybe Text
templateMinorVersion = forall a. Maybe a
Prelude.Nothing,
        $sel:name:CreateEnvironment' :: Text
name = Text
pName_,
        $sel:spec:CreateEnvironment' :: Sensitive Text
spec = forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pSpec_,
        $sel:templateMajorVersion:CreateEnvironment' :: Text
templateMajorVersion = Text
pTemplateMajorVersion_,
        $sel:templateName:CreateEnvironment' :: Text
templateName = Text
pTemplateName_
      }

-- | The Amazon Resource Name (ARN) of the IAM service role that allows
-- Proton to provision infrastructure using CodeBuild-based provisioning on
-- your behalf.
--
-- To use CodeBuild-based provisioning for the environment or for any
-- service instance running in the environment, specify either the
-- @environmentAccountConnectionId@ or @codebuildRoleArn@ parameter.
createEnvironment_codebuildRoleArn :: Lens.Lens' CreateEnvironment (Prelude.Maybe Prelude.Text)
createEnvironment_codebuildRoleArn :: Lens' CreateEnvironment (Maybe Text)
createEnvironment_codebuildRoleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironment' {Maybe Text
codebuildRoleArn :: Maybe Text
$sel:codebuildRoleArn:CreateEnvironment' :: CreateEnvironment -> Maybe Text
codebuildRoleArn} -> Maybe Text
codebuildRoleArn) (\s :: CreateEnvironment
s@CreateEnvironment' {} Maybe Text
a -> CreateEnvironment
s {$sel:codebuildRoleArn:CreateEnvironment' :: Maybe Text
codebuildRoleArn = Maybe Text
a} :: CreateEnvironment)

-- | The Amazon Resource Name (ARN) of the IAM service role that Proton uses
-- when provisioning directly defined components in this environment. It
-- determines the scope of infrastructure that a component can provision.
--
-- You must specify @componentRoleArn@ to allow directly defined components
-- to be associated with this environment.
--
-- For more information about components, see
-- <https://docs.aws.amazon.com/proton/latest/userguide/ag-components.html Proton components>
-- in the /Proton User Guide/.
createEnvironment_componentRoleArn :: Lens.Lens' CreateEnvironment (Prelude.Maybe Prelude.Text)
createEnvironment_componentRoleArn :: Lens' CreateEnvironment (Maybe Text)
createEnvironment_componentRoleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironment' {Maybe Text
componentRoleArn :: Maybe Text
$sel:componentRoleArn:CreateEnvironment' :: CreateEnvironment -> Maybe Text
componentRoleArn} -> Maybe Text
componentRoleArn) (\s :: CreateEnvironment
s@CreateEnvironment' {} Maybe Text
a -> CreateEnvironment
s {$sel:componentRoleArn:CreateEnvironment' :: Maybe Text
componentRoleArn = Maybe Text
a} :: CreateEnvironment)

-- | A description of the environment that\'s being created and deployed.
createEnvironment_description :: Lens.Lens' CreateEnvironment (Prelude.Maybe Prelude.Text)
createEnvironment_description :: Lens' CreateEnvironment (Maybe Text)
createEnvironment_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironment' {Maybe (Sensitive Text)
description :: Maybe (Sensitive Text)
$sel:description:CreateEnvironment' :: CreateEnvironment -> Maybe (Sensitive Text)
description} -> Maybe (Sensitive Text)
description) (\s :: CreateEnvironment
s@CreateEnvironment' {} Maybe (Sensitive Text)
a -> CreateEnvironment
s {$sel:description:CreateEnvironment' :: Maybe (Sensitive Text)
description = Maybe (Sensitive Text)
a} :: CreateEnvironment) 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 a. Iso' (Sensitive a) a
Data._Sensitive

-- | The ID of the environment account connection that you provide if you\'re
-- provisioning your environment infrastructure resources to an environment
-- account. For more information, see
-- <https://docs.aws.amazon.com/proton/latest/userguide/ag-env-account-connections.html Environment account connections>
-- in the /Proton User guide/.
--
-- To use Amazon Web Services-managed provisioning for the environment,
-- specify either the @environmentAccountConnectionId@ or
-- @protonServiceRoleArn@ parameter and omit the @provisioningRepository@
-- parameter.
createEnvironment_environmentAccountConnectionId :: Lens.Lens' CreateEnvironment (Prelude.Maybe Prelude.Text)
createEnvironment_environmentAccountConnectionId :: Lens' CreateEnvironment (Maybe Text)
createEnvironment_environmentAccountConnectionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironment' {Maybe Text
environmentAccountConnectionId :: Maybe Text
$sel:environmentAccountConnectionId:CreateEnvironment' :: CreateEnvironment -> Maybe Text
environmentAccountConnectionId} -> Maybe Text
environmentAccountConnectionId) (\s :: CreateEnvironment
s@CreateEnvironment' {} Maybe Text
a -> CreateEnvironment
s {$sel:environmentAccountConnectionId:CreateEnvironment' :: Maybe Text
environmentAccountConnectionId = Maybe Text
a} :: CreateEnvironment)

-- | The Amazon Resource Name (ARN) of the Proton service role that allows
-- Proton to make calls to other services on your behalf.
--
-- To use Amazon Web Services-managed provisioning for the environment,
-- specify either the @environmentAccountConnectionId@ or
-- @protonServiceRoleArn@ parameter and omit the @provisioningRepository@
-- parameter.
createEnvironment_protonServiceRoleArn :: Lens.Lens' CreateEnvironment (Prelude.Maybe Prelude.Text)
createEnvironment_protonServiceRoleArn :: Lens' CreateEnvironment (Maybe Text)
createEnvironment_protonServiceRoleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironment' {Maybe Text
protonServiceRoleArn :: Maybe Text
$sel:protonServiceRoleArn:CreateEnvironment' :: CreateEnvironment -> Maybe Text
protonServiceRoleArn} -> Maybe Text
protonServiceRoleArn) (\s :: CreateEnvironment
s@CreateEnvironment' {} Maybe Text
a -> CreateEnvironment
s {$sel:protonServiceRoleArn:CreateEnvironment' :: Maybe Text
protonServiceRoleArn = Maybe Text
a} :: CreateEnvironment)

-- | The linked repository that you use to host your rendered infrastructure
-- templates for self-managed provisioning. A linked repository is a
-- repository that has been registered with Proton. For more information,
-- see CreateRepository.
--
-- To use self-managed provisioning for the environment, specify this
-- parameter and omit the @environmentAccountConnectionId@ and
-- @protonServiceRoleArn@ parameters.
createEnvironment_provisioningRepository :: Lens.Lens' CreateEnvironment (Prelude.Maybe RepositoryBranchInput)
createEnvironment_provisioningRepository :: Lens' CreateEnvironment (Maybe RepositoryBranchInput)
createEnvironment_provisioningRepository = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironment' {Maybe RepositoryBranchInput
provisioningRepository :: Maybe RepositoryBranchInput
$sel:provisioningRepository:CreateEnvironment' :: CreateEnvironment -> Maybe RepositoryBranchInput
provisioningRepository} -> Maybe RepositoryBranchInput
provisioningRepository) (\s :: CreateEnvironment
s@CreateEnvironment' {} Maybe RepositoryBranchInput
a -> CreateEnvironment
s {$sel:provisioningRepository:CreateEnvironment' :: Maybe RepositoryBranchInput
provisioningRepository = Maybe RepositoryBranchInput
a} :: CreateEnvironment)

-- | An optional list of metadata items that you can associate with the
-- Proton environment. A tag is a key-value pair.
--
-- For more information, see
-- <https://docs.aws.amazon.com/proton/latest/userguide/resources.html Proton resources and tagging>
-- in the /Proton User Guide/.
createEnvironment_tags :: Lens.Lens' CreateEnvironment (Prelude.Maybe [Tag])
createEnvironment_tags :: Lens' CreateEnvironment (Maybe [Tag])
createEnvironment_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironment' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateEnvironment' :: CreateEnvironment -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateEnvironment
s@CreateEnvironment' {} Maybe [Tag]
a -> CreateEnvironment
s {$sel:tags:CreateEnvironment' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateEnvironment) 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 minor version of the environment template.
createEnvironment_templateMinorVersion :: Lens.Lens' CreateEnvironment (Prelude.Maybe Prelude.Text)
createEnvironment_templateMinorVersion :: Lens' CreateEnvironment (Maybe Text)
createEnvironment_templateMinorVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironment' {Maybe Text
templateMinorVersion :: Maybe Text
$sel:templateMinorVersion:CreateEnvironment' :: CreateEnvironment -> Maybe Text
templateMinorVersion} -> Maybe Text
templateMinorVersion) (\s :: CreateEnvironment
s@CreateEnvironment' {} Maybe Text
a -> CreateEnvironment
s {$sel:templateMinorVersion:CreateEnvironment' :: Maybe Text
templateMinorVersion = Maybe Text
a} :: CreateEnvironment)

-- | The name of the environment.
createEnvironment_name :: Lens.Lens' CreateEnvironment Prelude.Text
createEnvironment_name :: Lens' CreateEnvironment Text
createEnvironment_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironment' {Text
name :: Text
$sel:name:CreateEnvironment' :: CreateEnvironment -> Text
name} -> Text
name) (\s :: CreateEnvironment
s@CreateEnvironment' {} Text
a -> CreateEnvironment
s {$sel:name:CreateEnvironment' :: Text
name = Text
a} :: CreateEnvironment)

-- | A YAML formatted string that provides inputs as defined in the
-- environment template bundle schema file. For more information, see
-- <https://docs.aws.amazon.com/proton/latest/userguide/ag-environments.html Environments>
-- in the /Proton User Guide/.
createEnvironment_spec :: Lens.Lens' CreateEnvironment Prelude.Text
createEnvironment_spec :: Lens' CreateEnvironment Text
createEnvironment_spec = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironment' {Sensitive Text
spec :: Sensitive Text
$sel:spec:CreateEnvironment' :: CreateEnvironment -> Sensitive Text
spec} -> Sensitive Text
spec) (\s :: CreateEnvironment
s@CreateEnvironment' {} Sensitive Text
a -> CreateEnvironment
s {$sel:spec:CreateEnvironment' :: Sensitive Text
spec = Sensitive Text
a} :: CreateEnvironment) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | The major version of the environment template.
createEnvironment_templateMajorVersion :: Lens.Lens' CreateEnvironment Prelude.Text
createEnvironment_templateMajorVersion :: Lens' CreateEnvironment Text
createEnvironment_templateMajorVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironment' {Text
templateMajorVersion :: Text
$sel:templateMajorVersion:CreateEnvironment' :: CreateEnvironment -> Text
templateMajorVersion} -> Text
templateMajorVersion) (\s :: CreateEnvironment
s@CreateEnvironment' {} Text
a -> CreateEnvironment
s {$sel:templateMajorVersion:CreateEnvironment' :: Text
templateMajorVersion = Text
a} :: CreateEnvironment)

-- | The name of the environment template. For more information, see
-- <https://docs.aws.amazon.com/proton/latest/userguide/ag-templates.html Environment Templates>
-- in the /Proton User Guide/.
createEnvironment_templateName :: Lens.Lens' CreateEnvironment Prelude.Text
createEnvironment_templateName :: Lens' CreateEnvironment Text
createEnvironment_templateName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironment' {Text
templateName :: Text
$sel:templateName:CreateEnvironment' :: CreateEnvironment -> Text
templateName} -> Text
templateName) (\s :: CreateEnvironment
s@CreateEnvironment' {} Text
a -> CreateEnvironment
s {$sel:templateName:CreateEnvironment' :: Text
templateName = Text
a} :: CreateEnvironment)

instance Core.AWSRequest CreateEnvironment where
  type
    AWSResponse CreateEnvironment =
      CreateEnvironmentResponse
  request :: (Service -> Service)
-> CreateEnvironment -> Request CreateEnvironment
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateEnvironment
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateEnvironment)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> Environment -> CreateEnvironmentResponse
CreateEnvironmentResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"environment")
      )

instance Prelude.Hashable CreateEnvironment where
  hashWithSalt :: Int -> CreateEnvironment -> Int
hashWithSalt Int
_salt CreateEnvironment' {Maybe [Tag]
Maybe Text
Maybe (Sensitive Text)
Maybe RepositoryBranchInput
Text
Sensitive Text
templateName :: Text
templateMajorVersion :: Text
spec :: Sensitive Text
name :: Text
templateMinorVersion :: Maybe Text
tags :: Maybe [Tag]
provisioningRepository :: Maybe RepositoryBranchInput
protonServiceRoleArn :: Maybe Text
environmentAccountConnectionId :: Maybe Text
description :: Maybe (Sensitive Text)
componentRoleArn :: Maybe Text
codebuildRoleArn :: Maybe Text
$sel:templateName:CreateEnvironment' :: CreateEnvironment -> Text
$sel:templateMajorVersion:CreateEnvironment' :: CreateEnvironment -> Text
$sel:spec:CreateEnvironment' :: CreateEnvironment -> Sensitive Text
$sel:name:CreateEnvironment' :: CreateEnvironment -> Text
$sel:templateMinorVersion:CreateEnvironment' :: CreateEnvironment -> Maybe Text
$sel:tags:CreateEnvironment' :: CreateEnvironment -> Maybe [Tag]
$sel:provisioningRepository:CreateEnvironment' :: CreateEnvironment -> Maybe RepositoryBranchInput
$sel:protonServiceRoleArn:CreateEnvironment' :: CreateEnvironment -> Maybe Text
$sel:environmentAccountConnectionId:CreateEnvironment' :: CreateEnvironment -> Maybe Text
$sel:description:CreateEnvironment' :: CreateEnvironment -> Maybe (Sensitive Text)
$sel:componentRoleArn:CreateEnvironment' :: CreateEnvironment -> Maybe Text
$sel:codebuildRoleArn:CreateEnvironment' :: CreateEnvironment -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
codebuildRoleArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
componentRoleArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
environmentAccountConnectionId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
protonServiceRoleArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RepositoryBranchInput
provisioningRepository
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
templateMinorVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
spec
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
templateMajorVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
templateName

instance Prelude.NFData CreateEnvironment where
  rnf :: CreateEnvironment -> ()
rnf CreateEnvironment' {Maybe [Tag]
Maybe Text
Maybe (Sensitive Text)
Maybe RepositoryBranchInput
Text
Sensitive Text
templateName :: Text
templateMajorVersion :: Text
spec :: Sensitive Text
name :: Text
templateMinorVersion :: Maybe Text
tags :: Maybe [Tag]
provisioningRepository :: Maybe RepositoryBranchInput
protonServiceRoleArn :: Maybe Text
environmentAccountConnectionId :: Maybe Text
description :: Maybe (Sensitive Text)
componentRoleArn :: Maybe Text
codebuildRoleArn :: Maybe Text
$sel:templateName:CreateEnvironment' :: CreateEnvironment -> Text
$sel:templateMajorVersion:CreateEnvironment' :: CreateEnvironment -> Text
$sel:spec:CreateEnvironment' :: CreateEnvironment -> Sensitive Text
$sel:name:CreateEnvironment' :: CreateEnvironment -> Text
$sel:templateMinorVersion:CreateEnvironment' :: CreateEnvironment -> Maybe Text
$sel:tags:CreateEnvironment' :: CreateEnvironment -> Maybe [Tag]
$sel:provisioningRepository:CreateEnvironment' :: CreateEnvironment -> Maybe RepositoryBranchInput
$sel:protonServiceRoleArn:CreateEnvironment' :: CreateEnvironment -> Maybe Text
$sel:environmentAccountConnectionId:CreateEnvironment' :: CreateEnvironment -> Maybe Text
$sel:description:CreateEnvironment' :: CreateEnvironment -> Maybe (Sensitive Text)
$sel:componentRoleArn:CreateEnvironment' :: CreateEnvironment -> Maybe Text
$sel:codebuildRoleArn:CreateEnvironment' :: CreateEnvironment -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
codebuildRoleArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
componentRoleArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
environmentAccountConnectionId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
protonServiceRoleArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RepositoryBranchInput
provisioningRepository
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
templateMinorVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
spec
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
templateMajorVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
templateName

instance Data.ToHeaders CreateEnvironment where
  toHeaders :: CreateEnvironment -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AwsProton20200720.CreateEnvironment" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON CreateEnvironment where
  toJSON :: CreateEnvironment -> Value
toJSON CreateEnvironment' {Maybe [Tag]
Maybe Text
Maybe (Sensitive Text)
Maybe RepositoryBranchInput
Text
Sensitive Text
templateName :: Text
templateMajorVersion :: Text
spec :: Sensitive Text
name :: Text
templateMinorVersion :: Maybe Text
tags :: Maybe [Tag]
provisioningRepository :: Maybe RepositoryBranchInput
protonServiceRoleArn :: Maybe Text
environmentAccountConnectionId :: Maybe Text
description :: Maybe (Sensitive Text)
componentRoleArn :: Maybe Text
codebuildRoleArn :: Maybe Text
$sel:templateName:CreateEnvironment' :: CreateEnvironment -> Text
$sel:templateMajorVersion:CreateEnvironment' :: CreateEnvironment -> Text
$sel:spec:CreateEnvironment' :: CreateEnvironment -> Sensitive Text
$sel:name:CreateEnvironment' :: CreateEnvironment -> Text
$sel:templateMinorVersion:CreateEnvironment' :: CreateEnvironment -> Maybe Text
$sel:tags:CreateEnvironment' :: CreateEnvironment -> Maybe [Tag]
$sel:provisioningRepository:CreateEnvironment' :: CreateEnvironment -> Maybe RepositoryBranchInput
$sel:protonServiceRoleArn:CreateEnvironment' :: CreateEnvironment -> Maybe Text
$sel:environmentAccountConnectionId:CreateEnvironment' :: CreateEnvironment -> Maybe Text
$sel:description:CreateEnvironment' :: CreateEnvironment -> Maybe (Sensitive Text)
$sel:componentRoleArn:CreateEnvironment' :: CreateEnvironment -> Maybe Text
$sel:codebuildRoleArn:CreateEnvironment' :: CreateEnvironment -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"codebuildRoleArn" 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
codebuildRoleArn,
            (Key
"componentRoleArn" 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
componentRoleArn,
            (Key
"description" 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 (Sensitive Text)
description,
            (Key
"environmentAccountConnectionId" 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
environmentAccountConnectionId,
            (Key
"protonServiceRoleArn" 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
protonServiceRoleArn,
            (Key
"provisioningRepository" 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 RepositoryBranchInput
provisioningRepository,
            (Key
"tags" 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 [Tag]
tags,
            (Key
"templateMinorVersion" 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
templateMinorVersion,
            forall a. a -> Maybe a
Prelude.Just (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
            forall a. a -> Maybe a
Prelude.Just (Key
"spec" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive Text
spec),
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"templateMajorVersion"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
templateMajorVersion
              ),
            forall a. a -> Maybe a
Prelude.Just (Key
"templateName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
templateName)
          ]
      )

instance Data.ToPath CreateEnvironment where
  toPath :: CreateEnvironment -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery CreateEnvironment where
  toQuery :: CreateEnvironment -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateEnvironmentResponse' smart constructor.
data CreateEnvironmentResponse = CreateEnvironmentResponse'
  { -- | The response's http status code.
    CreateEnvironmentResponse -> Int
httpStatus :: Prelude.Int,
    -- | The environment detail data that\'s returned by Proton.
    CreateEnvironmentResponse -> Environment
environment :: Environment
  }
  deriving (CreateEnvironmentResponse -> CreateEnvironmentResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateEnvironmentResponse -> CreateEnvironmentResponse -> Bool
$c/= :: CreateEnvironmentResponse -> CreateEnvironmentResponse -> Bool
== :: CreateEnvironmentResponse -> CreateEnvironmentResponse -> Bool
$c== :: CreateEnvironmentResponse -> CreateEnvironmentResponse -> Bool
Prelude.Eq, Int -> CreateEnvironmentResponse -> ShowS
[CreateEnvironmentResponse] -> ShowS
CreateEnvironmentResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateEnvironmentResponse] -> ShowS
$cshowList :: [CreateEnvironmentResponse] -> ShowS
show :: CreateEnvironmentResponse -> String
$cshow :: CreateEnvironmentResponse -> String
showsPrec :: Int -> CreateEnvironmentResponse -> ShowS
$cshowsPrec :: Int -> CreateEnvironmentResponse -> ShowS
Prelude.Show, forall x.
Rep CreateEnvironmentResponse x -> CreateEnvironmentResponse
forall x.
CreateEnvironmentResponse -> Rep CreateEnvironmentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateEnvironmentResponse x -> CreateEnvironmentResponse
$cfrom :: forall x.
CreateEnvironmentResponse -> Rep CreateEnvironmentResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateEnvironmentResponse' 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:
--
-- 'httpStatus', 'createEnvironmentResponse_httpStatus' - The response's http status code.
--
-- 'environment', 'createEnvironmentResponse_environment' - The environment detail data that\'s returned by Proton.
newCreateEnvironmentResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'environment'
  Environment ->
  CreateEnvironmentResponse
newCreateEnvironmentResponse :: Int -> Environment -> CreateEnvironmentResponse
newCreateEnvironmentResponse
  Int
pHttpStatus_
  Environment
pEnvironment_ =
    CreateEnvironmentResponse'
      { $sel:httpStatus:CreateEnvironmentResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:environment:CreateEnvironmentResponse' :: Environment
environment = Environment
pEnvironment_
      }

-- | The response's http status code.
createEnvironmentResponse_httpStatus :: Lens.Lens' CreateEnvironmentResponse Prelude.Int
createEnvironmentResponse_httpStatus :: Lens' CreateEnvironmentResponse Int
createEnvironmentResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironmentResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateEnvironmentResponse' :: CreateEnvironmentResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateEnvironmentResponse
s@CreateEnvironmentResponse' {} Int
a -> CreateEnvironmentResponse
s {$sel:httpStatus:CreateEnvironmentResponse' :: Int
httpStatus = Int
a} :: CreateEnvironmentResponse)

-- | The environment detail data that\'s returned by Proton.
createEnvironmentResponse_environment :: Lens.Lens' CreateEnvironmentResponse Environment
createEnvironmentResponse_environment :: Lens' CreateEnvironmentResponse Environment
createEnvironmentResponse_environment = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironmentResponse' {Environment
environment :: Environment
$sel:environment:CreateEnvironmentResponse' :: CreateEnvironmentResponse -> Environment
environment} -> Environment
environment) (\s :: CreateEnvironmentResponse
s@CreateEnvironmentResponse' {} Environment
a -> CreateEnvironmentResponse
s {$sel:environment:CreateEnvironmentResponse' :: Environment
environment = Environment
a} :: CreateEnvironmentResponse)

instance Prelude.NFData CreateEnvironmentResponse where
  rnf :: CreateEnvironmentResponse -> ()
rnf CreateEnvironmentResponse' {Int
Environment
environment :: Environment
httpStatus :: Int
$sel:environment:CreateEnvironmentResponse' :: CreateEnvironmentResponse -> Environment
$sel:httpStatus:CreateEnvironmentResponse' :: CreateEnvironmentResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Environment
environment