{-# 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.M2.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)
--
-- Creates a runtime environment for a given runtime engine.
module Amazonka.M2.CreateEnvironment
  ( -- * Creating a Request
    CreateEnvironment (..),
    newCreateEnvironment,

    -- * Request Lenses
    createEnvironment_clientToken,
    createEnvironment_description,
    createEnvironment_engineVersion,
    createEnvironment_highAvailabilityConfig,
    createEnvironment_kmsKeyId,
    createEnvironment_preferredMaintenanceWindow,
    createEnvironment_publiclyAccessible,
    createEnvironment_securityGroupIds,
    createEnvironment_storageConfigurations,
    createEnvironment_subnetIds,
    createEnvironment_tags,
    createEnvironment_engineType,
    createEnvironment_instanceType,
    createEnvironment_name,

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

    -- * Response Lenses
    createEnvironmentResponse_httpStatus,
    createEnvironmentResponse_environmentId,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.M2.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateEnvironment' smart constructor.
data CreateEnvironment = CreateEnvironment'
  { -- | Unique, case-sensitive identifier you provide to ensure the idempotency
    -- of the request to create an environment. The service generates the
    -- clientToken when the API call is triggered. The token expires after one
    -- hour, so if you retry the API within this timeframe with the same
    -- clientToken, you will get the same response. The service also handles
    -- deleting the clientToken after it expires.
    CreateEnvironment -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | The description of the runtime environment.
    CreateEnvironment -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The version of the engine type for the runtime environment.
    CreateEnvironment -> Maybe Text
engineVersion :: Prelude.Maybe Prelude.Text,
    -- | The details of a high availability configuration for this runtime
    -- environment.
    CreateEnvironment -> Maybe HighAvailabilityConfig
highAvailabilityConfig :: Prelude.Maybe HighAvailabilityConfig,
    -- | The identifier of a customer managed key.
    CreateEnvironment -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | Configures the maintenance window you want for the runtime environment.
    -- If you do not provide a value, a random system-generated value will be
    -- assigned.
    CreateEnvironment -> Maybe Text
preferredMaintenanceWindow :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether the runtime environment is publicly accessible.
    CreateEnvironment -> Maybe Bool
publiclyAccessible :: Prelude.Maybe Prelude.Bool,
    -- | The list of security groups for the VPC associated with this runtime
    -- environment.
    CreateEnvironment -> Maybe [Text]
securityGroupIds :: Prelude.Maybe [Prelude.Text],
    -- | Optional. The storage configurations for this runtime environment.
    CreateEnvironment -> Maybe [StorageConfiguration]
storageConfigurations :: Prelude.Maybe [StorageConfiguration],
    -- | The list of subnets associated with the VPC for this runtime
    -- environment.
    CreateEnvironment -> Maybe [Text]
subnetIds :: Prelude.Maybe [Prelude.Text],
    -- | The tags for the runtime environment.
    CreateEnvironment -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The engine type for the runtime environment.
    CreateEnvironment -> EngineType
engineType :: EngineType,
    -- | The type of instance for the runtime environment.
    CreateEnvironment -> Text
instanceType :: Prelude.Text,
    -- | The name of the runtime environment. Must be unique within the account.
    CreateEnvironment -> Text
name :: 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, ReadPrec [CreateEnvironment]
ReadPrec CreateEnvironment
Int -> ReadS CreateEnvironment
ReadS [CreateEnvironment]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateEnvironment]
$creadListPrec :: ReadPrec [CreateEnvironment]
readPrec :: ReadPrec CreateEnvironment
$creadPrec :: ReadPrec CreateEnvironment
readList :: ReadS [CreateEnvironment]
$creadList :: ReadS [CreateEnvironment]
readsPrec :: Int -> ReadS CreateEnvironment
$creadsPrec :: Int -> ReadS CreateEnvironment
Prelude.Read, 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:
--
-- 'clientToken', 'createEnvironment_clientToken' - Unique, case-sensitive identifier you provide to ensure the idempotency
-- of the request to create an environment. The service generates the
-- clientToken when the API call is triggered. The token expires after one
-- hour, so if you retry the API within this timeframe with the same
-- clientToken, you will get the same response. The service also handles
-- deleting the clientToken after it expires.
--
-- 'description', 'createEnvironment_description' - The description of the runtime environment.
--
-- 'engineVersion', 'createEnvironment_engineVersion' - The version of the engine type for the runtime environment.
--
-- 'highAvailabilityConfig', 'createEnvironment_highAvailabilityConfig' - The details of a high availability configuration for this runtime
-- environment.
--
-- 'kmsKeyId', 'createEnvironment_kmsKeyId' - The identifier of a customer managed key.
--
-- 'preferredMaintenanceWindow', 'createEnvironment_preferredMaintenanceWindow' - Configures the maintenance window you want for the runtime environment.
-- If you do not provide a value, a random system-generated value will be
-- assigned.
--
-- 'publiclyAccessible', 'createEnvironment_publiclyAccessible' - Specifies whether the runtime environment is publicly accessible.
--
-- 'securityGroupIds', 'createEnvironment_securityGroupIds' - The list of security groups for the VPC associated with this runtime
-- environment.
--
-- 'storageConfigurations', 'createEnvironment_storageConfigurations' - Optional. The storage configurations for this runtime environment.
--
-- 'subnetIds', 'createEnvironment_subnetIds' - The list of subnets associated with the VPC for this runtime
-- environment.
--
-- 'tags', 'createEnvironment_tags' - The tags for the runtime environment.
--
-- 'engineType', 'createEnvironment_engineType' - The engine type for the runtime environment.
--
-- 'instanceType', 'createEnvironment_instanceType' - The type of instance for the runtime environment.
--
-- 'name', 'createEnvironment_name' - The name of the runtime environment. Must be unique within the account.
newCreateEnvironment ::
  -- | 'engineType'
  EngineType ->
  -- | 'instanceType'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  CreateEnvironment
newCreateEnvironment :: EngineType -> Text -> Text -> CreateEnvironment
newCreateEnvironment
  EngineType
pEngineType_
  Text
pInstanceType_
  Text
pName_ =
    CreateEnvironment'
      { $sel:clientToken:CreateEnvironment' :: Maybe Text
clientToken = forall a. Maybe a
Prelude.Nothing,
        $sel:description:CreateEnvironment' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
        $sel:engineVersion:CreateEnvironment' :: Maybe Text
engineVersion = forall a. Maybe a
Prelude.Nothing,
        $sel:highAvailabilityConfig:CreateEnvironment' :: Maybe HighAvailabilityConfig
highAvailabilityConfig = forall a. Maybe a
Prelude.Nothing,
        $sel:kmsKeyId:CreateEnvironment' :: Maybe Text
kmsKeyId = forall a. Maybe a
Prelude.Nothing,
        $sel:preferredMaintenanceWindow:CreateEnvironment' :: Maybe Text
preferredMaintenanceWindow = forall a. Maybe a
Prelude.Nothing,
        $sel:publiclyAccessible:CreateEnvironment' :: Maybe Bool
publiclyAccessible = forall a. Maybe a
Prelude.Nothing,
        $sel:securityGroupIds:CreateEnvironment' :: Maybe [Text]
securityGroupIds = forall a. Maybe a
Prelude.Nothing,
        $sel:storageConfigurations:CreateEnvironment' :: Maybe [StorageConfiguration]
storageConfigurations = forall a. Maybe a
Prelude.Nothing,
        $sel:subnetIds:CreateEnvironment' :: Maybe [Text]
subnetIds = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateEnvironment' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:engineType:CreateEnvironment' :: EngineType
engineType = EngineType
pEngineType_,
        $sel:instanceType:CreateEnvironment' :: Text
instanceType = Text
pInstanceType_,
        $sel:name:CreateEnvironment' :: Text
name = Text
pName_
      }

-- | Unique, case-sensitive identifier you provide to ensure the idempotency
-- of the request to create an environment. The service generates the
-- clientToken when the API call is triggered. The token expires after one
-- hour, so if you retry the API within this timeframe with the same
-- clientToken, you will get the same response. The service also handles
-- deleting the clientToken after it expires.
createEnvironment_clientToken :: Lens.Lens' CreateEnvironment (Prelude.Maybe Prelude.Text)
createEnvironment_clientToken :: Lens' CreateEnvironment (Maybe Text)
createEnvironment_clientToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironment' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateEnvironment' :: CreateEnvironment -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateEnvironment
s@CreateEnvironment' {} Maybe Text
a -> CreateEnvironment
s {$sel:clientToken:CreateEnvironment' :: Maybe Text
clientToken = Maybe Text
a} :: CreateEnvironment)

-- | The description of the runtime environment.
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 Text
description :: Maybe Text
$sel:description:CreateEnvironment' :: CreateEnvironment -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateEnvironment
s@CreateEnvironment' {} Maybe Text
a -> CreateEnvironment
s {$sel:description:CreateEnvironment' :: Maybe Text
description = Maybe Text
a} :: CreateEnvironment)

-- | The version of the engine type for the runtime environment.
createEnvironment_engineVersion :: Lens.Lens' CreateEnvironment (Prelude.Maybe Prelude.Text)
createEnvironment_engineVersion :: Lens' CreateEnvironment (Maybe Text)
createEnvironment_engineVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironment' {Maybe Text
engineVersion :: Maybe Text
$sel:engineVersion:CreateEnvironment' :: CreateEnvironment -> Maybe Text
engineVersion} -> Maybe Text
engineVersion) (\s :: CreateEnvironment
s@CreateEnvironment' {} Maybe Text
a -> CreateEnvironment
s {$sel:engineVersion:CreateEnvironment' :: Maybe Text
engineVersion = Maybe Text
a} :: CreateEnvironment)

-- | The details of a high availability configuration for this runtime
-- environment.
createEnvironment_highAvailabilityConfig :: Lens.Lens' CreateEnvironment (Prelude.Maybe HighAvailabilityConfig)
createEnvironment_highAvailabilityConfig :: Lens' CreateEnvironment (Maybe HighAvailabilityConfig)
createEnvironment_highAvailabilityConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironment' {Maybe HighAvailabilityConfig
highAvailabilityConfig :: Maybe HighAvailabilityConfig
$sel:highAvailabilityConfig:CreateEnvironment' :: CreateEnvironment -> Maybe HighAvailabilityConfig
highAvailabilityConfig} -> Maybe HighAvailabilityConfig
highAvailabilityConfig) (\s :: CreateEnvironment
s@CreateEnvironment' {} Maybe HighAvailabilityConfig
a -> CreateEnvironment
s {$sel:highAvailabilityConfig:CreateEnvironment' :: Maybe HighAvailabilityConfig
highAvailabilityConfig = Maybe HighAvailabilityConfig
a} :: CreateEnvironment)

-- | The identifier of a customer managed key.
createEnvironment_kmsKeyId :: Lens.Lens' CreateEnvironment (Prelude.Maybe Prelude.Text)
createEnvironment_kmsKeyId :: Lens' CreateEnvironment (Maybe Text)
createEnvironment_kmsKeyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironment' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:CreateEnvironment' :: CreateEnvironment -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: CreateEnvironment
s@CreateEnvironment' {} Maybe Text
a -> CreateEnvironment
s {$sel:kmsKeyId:CreateEnvironment' :: Maybe Text
kmsKeyId = Maybe Text
a} :: CreateEnvironment)

-- | Configures the maintenance window you want for the runtime environment.
-- If you do not provide a value, a random system-generated value will be
-- assigned.
createEnvironment_preferredMaintenanceWindow :: Lens.Lens' CreateEnvironment (Prelude.Maybe Prelude.Text)
createEnvironment_preferredMaintenanceWindow :: Lens' CreateEnvironment (Maybe Text)
createEnvironment_preferredMaintenanceWindow = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironment' {Maybe Text
preferredMaintenanceWindow :: Maybe Text
$sel:preferredMaintenanceWindow:CreateEnvironment' :: CreateEnvironment -> Maybe Text
preferredMaintenanceWindow} -> Maybe Text
preferredMaintenanceWindow) (\s :: CreateEnvironment
s@CreateEnvironment' {} Maybe Text
a -> CreateEnvironment
s {$sel:preferredMaintenanceWindow:CreateEnvironment' :: Maybe Text
preferredMaintenanceWindow = Maybe Text
a} :: CreateEnvironment)

-- | Specifies whether the runtime environment is publicly accessible.
createEnvironment_publiclyAccessible :: Lens.Lens' CreateEnvironment (Prelude.Maybe Prelude.Bool)
createEnvironment_publiclyAccessible :: Lens' CreateEnvironment (Maybe Bool)
createEnvironment_publiclyAccessible = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironment' {Maybe Bool
publiclyAccessible :: Maybe Bool
$sel:publiclyAccessible:CreateEnvironment' :: CreateEnvironment -> Maybe Bool
publiclyAccessible} -> Maybe Bool
publiclyAccessible) (\s :: CreateEnvironment
s@CreateEnvironment' {} Maybe Bool
a -> CreateEnvironment
s {$sel:publiclyAccessible:CreateEnvironment' :: Maybe Bool
publiclyAccessible = Maybe Bool
a} :: CreateEnvironment)

-- | The list of security groups for the VPC associated with this runtime
-- environment.
createEnvironment_securityGroupIds :: Lens.Lens' CreateEnvironment (Prelude.Maybe [Prelude.Text])
createEnvironment_securityGroupIds :: Lens' CreateEnvironment (Maybe [Text])
createEnvironment_securityGroupIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironment' {Maybe [Text]
securityGroupIds :: Maybe [Text]
$sel:securityGroupIds:CreateEnvironment' :: CreateEnvironment -> Maybe [Text]
securityGroupIds} -> Maybe [Text]
securityGroupIds) (\s :: CreateEnvironment
s@CreateEnvironment' {} Maybe [Text]
a -> CreateEnvironment
s {$sel:securityGroupIds:CreateEnvironment' :: Maybe [Text]
securityGroupIds = Maybe [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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Optional. The storage configurations for this runtime environment.
createEnvironment_storageConfigurations :: Lens.Lens' CreateEnvironment (Prelude.Maybe [StorageConfiguration])
createEnvironment_storageConfigurations :: Lens' CreateEnvironment (Maybe [StorageConfiguration])
createEnvironment_storageConfigurations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironment' {Maybe [StorageConfiguration]
storageConfigurations :: Maybe [StorageConfiguration]
$sel:storageConfigurations:CreateEnvironment' :: CreateEnvironment -> Maybe [StorageConfiguration]
storageConfigurations} -> Maybe [StorageConfiguration]
storageConfigurations) (\s :: CreateEnvironment
s@CreateEnvironment' {} Maybe [StorageConfiguration]
a -> CreateEnvironment
s {$sel:storageConfigurations:CreateEnvironment' :: Maybe [StorageConfiguration]
storageConfigurations = Maybe [StorageConfiguration]
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 list of subnets associated with the VPC for this runtime
-- environment.
createEnvironment_subnetIds :: Lens.Lens' CreateEnvironment (Prelude.Maybe [Prelude.Text])
createEnvironment_subnetIds :: Lens' CreateEnvironment (Maybe [Text])
createEnvironment_subnetIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironment' {Maybe [Text]
subnetIds :: Maybe [Text]
$sel:subnetIds:CreateEnvironment' :: CreateEnvironment -> Maybe [Text]
subnetIds} -> Maybe [Text]
subnetIds) (\s :: CreateEnvironment
s@CreateEnvironment' {} Maybe [Text]
a -> CreateEnvironment
s {$sel:subnetIds:CreateEnvironment' :: Maybe [Text]
subnetIds = Maybe [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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The tags for the runtime environment.
createEnvironment_tags :: Lens.Lens' CreateEnvironment (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createEnvironment_tags :: Lens' CreateEnvironment (Maybe (HashMap Text Text))
createEnvironment_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironment' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateEnvironment' :: CreateEnvironment -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateEnvironment
s@CreateEnvironment' {} Maybe (HashMap Text Text)
a -> CreateEnvironment
s {$sel:tags:CreateEnvironment' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The engine type for the runtime environment.
createEnvironment_engineType :: Lens.Lens' CreateEnvironment EngineType
createEnvironment_engineType :: Lens' CreateEnvironment EngineType
createEnvironment_engineType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironment' {EngineType
engineType :: EngineType
$sel:engineType:CreateEnvironment' :: CreateEnvironment -> EngineType
engineType} -> EngineType
engineType) (\s :: CreateEnvironment
s@CreateEnvironment' {} EngineType
a -> CreateEnvironment
s {$sel:engineType:CreateEnvironment' :: EngineType
engineType = EngineType
a} :: CreateEnvironment)

-- | The type of instance for the runtime environment.
createEnvironment_instanceType :: Lens.Lens' CreateEnvironment Prelude.Text
createEnvironment_instanceType :: Lens' CreateEnvironment Text
createEnvironment_instanceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironment' {Text
instanceType :: Text
$sel:instanceType:CreateEnvironment' :: CreateEnvironment -> Text
instanceType} -> Text
instanceType) (\s :: CreateEnvironment
s@CreateEnvironment' {} Text
a -> CreateEnvironment
s {$sel:instanceType:CreateEnvironment' :: Text
instanceType = Text
a} :: CreateEnvironment)

-- | The name of the runtime environment. Must be unique within the account.
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)

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 -> Text -> 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
"environmentId")
      )

instance Prelude.Hashable CreateEnvironment where
  hashWithSalt :: Int -> CreateEnvironment -> Int
hashWithSalt Int
_salt CreateEnvironment' {Maybe Bool
Maybe [Text]
Maybe [StorageConfiguration]
Maybe Text
Maybe (HashMap Text Text)
Maybe HighAvailabilityConfig
Text
EngineType
name :: Text
instanceType :: Text
engineType :: EngineType
tags :: Maybe (HashMap Text Text)
subnetIds :: Maybe [Text]
storageConfigurations :: Maybe [StorageConfiguration]
securityGroupIds :: Maybe [Text]
publiclyAccessible :: Maybe Bool
preferredMaintenanceWindow :: Maybe Text
kmsKeyId :: Maybe Text
highAvailabilityConfig :: Maybe HighAvailabilityConfig
engineVersion :: Maybe Text
description :: Maybe Text
clientToken :: Maybe Text
$sel:name:CreateEnvironment' :: CreateEnvironment -> Text
$sel:instanceType:CreateEnvironment' :: CreateEnvironment -> Text
$sel:engineType:CreateEnvironment' :: CreateEnvironment -> EngineType
$sel:tags:CreateEnvironment' :: CreateEnvironment -> Maybe (HashMap Text Text)
$sel:subnetIds:CreateEnvironment' :: CreateEnvironment -> Maybe [Text]
$sel:storageConfigurations:CreateEnvironment' :: CreateEnvironment -> Maybe [StorageConfiguration]
$sel:securityGroupIds:CreateEnvironment' :: CreateEnvironment -> Maybe [Text]
$sel:publiclyAccessible:CreateEnvironment' :: CreateEnvironment -> Maybe Bool
$sel:preferredMaintenanceWindow:CreateEnvironment' :: CreateEnvironment -> Maybe Text
$sel:kmsKeyId:CreateEnvironment' :: CreateEnvironment -> Maybe Text
$sel:highAvailabilityConfig:CreateEnvironment' :: CreateEnvironment -> Maybe HighAvailabilityConfig
$sel:engineVersion:CreateEnvironment' :: CreateEnvironment -> Maybe Text
$sel:description:CreateEnvironment' :: CreateEnvironment -> Maybe Text
$sel:clientToken:CreateEnvironment' :: CreateEnvironment -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
engineVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe HighAvailabilityConfig
highAvailabilityConfig
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
kmsKeyId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
preferredMaintenanceWindow
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
publiclyAccessible
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
securityGroupIds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [StorageConfiguration]
storageConfigurations
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
subnetIds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` EngineType
engineType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
instanceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

instance Prelude.NFData CreateEnvironment where
  rnf :: CreateEnvironment -> ()
rnf CreateEnvironment' {Maybe Bool
Maybe [Text]
Maybe [StorageConfiguration]
Maybe Text
Maybe (HashMap Text Text)
Maybe HighAvailabilityConfig
Text
EngineType
name :: Text
instanceType :: Text
engineType :: EngineType
tags :: Maybe (HashMap Text Text)
subnetIds :: Maybe [Text]
storageConfigurations :: Maybe [StorageConfiguration]
securityGroupIds :: Maybe [Text]
publiclyAccessible :: Maybe Bool
preferredMaintenanceWindow :: Maybe Text
kmsKeyId :: Maybe Text
highAvailabilityConfig :: Maybe HighAvailabilityConfig
engineVersion :: Maybe Text
description :: Maybe Text
clientToken :: Maybe Text
$sel:name:CreateEnvironment' :: CreateEnvironment -> Text
$sel:instanceType:CreateEnvironment' :: CreateEnvironment -> Text
$sel:engineType:CreateEnvironment' :: CreateEnvironment -> EngineType
$sel:tags:CreateEnvironment' :: CreateEnvironment -> Maybe (HashMap Text Text)
$sel:subnetIds:CreateEnvironment' :: CreateEnvironment -> Maybe [Text]
$sel:storageConfigurations:CreateEnvironment' :: CreateEnvironment -> Maybe [StorageConfiguration]
$sel:securityGroupIds:CreateEnvironment' :: CreateEnvironment -> Maybe [Text]
$sel:publiclyAccessible:CreateEnvironment' :: CreateEnvironment -> Maybe Bool
$sel:preferredMaintenanceWindow:CreateEnvironment' :: CreateEnvironment -> Maybe Text
$sel:kmsKeyId:CreateEnvironment' :: CreateEnvironment -> Maybe Text
$sel:highAvailabilityConfig:CreateEnvironment' :: CreateEnvironment -> Maybe HighAvailabilityConfig
$sel:engineVersion:CreateEnvironment' :: CreateEnvironment -> Maybe Text
$sel:description:CreateEnvironment' :: CreateEnvironment -> Maybe Text
$sel:clientToken:CreateEnvironment' :: CreateEnvironment -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
engineVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe HighAvailabilityConfig
highAvailabilityConfig
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
kmsKeyId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
preferredMaintenanceWindow
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
publiclyAccessible
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
securityGroupIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [StorageConfiguration]
storageConfigurations
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
subnetIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf EngineType
engineType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
instanceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name

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
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON CreateEnvironment where
  toJSON :: CreateEnvironment -> Value
toJSON CreateEnvironment' {Maybe Bool
Maybe [Text]
Maybe [StorageConfiguration]
Maybe Text
Maybe (HashMap Text Text)
Maybe HighAvailabilityConfig
Text
EngineType
name :: Text
instanceType :: Text
engineType :: EngineType
tags :: Maybe (HashMap Text Text)
subnetIds :: Maybe [Text]
storageConfigurations :: Maybe [StorageConfiguration]
securityGroupIds :: Maybe [Text]
publiclyAccessible :: Maybe Bool
preferredMaintenanceWindow :: Maybe Text
kmsKeyId :: Maybe Text
highAvailabilityConfig :: Maybe HighAvailabilityConfig
engineVersion :: Maybe Text
description :: Maybe Text
clientToken :: Maybe Text
$sel:name:CreateEnvironment' :: CreateEnvironment -> Text
$sel:instanceType:CreateEnvironment' :: CreateEnvironment -> Text
$sel:engineType:CreateEnvironment' :: CreateEnvironment -> EngineType
$sel:tags:CreateEnvironment' :: CreateEnvironment -> Maybe (HashMap Text Text)
$sel:subnetIds:CreateEnvironment' :: CreateEnvironment -> Maybe [Text]
$sel:storageConfigurations:CreateEnvironment' :: CreateEnvironment -> Maybe [StorageConfiguration]
$sel:securityGroupIds:CreateEnvironment' :: CreateEnvironment -> Maybe [Text]
$sel:publiclyAccessible:CreateEnvironment' :: CreateEnvironment -> Maybe Bool
$sel:preferredMaintenanceWindow:CreateEnvironment' :: CreateEnvironment -> Maybe Text
$sel:kmsKeyId:CreateEnvironment' :: CreateEnvironment -> Maybe Text
$sel:highAvailabilityConfig:CreateEnvironment' :: CreateEnvironment -> Maybe HighAvailabilityConfig
$sel:engineVersion:CreateEnvironment' :: CreateEnvironment -> Maybe Text
$sel:description:CreateEnvironment' :: CreateEnvironment -> Maybe Text
$sel:clientToken:CreateEnvironment' :: CreateEnvironment -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"clientToken" 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
clientToken,
            (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 Text
description,
            (Key
"engineVersion" 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
engineVersion,
            (Key
"highAvailabilityConfig" 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 HighAvailabilityConfig
highAvailabilityConfig,
            (Key
"kmsKeyId" 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
kmsKeyId,
            (Key
"preferredMaintenanceWindow" 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
preferredMaintenanceWindow,
            (Key
"publiclyAccessible" 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
publiclyAccessible,
            (Key
"securityGroupIds" 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]
securityGroupIds,
            (Key
"storageConfigurations" 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 [StorageConfiguration]
storageConfigurations,
            (Key
"subnetIds" 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]
subnetIds,
            (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 (HashMap Text Text)
tags,
            forall a. a -> Maybe a
Prelude.Just (Key
"engineType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= EngineType
engineType),
            forall a. a -> Maybe a
Prelude.Just (Key
"instanceType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
instanceType),
            forall a. a -> Maybe a
Prelude.Just (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)
          ]
      )

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

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 unique identifier of the runtime environment.
    CreateEnvironmentResponse -> Text
environmentId :: Prelude.Text
  }
  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, ReadPrec [CreateEnvironmentResponse]
ReadPrec CreateEnvironmentResponse
Int -> ReadS CreateEnvironmentResponse
ReadS [CreateEnvironmentResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateEnvironmentResponse]
$creadListPrec :: ReadPrec [CreateEnvironmentResponse]
readPrec :: ReadPrec CreateEnvironmentResponse
$creadPrec :: ReadPrec CreateEnvironmentResponse
readList :: ReadS [CreateEnvironmentResponse]
$creadList :: ReadS [CreateEnvironmentResponse]
readsPrec :: Int -> ReadS CreateEnvironmentResponse
$creadsPrec :: Int -> ReadS CreateEnvironmentResponse
Prelude.Read, 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.
--
-- 'environmentId', 'createEnvironmentResponse_environmentId' - The unique identifier of the runtime environment.
newCreateEnvironmentResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'environmentId'
  Prelude.Text ->
  CreateEnvironmentResponse
newCreateEnvironmentResponse :: Int -> Text -> CreateEnvironmentResponse
newCreateEnvironmentResponse
  Int
pHttpStatus_
  Text
pEnvironmentId_ =
    CreateEnvironmentResponse'
      { $sel:httpStatus:CreateEnvironmentResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:environmentId:CreateEnvironmentResponse' :: Text
environmentId = Text
pEnvironmentId_
      }

-- | 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 unique identifier of the runtime environment.
createEnvironmentResponse_environmentId :: Lens.Lens' CreateEnvironmentResponse Prelude.Text
createEnvironmentResponse_environmentId :: Lens' CreateEnvironmentResponse Text
createEnvironmentResponse_environmentId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironmentResponse' {Text
environmentId :: Text
$sel:environmentId:CreateEnvironmentResponse' :: CreateEnvironmentResponse -> Text
environmentId} -> Text
environmentId) (\s :: CreateEnvironmentResponse
s@CreateEnvironmentResponse' {} Text
a -> CreateEnvironmentResponse
s {$sel:environmentId:CreateEnvironmentResponse' :: Text
environmentId = Text
a} :: CreateEnvironmentResponse)

instance Prelude.NFData CreateEnvironmentResponse where
  rnf :: CreateEnvironmentResponse -> ()
rnf CreateEnvironmentResponse' {Int
Text
environmentId :: Text
httpStatus :: Int
$sel:environmentId:CreateEnvironmentResponse' :: CreateEnvironmentResponse -> Text
$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 Text
environmentId