{-# 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-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)
--
-- Deploy a new environment. An AWS Proton environment is created from an
-- environment template that defines infrastructure and resources that can
-- be shared across services. For more information, see the
-- <https://docs.aws.amazon.com/proton/latest/adminguide/ag-environments.html Environments>
-- in the /AWS Proton Administrator Guide./
module Amazonka.Proton.CreateEnvironment
  ( -- * Creating a Request
    CreateEnvironment (..),
    newCreateEnvironment,

    -- * Request Lenses
    createEnvironment_protonServiceRoleArn,
    createEnvironment_environmentAccountConnectionId,
    createEnvironment_templateMinorVersion,
    createEnvironment_description,
    createEnvironment_tags,
    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.Lens as Lens
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 AWS Proton service role that
    -- allows AWS Proton to make calls to other services on your behalf. You
    -- must include either the @environmentAccountConnectionId@ or
    -- @protonServiceRoleArn@ parameter and value.
    CreateEnvironment -> Maybe Text
protonServiceRoleArn :: Prelude.Maybe Prelude.Text,
    -- | The ID of the environment account connection that you provide if you\'re
    -- provisioning your environment infrastructure resources to an environment
    -- account. You must include either the @environmentAccountConnectionId@ or
    -- @protonServiceRoleArn@ parameter and value. For more information, see
    -- <https://docs.aws.amazon.com/proton/latest/adminguide/ag-env-account-connections.html Environment account connections>
    -- in the /AWS Proton Administrator guide/.
    CreateEnvironment -> Maybe Text
environmentAccountConnectionId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the minor version of the environment template.
    CreateEnvironment -> Maybe Text
templateMinorVersion :: Prelude.Maybe Prelude.Text,
    -- | A description of the environment that\'s being created and deployed.
    CreateEnvironment -> Maybe (Sensitive Text)
description :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | Create tags for your environment. For more information, see /AWS Proton
    -- resources and tagging/ in the
    -- <https://docs.aws.amazon.com/proton/latest/adminguide/resources.html AWS Proton Administrator Guide>
    -- or
    -- <https://docs.aws.amazon.com/proton/latest/userguide/resources.html AWS Proton User Guide>.
    CreateEnvironment -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The name of the environment.
    CreateEnvironment -> Text
name :: Prelude.Text,
    -- | A link to a YAML formatted spec file that provides inputs as defined in
    -- the environment template bundle schema file. For more information, see
    -- <https://docs.aws.amazon.com/proton/latest/adminguide/ag-environments.html Environments>
    -- in the /AWS Proton Administrator Guide/.
    CreateEnvironment -> Sensitive Text
spec :: Core.Sensitive Prelude.Text,
    -- | The ID of 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/adminguide/ag-templates.html Environment Templates>
    -- in the /AWS Proton Administrator Guide/.
    CreateEnvironment -> Text
templateName :: Prelude.Text
  }
  deriving (CreateEnvironment -> CreateEnvironment -> Bool
(CreateEnvironment -> CreateEnvironment -> Bool)
-> (CreateEnvironment -> CreateEnvironment -> Bool)
-> Eq CreateEnvironment
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
(Int -> CreateEnvironment -> ShowS)
-> (CreateEnvironment -> String)
-> ([CreateEnvironment] -> ShowS)
-> Show CreateEnvironment
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. CreateEnvironment -> Rep CreateEnvironment x)
-> (forall x. Rep CreateEnvironment x -> CreateEnvironment)
-> Generic CreateEnvironment
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:
--
-- 'protonServiceRoleArn', 'createEnvironment_protonServiceRoleArn' - The Amazon Resource Name (ARN) of the AWS Proton service role that
-- allows AWS Proton to make calls to other services on your behalf. You
-- must include either the @environmentAccountConnectionId@ or
-- @protonServiceRoleArn@ parameter and value.
--
-- '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. You must include either the @environmentAccountConnectionId@ or
-- @protonServiceRoleArn@ parameter and value. For more information, see
-- <https://docs.aws.amazon.com/proton/latest/adminguide/ag-env-account-connections.html Environment account connections>
-- in the /AWS Proton Administrator guide/.
--
-- 'templateMinorVersion', 'createEnvironment_templateMinorVersion' - The ID of the minor version of the environment template.
--
-- 'description', 'createEnvironment_description' - A description of the environment that\'s being created and deployed.
--
-- 'tags', 'createEnvironment_tags' - Create tags for your environment. For more information, see /AWS Proton
-- resources and tagging/ in the
-- <https://docs.aws.amazon.com/proton/latest/adminguide/resources.html AWS Proton Administrator Guide>
-- or
-- <https://docs.aws.amazon.com/proton/latest/userguide/resources.html AWS Proton User Guide>.
--
-- 'name', 'createEnvironment_name' - The name of the environment.
--
-- 'spec', 'createEnvironment_spec' - A link to a YAML formatted spec file that provides inputs as defined in
-- the environment template bundle schema file. For more information, see
-- <https://docs.aws.amazon.com/proton/latest/adminguide/ag-environments.html Environments>
-- in the /AWS Proton Administrator Guide/.
--
-- 'templateMajorVersion', 'createEnvironment_templateMajorVersion' - The ID of 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/adminguide/ag-templates.html Environment Templates>
-- in the /AWS Proton Administrator 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' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (Sensitive Text)
-> Maybe [Tag]
-> Text
-> Sensitive Text
-> Text
-> Text
-> CreateEnvironment
CreateEnvironment'
      { $sel:protonServiceRoleArn:CreateEnvironment' :: Maybe Text
protonServiceRoleArn =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:environmentAccountConnectionId:CreateEnvironment' :: Maybe Text
environmentAccountConnectionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:templateMinorVersion:CreateEnvironment' :: Maybe Text
templateMinorVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:description:CreateEnvironment' :: Maybe (Sensitive Text)
description = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateEnvironment' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:name:CreateEnvironment' :: Text
name = Text
pName_,
        $sel:spec:CreateEnvironment' :: Sensitive Text
spec = Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
 -> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
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 AWS Proton service role that
-- allows AWS Proton to make calls to other services on your behalf. You
-- must include either the @environmentAccountConnectionId@ or
-- @protonServiceRoleArn@ parameter and value.
createEnvironment_protonServiceRoleArn :: Lens.Lens' CreateEnvironment (Prelude.Maybe Prelude.Text)
createEnvironment_protonServiceRoleArn :: (Maybe Text -> f (Maybe Text))
-> CreateEnvironment -> f CreateEnvironment
createEnvironment_protonServiceRoleArn = (CreateEnvironment -> Maybe Text)
-> (CreateEnvironment -> Maybe Text -> CreateEnvironment)
-> Lens
     CreateEnvironment CreateEnvironment (Maybe Text) (Maybe Text)
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 ID of the environment account connection that you provide if you\'re
-- provisioning your environment infrastructure resources to an environment
-- account. You must include either the @environmentAccountConnectionId@ or
-- @protonServiceRoleArn@ parameter and value. For more information, see
-- <https://docs.aws.amazon.com/proton/latest/adminguide/ag-env-account-connections.html Environment account connections>
-- in the /AWS Proton Administrator guide/.
createEnvironment_environmentAccountConnectionId :: Lens.Lens' CreateEnvironment (Prelude.Maybe Prelude.Text)
createEnvironment_environmentAccountConnectionId :: (Maybe Text -> f (Maybe Text))
-> CreateEnvironment -> f CreateEnvironment
createEnvironment_environmentAccountConnectionId = (CreateEnvironment -> Maybe Text)
-> (CreateEnvironment -> Maybe Text -> CreateEnvironment)
-> Lens
     CreateEnvironment CreateEnvironment (Maybe Text) (Maybe Text)
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 ID of the minor version of the environment template.
createEnvironment_templateMinorVersion :: Lens.Lens' CreateEnvironment (Prelude.Maybe Prelude.Text)
createEnvironment_templateMinorVersion :: (Maybe Text -> f (Maybe Text))
-> CreateEnvironment -> f CreateEnvironment
createEnvironment_templateMinorVersion = (CreateEnvironment -> Maybe Text)
-> (CreateEnvironment -> Maybe Text -> CreateEnvironment)
-> Lens
     CreateEnvironment CreateEnvironment (Maybe Text) (Maybe Text)
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)

-- | A description of the environment that\'s being created and deployed.
createEnvironment_description :: Lens.Lens' CreateEnvironment (Prelude.Maybe Prelude.Text)
createEnvironment_description :: (Maybe Text -> f (Maybe Text))
-> CreateEnvironment -> f CreateEnvironment
createEnvironment_description = (CreateEnvironment -> Maybe (Sensitive Text))
-> (CreateEnvironment
    -> Maybe (Sensitive Text) -> CreateEnvironment)
-> Lens
     CreateEnvironment
     CreateEnvironment
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
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) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> CreateEnvironment -> f CreateEnvironment)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> CreateEnvironment
-> f CreateEnvironment
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | Create tags for your environment. For more information, see /AWS Proton
-- resources and tagging/ in the
-- <https://docs.aws.amazon.com/proton/latest/adminguide/resources.html AWS Proton Administrator Guide>
-- or
-- <https://docs.aws.amazon.com/proton/latest/userguide/resources.html AWS Proton User Guide>.
createEnvironment_tags :: Lens.Lens' CreateEnvironment (Prelude.Maybe [Tag])
createEnvironment_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateEnvironment -> f CreateEnvironment
createEnvironment_tags = (CreateEnvironment -> Maybe [Tag])
-> (CreateEnvironment -> Maybe [Tag] -> CreateEnvironment)
-> Lens
     CreateEnvironment CreateEnvironment (Maybe [Tag]) (Maybe [Tag])
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) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateEnvironment -> f CreateEnvironment)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateEnvironment
-> f CreateEnvironment
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the environment.
createEnvironment_name :: Lens.Lens' CreateEnvironment Prelude.Text
createEnvironment_name :: (Text -> f Text) -> CreateEnvironment -> f CreateEnvironment
createEnvironment_name = (CreateEnvironment -> Text)
-> (CreateEnvironment -> Text -> CreateEnvironment)
-> Lens CreateEnvironment CreateEnvironment Text Text
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 link to a YAML formatted spec file that provides inputs as defined in
-- the environment template bundle schema file. For more information, see
-- <https://docs.aws.amazon.com/proton/latest/adminguide/ag-environments.html Environments>
-- in the /AWS Proton Administrator Guide/.
createEnvironment_spec :: Lens.Lens' CreateEnvironment Prelude.Text
createEnvironment_spec :: (Text -> f Text) -> CreateEnvironment -> f CreateEnvironment
createEnvironment_spec = (CreateEnvironment -> Sensitive Text)
-> (CreateEnvironment -> Sensitive Text -> CreateEnvironment)
-> Lens
     CreateEnvironment
     CreateEnvironment
     (Sensitive Text)
     (Sensitive Text)
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) ((Sensitive Text -> f (Sensitive Text))
 -> CreateEnvironment -> f CreateEnvironment)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> CreateEnvironment
-> f CreateEnvironment
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The ID of the major version of the environment template.
createEnvironment_templateMajorVersion :: Lens.Lens' CreateEnvironment Prelude.Text
createEnvironment_templateMajorVersion :: (Text -> f Text) -> CreateEnvironment -> f CreateEnvironment
createEnvironment_templateMajorVersion = (CreateEnvironment -> Text)
-> (CreateEnvironment -> Text -> CreateEnvironment)
-> Lens CreateEnvironment CreateEnvironment Text Text
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/adminguide/ag-templates.html Environment Templates>
-- in the /AWS Proton Administrator Guide/.
createEnvironment_templateName :: Lens.Lens' CreateEnvironment Prelude.Text
createEnvironment_templateName :: (Text -> f Text) -> CreateEnvironment -> f CreateEnvironment
createEnvironment_templateName = (CreateEnvironment -> Text)
-> (CreateEnvironment -> Text -> CreateEnvironment)
-> Lens CreateEnvironment CreateEnvironment Text Text
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 :: CreateEnvironment -> Request CreateEnvironment
request = Service -> CreateEnvironment -> Request CreateEnvironment
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateEnvironment
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateEnvironment)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateEnvironment))
-> Logger
-> Service
-> Proxy CreateEnvironment
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateEnvironment)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> Environment -> CreateEnvironmentResponse
CreateEnvironmentResponse'
            (Int -> Environment -> CreateEnvironmentResponse)
-> Either String Int
-> Either String (Environment -> CreateEnvironmentResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            Either String (Environment -> CreateEnvironmentResponse)
-> Either String Environment
-> Either String CreateEnvironmentResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Environment
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"environment")
      )

instance Prelude.Hashable CreateEnvironment

instance Prelude.NFData CreateEnvironment

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

instance Core.ToJSON CreateEnvironment where
  toJSON :: CreateEnvironment -> Value
toJSON CreateEnvironment' {Maybe [Tag]
Maybe Text
Maybe (Sensitive Text)
Text
Sensitive Text
templateName :: Text
templateMajorVersion :: Text
spec :: Sensitive Text
name :: Text
tags :: Maybe [Tag]
description :: Maybe (Sensitive Text)
templateMinorVersion :: Maybe Text
environmentAccountConnectionId :: Maybe Text
protonServiceRoleArn :: Maybe Text
$sel:templateName:CreateEnvironment' :: CreateEnvironment -> Text
$sel:templateMajorVersion:CreateEnvironment' :: CreateEnvironment -> Text
$sel:spec:CreateEnvironment' :: CreateEnvironment -> Sensitive Text
$sel:name:CreateEnvironment' :: CreateEnvironment -> Text
$sel:tags:CreateEnvironment' :: CreateEnvironment -> Maybe [Tag]
$sel:description:CreateEnvironment' :: CreateEnvironment -> Maybe (Sensitive Text)
$sel:templateMinorVersion:CreateEnvironment' :: CreateEnvironment -> Maybe Text
$sel:environmentAccountConnectionId:CreateEnvironment' :: CreateEnvironment -> Maybe Text
$sel:protonServiceRoleArn:CreateEnvironment' :: CreateEnvironment -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"protonServiceRoleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
protonServiceRoleArn,
            (Text
"environmentAccountConnectionId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
environmentAccountConnectionId,
            (Text
"templateMinorVersion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
templateMinorVersion,
            (Text
"description" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
description,
            (Text
"tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"spec" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
spec),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"templateMajorVersion"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
templateMajorVersion
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"templateName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
templateName)
          ]
      )

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

instance Core.ToQuery CreateEnvironment where
  toQuery :: CreateEnvironment -> QueryString
toQuery = QueryString -> CreateEnvironment -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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 AWS Proton.
    CreateEnvironmentResponse -> Environment
environment :: Environment
  }
  deriving (CreateEnvironmentResponse -> CreateEnvironmentResponse -> Bool
(CreateEnvironmentResponse -> CreateEnvironmentResponse -> Bool)
-> (CreateEnvironmentResponse -> CreateEnvironmentResponse -> Bool)
-> Eq CreateEnvironmentResponse
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
(Int -> CreateEnvironmentResponse -> ShowS)
-> (CreateEnvironmentResponse -> String)
-> ([CreateEnvironmentResponse] -> ShowS)
-> Show CreateEnvironmentResponse
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.
 CreateEnvironmentResponse -> Rep CreateEnvironmentResponse x)
-> (forall x.
    Rep CreateEnvironmentResponse x -> CreateEnvironmentResponse)
-> Generic CreateEnvironmentResponse
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 AWS Proton.
newCreateEnvironmentResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'environment'
  Environment ->
  CreateEnvironmentResponse
newCreateEnvironmentResponse :: Int -> Environment -> CreateEnvironmentResponse
newCreateEnvironmentResponse
  Int
pHttpStatus_
  Environment
pEnvironment_ =
    CreateEnvironmentResponse' :: Int -> Environment -> CreateEnvironmentResponse
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 :: (Int -> f Int)
-> CreateEnvironmentResponse -> f CreateEnvironmentResponse
createEnvironmentResponse_httpStatus = (CreateEnvironmentResponse -> Int)
-> (CreateEnvironmentResponse -> Int -> CreateEnvironmentResponse)
-> Lens CreateEnvironmentResponse CreateEnvironmentResponse Int Int
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 AWS Proton.
createEnvironmentResponse_environment :: Lens.Lens' CreateEnvironmentResponse Environment
createEnvironmentResponse_environment :: (Environment -> f Environment)
-> CreateEnvironmentResponse -> f CreateEnvironmentResponse
createEnvironmentResponse_environment = (CreateEnvironmentResponse -> Environment)
-> (CreateEnvironmentResponse
    -> Environment -> CreateEnvironmentResponse)
-> Lens
     CreateEnvironmentResponse
     CreateEnvironmentResponse
     Environment
     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