{-# 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.OpsWorksCM.CreateServer
-- 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 and immedately starts a new server. The server is ready to use
-- when it is in the @HEALTHY@ state. By default, you can create a maximum
-- of 10 servers.
--
-- This operation is asynchronous.
--
-- A @LimitExceededException@ is thrown when you have created the maximum
-- number of servers (10). A @ResourceAlreadyExistsException@ is thrown
-- when a server with the same name already exists in the account. A
-- @ResourceNotFoundException@ is thrown when you specify a backup ID that
-- is not valid or is for a backup that does not exist. A
-- @ValidationException@ is thrown when parameters of the request are not
-- valid.
--
-- If you do not specify a security group by adding the @SecurityGroupIds@
-- parameter, AWS OpsWorks creates a new security group.
--
-- /Chef Automate:/ The default security group opens the Chef server to the
-- world on TCP port 443. If a KeyName is present, AWS OpsWorks enables SSH
-- access. SSH is also open to the world on TCP port 22.
--
-- /Puppet Enterprise:/ The default security group opens TCP ports 22, 443,
-- 4433, 8140, 8142, 8143, and 8170. If a KeyName is present, AWS OpsWorks
-- enables SSH access. SSH is also open to the world on TCP port 22.
--
-- By default, your server is accessible from any IP address. We recommend
-- that you update your security group rules to allow access from known IP
-- addresses and address ranges only. To edit security group rules, open
-- Security Groups in the navigation pane of the EC2 management console.
--
-- To specify your own domain for a server, and provide your own
-- self-signed or CA-signed certificate and private key, specify values for
-- @CustomDomain@, @CustomCertificate@, and @CustomPrivateKey@.
module Amazonka.OpsWorksCM.CreateServer
  ( -- * Creating a Request
    CreateServer (..),
    newCreateServer,

    -- * Request Lenses
    createServer_associatePublicIpAddress,
    createServer_backupId,
    createServer_backupRetentionCount,
    createServer_customCertificate,
    createServer_customDomain,
    createServer_customPrivateKey,
    createServer_disableAutomatedBackup,
    createServer_engineAttributes,
    createServer_engineModel,
    createServer_engineVersion,
    createServer_keyPair,
    createServer_preferredBackupWindow,
    createServer_preferredMaintenanceWindow,
    createServer_securityGroupIds,
    createServer_subnetIds,
    createServer_tags,
    createServer_engine,
    createServer_serverName,
    createServer_instanceProfileArn,
    createServer_instanceType,
    createServer_serviceRoleArn,

    -- * Destructuring the Response
    CreateServerResponse (..),
    newCreateServerResponse,

    -- * Response Lenses
    createServerResponse_server,
    createServerResponse_httpStatus,
  )
where

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

-- | /See:/ 'newCreateServer' smart constructor.
data CreateServer = CreateServer'
  { -- | Associate a public IP address with a server that you are launching.
    -- Valid values are @true@ or @false@. The default value is @true@.
    CreateServer -> Maybe Bool
associatePublicIpAddress :: Prelude.Maybe Prelude.Bool,
    -- | If you specify this field, AWS OpsWorks CM creates the server by using
    -- the backup represented by BackupId.
    CreateServer -> Maybe Text
backupId :: Prelude.Maybe Prelude.Text,
    -- | The number of automated backups that you want to keep. Whenever a new
    -- backup is created, AWS OpsWorks CM deletes the oldest backups if this
    -- number is exceeded. The default value is @1@.
    CreateServer -> Maybe Natural
backupRetentionCount :: Prelude.Maybe Prelude.Natural,
    -- | A PEM-formatted HTTPS certificate. The value can be be a single,
    -- self-signed certificate, or a certificate chain. If you specify a custom
    -- certificate, you must also specify values for @CustomDomain@ and
    -- @CustomPrivateKey@. The following are requirements for the
    -- @CustomCertificate@ value:
    --
    -- -   You can provide either a self-signed, custom certificate, or the
    --     full certificate chain.
    --
    -- -   The certificate must be a valid X509 certificate, or a certificate
    --     chain in PEM format.
    --
    -- -   The certificate must be valid at the time of upload. A certificate
    --     can\'t be used before its validity period begins (the certificate\'s
    --     @NotBefore@ date), or after it expires (the certificate\'s
    --     @NotAfter@ date).
    --
    -- -   The certificate’s common name or subject alternative names (SANs),
    --     if present, must match the value of @CustomDomain@.
    --
    -- -   The certificate must match the value of @CustomPrivateKey@.
    CreateServer -> Maybe Text
customCertificate :: Prelude.Maybe Prelude.Text,
    -- | An optional public endpoint of a server, such as
    -- @https:\/\/aws.my-company.com@. To access the server, create a CNAME DNS
    -- record in your preferred DNS service that points the custom domain to
    -- the endpoint that is generated when the server is created (the value of
    -- the CreateServer Endpoint attribute). You cannot access the server by
    -- using the generated @Endpoint@ value if the server is using a custom
    -- domain. If you specify a custom domain, you must also specify values for
    -- @CustomCertificate@ and @CustomPrivateKey@.
    CreateServer -> Maybe Text
customDomain :: Prelude.Maybe Prelude.Text,
    -- | A private key in PEM format for connecting to the server by using HTTPS.
    -- The private key must not be encrypted; it cannot be protected by a
    -- password or passphrase. If you specify a custom private key, you must
    -- also specify values for @CustomDomain@ and @CustomCertificate@.
    CreateServer -> Maybe (Sensitive Text)
customPrivateKey :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | Enable or disable scheduled backups. Valid values are @true@ or @false@.
    -- The default value is @true@.
    CreateServer -> Maybe Bool
disableAutomatedBackup :: Prelude.Maybe Prelude.Bool,
    -- | Optional engine attributes on a specified server.
    --
    -- __Attributes accepted in a Chef createServer request:__
    --
    -- -   @CHEF_AUTOMATE_PIVOTAL_KEY@: A base64-encoded RSA public key. The
    --     corresponding private key is required to access the Chef API. When
    --     no CHEF_AUTOMATE_PIVOTAL_KEY is set, a private key is generated and
    --     returned in the response.
    --
    -- -   @CHEF_AUTOMATE_ADMIN_PASSWORD@: The password for the administrative
    --     user in the Chef Automate web-based dashboard. The password length
    --     is a minimum of eight characters, and a maximum of 32. The password
    --     can contain letters, numbers, and special characters
    --     (!\/\@#$%^&+=_). The password must contain at least one lower case
    --     letter, one upper case letter, one number, and one special
    --     character. When no CHEF_AUTOMATE_ADMIN_PASSWORD is set, one is
    --     generated and returned in the response.
    --
    -- __Attributes accepted in a Puppet createServer request:__
    --
    -- -   @PUPPET_ADMIN_PASSWORD@: To work with the Puppet Enterprise console,
    --     a password must use ASCII characters.
    --
    -- -   @PUPPET_R10K_REMOTE@: The r10k remote is the URL of your control
    --     repository (for example,
    --     ssh:\/\/git\@your.git-repo.com:user\/control-repo.git). Specifying
    --     an r10k remote opens TCP port 8170.
    --
    -- -   @PUPPET_R10K_PRIVATE_KEY@: If you are using a private Git
    --     repository, add PUPPET_R10K_PRIVATE_KEY to specify a PEM-encoded
    --     private SSH key.
    CreateServer -> Maybe [EngineAttribute]
engineAttributes :: Prelude.Maybe [EngineAttribute],
    -- | The engine model of the server. Valid values in this release include
    -- @Monolithic@ for Puppet and @Single@ for Chef.
    CreateServer -> Maybe Text
engineModel :: Prelude.Maybe Prelude.Text,
    -- | The major release version of the engine that you want to use. For a Chef
    -- server, the valid value for EngineVersion is currently @2@. For a Puppet
    -- server, valid values are @2019@ or @2017@.
    CreateServer -> Maybe Text
engineVersion :: Prelude.Maybe Prelude.Text,
    -- | The Amazon EC2 key pair to set for the instance. This parameter is
    -- optional; if desired, you may specify this parameter to connect to your
    -- instances by using SSH.
    CreateServer -> Maybe Text
keyPair :: Prelude.Maybe Prelude.Text,
    -- | The start time for a one-hour period during which AWS OpsWorks CM backs
    -- up application-level data on your server if automated backups are
    -- enabled. Valid values must be specified in one of the following formats:
    --
    -- -   @HH:MM@ for daily backups
    --
    -- -   @DDD:HH:MM@ for weekly backups
    --
    -- @MM@ must be specified as @00@. The specified time is in coordinated
    -- universal time (UTC). The default value is a random, daily start time.
    --
    -- __Example:__ @08:00@, which represents a daily start time of 08:00 UTC.
    --
    -- __Example:__ @Mon:08:00@, which represents a start time of every Monday
    -- at 08:00 UTC. (8:00 a.m.)
    CreateServer -> Maybe Text
preferredBackupWindow :: Prelude.Maybe Prelude.Text,
    -- | The start time for a one-hour period each week during which AWS OpsWorks
    -- CM performs maintenance on the instance. Valid values must be specified
    -- in the following format: @DDD:HH:MM@. @MM@ must be specified as @00@.
    -- The specified time is in coordinated universal time (UTC). The default
    -- value is a random one-hour period on Tuesday, Wednesday, or Friday. See
    -- @TimeWindowDefinition@ for more information.
    --
    -- __Example:__ @Mon:08:00@, which represents a start time of every Monday
    -- at 08:00 UTC. (8:00 a.m.)
    CreateServer -> Maybe Text
preferredMaintenanceWindow :: Prelude.Maybe Prelude.Text,
    -- | A list of security group IDs to attach to the Amazon EC2 instance. If
    -- you add this parameter, the specified security groups must be within the
    -- VPC that is specified by @SubnetIds@.
    --
    -- If you do not specify this parameter, AWS OpsWorks CM creates one new
    -- security group that uses TCP ports 22 and 443, open to 0.0.0.0\/0
    -- (everyone).
    CreateServer -> Maybe [Text]
securityGroupIds :: Prelude.Maybe [Prelude.Text],
    -- | The IDs of subnets in which to launch the server EC2 instance.
    --
    -- Amazon EC2-Classic customers: This field is required. All servers must
    -- run within a VPC. The VPC must have \"Auto Assign Public IP\" enabled.
    --
    -- EC2-VPC customers: This field is optional. If you do not specify subnet
    -- IDs, your EC2 instances are created in a default subnet that is selected
    -- by Amazon EC2. If you specify subnet IDs, the VPC must have \"Auto
    -- Assign Public IP\" enabled.
    --
    -- For more information about supported Amazon EC2 platforms, see
    -- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-supported-platforms.html Supported Platforms>.
    CreateServer -> Maybe [Text]
subnetIds :: Prelude.Maybe [Prelude.Text],
    -- | A map that contains tag keys and tag values to attach to an AWS OpsWorks
    -- for Chef Automate or AWS OpsWorks for Puppet Enterprise server.
    --
    -- -   The key cannot be empty.
    --
    -- -   The key can be a maximum of 127 characters, and can contain only
    --     Unicode letters, numbers, or separators, or the following special
    --     characters: @+ - = . _ : \/ \@@
    --
    -- -   The value can be a maximum 255 characters, and contain only Unicode
    --     letters, numbers, or separators, or the following special
    --     characters: @+ - = . _ : \/ \@@
    --
    -- -   Leading and trailing white spaces are trimmed from both the key and
    --     value.
    --
    -- -   A maximum of 50 user-applied tags is allowed for any AWS OpsWorks-CM
    --     server.
    CreateServer -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The configuration management engine to use. Valid values include
    -- @ChefAutomate@ and @Puppet@.
    CreateServer -> Text
engine :: Prelude.Text,
    -- | The name of the server. The server name must be unique within your AWS
    -- account, within each region. Server names must start with a letter; then
    -- letters, numbers, or hyphens (-) are allowed, up to a maximum of 40
    -- characters.
    CreateServer -> Text
serverName :: Prelude.Text,
    -- | The ARN of the instance profile that your Amazon EC2 instances use.
    -- Although the AWS OpsWorks console typically creates the instance profile
    -- for you, if you are using API commands instead, run the
    -- service-role-creation.yaml AWS CloudFormation template, located at
    -- https:\/\/s3.amazonaws.com\/opsworks-cm-us-east-1-prod-default-assets\/misc\/opsworks-cm-roles.yaml.
    -- This template creates a CloudFormation stack that includes the instance
    -- profile you need.
    CreateServer -> Text
instanceProfileArn :: Prelude.Text,
    -- | The Amazon EC2 instance type to use. For example, @m5.large@.
    CreateServer -> Text
instanceType :: Prelude.Text,
    -- | The service role that the AWS OpsWorks CM service backend uses to work
    -- with your account. Although the AWS OpsWorks management console
    -- typically creates the service role for you, if you are using the AWS CLI
    -- or API commands, run the service-role-creation.yaml AWS CloudFormation
    -- template, located at
    -- https:\/\/s3.amazonaws.com\/opsworks-cm-us-east-1-prod-default-assets\/misc\/opsworks-cm-roles.yaml.
    -- This template creates a CloudFormation stack that includes the service
    -- role and instance profile that you need.
    CreateServer -> Text
serviceRoleArn :: Prelude.Text
  }
  deriving (CreateServer -> CreateServer -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateServer -> CreateServer -> Bool
$c/= :: CreateServer -> CreateServer -> Bool
== :: CreateServer -> CreateServer -> Bool
$c== :: CreateServer -> CreateServer -> Bool
Prelude.Eq, Int -> CreateServer -> ShowS
[CreateServer] -> ShowS
CreateServer -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateServer] -> ShowS
$cshowList :: [CreateServer] -> ShowS
show :: CreateServer -> String
$cshow :: CreateServer -> String
showsPrec :: Int -> CreateServer -> ShowS
$cshowsPrec :: Int -> CreateServer -> ShowS
Prelude.Show, forall x. Rep CreateServer x -> CreateServer
forall x. CreateServer -> Rep CreateServer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateServer x -> CreateServer
$cfrom :: forall x. CreateServer -> Rep CreateServer x
Prelude.Generic)

-- |
-- Create a value of 'CreateServer' 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:
--
-- 'associatePublicIpAddress', 'createServer_associatePublicIpAddress' - Associate a public IP address with a server that you are launching.
-- Valid values are @true@ or @false@. The default value is @true@.
--
-- 'backupId', 'createServer_backupId' - If you specify this field, AWS OpsWorks CM creates the server by using
-- the backup represented by BackupId.
--
-- 'backupRetentionCount', 'createServer_backupRetentionCount' - The number of automated backups that you want to keep. Whenever a new
-- backup is created, AWS OpsWorks CM deletes the oldest backups if this
-- number is exceeded. The default value is @1@.
--
-- 'customCertificate', 'createServer_customCertificate' - A PEM-formatted HTTPS certificate. The value can be be a single,
-- self-signed certificate, or a certificate chain. If you specify a custom
-- certificate, you must also specify values for @CustomDomain@ and
-- @CustomPrivateKey@. The following are requirements for the
-- @CustomCertificate@ value:
--
-- -   You can provide either a self-signed, custom certificate, or the
--     full certificate chain.
--
-- -   The certificate must be a valid X509 certificate, or a certificate
--     chain in PEM format.
--
-- -   The certificate must be valid at the time of upload. A certificate
--     can\'t be used before its validity period begins (the certificate\'s
--     @NotBefore@ date), or after it expires (the certificate\'s
--     @NotAfter@ date).
--
-- -   The certificate’s common name or subject alternative names (SANs),
--     if present, must match the value of @CustomDomain@.
--
-- -   The certificate must match the value of @CustomPrivateKey@.
--
-- 'customDomain', 'createServer_customDomain' - An optional public endpoint of a server, such as
-- @https:\/\/aws.my-company.com@. To access the server, create a CNAME DNS
-- record in your preferred DNS service that points the custom domain to
-- the endpoint that is generated when the server is created (the value of
-- the CreateServer Endpoint attribute). You cannot access the server by
-- using the generated @Endpoint@ value if the server is using a custom
-- domain. If you specify a custom domain, you must also specify values for
-- @CustomCertificate@ and @CustomPrivateKey@.
--
-- 'customPrivateKey', 'createServer_customPrivateKey' - A private key in PEM format for connecting to the server by using HTTPS.
-- The private key must not be encrypted; it cannot be protected by a
-- password or passphrase. If you specify a custom private key, you must
-- also specify values for @CustomDomain@ and @CustomCertificate@.
--
-- 'disableAutomatedBackup', 'createServer_disableAutomatedBackup' - Enable or disable scheduled backups. Valid values are @true@ or @false@.
-- The default value is @true@.
--
-- 'engineAttributes', 'createServer_engineAttributes' - Optional engine attributes on a specified server.
--
-- __Attributes accepted in a Chef createServer request:__
--
-- -   @CHEF_AUTOMATE_PIVOTAL_KEY@: A base64-encoded RSA public key. The
--     corresponding private key is required to access the Chef API. When
--     no CHEF_AUTOMATE_PIVOTAL_KEY is set, a private key is generated and
--     returned in the response.
--
-- -   @CHEF_AUTOMATE_ADMIN_PASSWORD@: The password for the administrative
--     user in the Chef Automate web-based dashboard. The password length
--     is a minimum of eight characters, and a maximum of 32. The password
--     can contain letters, numbers, and special characters
--     (!\/\@#$%^&+=_). The password must contain at least one lower case
--     letter, one upper case letter, one number, and one special
--     character. When no CHEF_AUTOMATE_ADMIN_PASSWORD is set, one is
--     generated and returned in the response.
--
-- __Attributes accepted in a Puppet createServer request:__
--
-- -   @PUPPET_ADMIN_PASSWORD@: To work with the Puppet Enterprise console,
--     a password must use ASCII characters.
--
-- -   @PUPPET_R10K_REMOTE@: The r10k remote is the URL of your control
--     repository (for example,
--     ssh:\/\/git\@your.git-repo.com:user\/control-repo.git). Specifying
--     an r10k remote opens TCP port 8170.
--
-- -   @PUPPET_R10K_PRIVATE_KEY@: If you are using a private Git
--     repository, add PUPPET_R10K_PRIVATE_KEY to specify a PEM-encoded
--     private SSH key.
--
-- 'engineModel', 'createServer_engineModel' - The engine model of the server. Valid values in this release include
-- @Monolithic@ for Puppet and @Single@ for Chef.
--
-- 'engineVersion', 'createServer_engineVersion' - The major release version of the engine that you want to use. For a Chef
-- server, the valid value for EngineVersion is currently @2@. For a Puppet
-- server, valid values are @2019@ or @2017@.
--
-- 'keyPair', 'createServer_keyPair' - The Amazon EC2 key pair to set for the instance. This parameter is
-- optional; if desired, you may specify this parameter to connect to your
-- instances by using SSH.
--
-- 'preferredBackupWindow', 'createServer_preferredBackupWindow' - The start time for a one-hour period during which AWS OpsWorks CM backs
-- up application-level data on your server if automated backups are
-- enabled. Valid values must be specified in one of the following formats:
--
-- -   @HH:MM@ for daily backups
--
-- -   @DDD:HH:MM@ for weekly backups
--
-- @MM@ must be specified as @00@. The specified time is in coordinated
-- universal time (UTC). The default value is a random, daily start time.
--
-- __Example:__ @08:00@, which represents a daily start time of 08:00 UTC.
--
-- __Example:__ @Mon:08:00@, which represents a start time of every Monday
-- at 08:00 UTC. (8:00 a.m.)
--
-- 'preferredMaintenanceWindow', 'createServer_preferredMaintenanceWindow' - The start time for a one-hour period each week during which AWS OpsWorks
-- CM performs maintenance on the instance. Valid values must be specified
-- in the following format: @DDD:HH:MM@. @MM@ must be specified as @00@.
-- The specified time is in coordinated universal time (UTC). The default
-- value is a random one-hour period on Tuesday, Wednesday, or Friday. See
-- @TimeWindowDefinition@ for more information.
--
-- __Example:__ @Mon:08:00@, which represents a start time of every Monday
-- at 08:00 UTC. (8:00 a.m.)
--
-- 'securityGroupIds', 'createServer_securityGroupIds' - A list of security group IDs to attach to the Amazon EC2 instance. If
-- you add this parameter, the specified security groups must be within the
-- VPC that is specified by @SubnetIds@.
--
-- If you do not specify this parameter, AWS OpsWorks CM creates one new
-- security group that uses TCP ports 22 and 443, open to 0.0.0.0\/0
-- (everyone).
--
-- 'subnetIds', 'createServer_subnetIds' - The IDs of subnets in which to launch the server EC2 instance.
--
-- Amazon EC2-Classic customers: This field is required. All servers must
-- run within a VPC. The VPC must have \"Auto Assign Public IP\" enabled.
--
-- EC2-VPC customers: This field is optional. If you do not specify subnet
-- IDs, your EC2 instances are created in a default subnet that is selected
-- by Amazon EC2. If you specify subnet IDs, the VPC must have \"Auto
-- Assign Public IP\" enabled.
--
-- For more information about supported Amazon EC2 platforms, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-supported-platforms.html Supported Platforms>.
--
-- 'tags', 'createServer_tags' - A map that contains tag keys and tag values to attach to an AWS OpsWorks
-- for Chef Automate or AWS OpsWorks for Puppet Enterprise server.
--
-- -   The key cannot be empty.
--
-- -   The key can be a maximum of 127 characters, and can contain only
--     Unicode letters, numbers, or separators, or the following special
--     characters: @+ - = . _ : \/ \@@
--
-- -   The value can be a maximum 255 characters, and contain only Unicode
--     letters, numbers, or separators, or the following special
--     characters: @+ - = . _ : \/ \@@
--
-- -   Leading and trailing white spaces are trimmed from both the key and
--     value.
--
-- -   A maximum of 50 user-applied tags is allowed for any AWS OpsWorks-CM
--     server.
--
-- 'engine', 'createServer_engine' - The configuration management engine to use. Valid values include
-- @ChefAutomate@ and @Puppet@.
--
-- 'serverName', 'createServer_serverName' - The name of the server. The server name must be unique within your AWS
-- account, within each region. Server names must start with a letter; then
-- letters, numbers, or hyphens (-) are allowed, up to a maximum of 40
-- characters.
--
-- 'instanceProfileArn', 'createServer_instanceProfileArn' - The ARN of the instance profile that your Amazon EC2 instances use.
-- Although the AWS OpsWorks console typically creates the instance profile
-- for you, if you are using API commands instead, run the
-- service-role-creation.yaml AWS CloudFormation template, located at
-- https:\/\/s3.amazonaws.com\/opsworks-cm-us-east-1-prod-default-assets\/misc\/opsworks-cm-roles.yaml.
-- This template creates a CloudFormation stack that includes the instance
-- profile you need.
--
-- 'instanceType', 'createServer_instanceType' - The Amazon EC2 instance type to use. For example, @m5.large@.
--
-- 'serviceRoleArn', 'createServer_serviceRoleArn' - The service role that the AWS OpsWorks CM service backend uses to work
-- with your account. Although the AWS OpsWorks management console
-- typically creates the service role for you, if you are using the AWS CLI
-- or API commands, run the service-role-creation.yaml AWS CloudFormation
-- template, located at
-- https:\/\/s3.amazonaws.com\/opsworks-cm-us-east-1-prod-default-assets\/misc\/opsworks-cm-roles.yaml.
-- This template creates a CloudFormation stack that includes the service
-- role and instance profile that you need.
newCreateServer ::
  -- | 'engine'
  Prelude.Text ->
  -- | 'serverName'
  Prelude.Text ->
  -- | 'instanceProfileArn'
  Prelude.Text ->
  -- | 'instanceType'
  Prelude.Text ->
  -- | 'serviceRoleArn'
  Prelude.Text ->
  CreateServer
newCreateServer :: Text -> Text -> Text -> Text -> Text -> CreateServer
newCreateServer
  Text
pEngine_
  Text
pServerName_
  Text
pInstanceProfileArn_
  Text
pInstanceType_
  Text
pServiceRoleArn_ =
    CreateServer'
      { $sel:associatePublicIpAddress:CreateServer' :: Maybe Bool
associatePublicIpAddress =
          forall a. Maybe a
Prelude.Nothing,
        $sel:backupId:CreateServer' :: Maybe Text
backupId = forall a. Maybe a
Prelude.Nothing,
        $sel:backupRetentionCount:CreateServer' :: Maybe Natural
backupRetentionCount = forall a. Maybe a
Prelude.Nothing,
        $sel:customCertificate:CreateServer' :: Maybe Text
customCertificate = forall a. Maybe a
Prelude.Nothing,
        $sel:customDomain:CreateServer' :: Maybe Text
customDomain = forall a. Maybe a
Prelude.Nothing,
        $sel:customPrivateKey:CreateServer' :: Maybe (Sensitive Text)
customPrivateKey = forall a. Maybe a
Prelude.Nothing,
        $sel:disableAutomatedBackup:CreateServer' :: Maybe Bool
disableAutomatedBackup = forall a. Maybe a
Prelude.Nothing,
        $sel:engineAttributes:CreateServer' :: Maybe [EngineAttribute]
engineAttributes = forall a. Maybe a
Prelude.Nothing,
        $sel:engineModel:CreateServer' :: Maybe Text
engineModel = forall a. Maybe a
Prelude.Nothing,
        $sel:engineVersion:CreateServer' :: Maybe Text
engineVersion = forall a. Maybe a
Prelude.Nothing,
        $sel:keyPair:CreateServer' :: Maybe Text
keyPair = forall a. Maybe a
Prelude.Nothing,
        $sel:preferredBackupWindow:CreateServer' :: Maybe Text
preferredBackupWindow = forall a. Maybe a
Prelude.Nothing,
        $sel:preferredMaintenanceWindow:CreateServer' :: Maybe Text
preferredMaintenanceWindow = forall a. Maybe a
Prelude.Nothing,
        $sel:securityGroupIds:CreateServer' :: Maybe [Text]
securityGroupIds = forall a. Maybe a
Prelude.Nothing,
        $sel:subnetIds:CreateServer' :: Maybe [Text]
subnetIds = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateServer' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:engine:CreateServer' :: Text
engine = Text
pEngine_,
        $sel:serverName:CreateServer' :: Text
serverName = Text
pServerName_,
        $sel:instanceProfileArn:CreateServer' :: Text
instanceProfileArn = Text
pInstanceProfileArn_,
        $sel:instanceType:CreateServer' :: Text
instanceType = Text
pInstanceType_,
        $sel:serviceRoleArn:CreateServer' :: Text
serviceRoleArn = Text
pServiceRoleArn_
      }

-- | Associate a public IP address with a server that you are launching.
-- Valid values are @true@ or @false@. The default value is @true@.
createServer_associatePublicIpAddress :: Lens.Lens' CreateServer (Prelude.Maybe Prelude.Bool)
createServer_associatePublicIpAddress :: Lens' CreateServer (Maybe Bool)
createServer_associatePublicIpAddress = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Maybe Bool
associatePublicIpAddress :: Maybe Bool
$sel:associatePublicIpAddress:CreateServer' :: CreateServer -> Maybe Bool
associatePublicIpAddress} -> Maybe Bool
associatePublicIpAddress) (\s :: CreateServer
s@CreateServer' {} Maybe Bool
a -> CreateServer
s {$sel:associatePublicIpAddress:CreateServer' :: Maybe Bool
associatePublicIpAddress = Maybe Bool
a} :: CreateServer)

-- | If you specify this field, AWS OpsWorks CM creates the server by using
-- the backup represented by BackupId.
createServer_backupId :: Lens.Lens' CreateServer (Prelude.Maybe Prelude.Text)
createServer_backupId :: Lens' CreateServer (Maybe Text)
createServer_backupId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Maybe Text
backupId :: Maybe Text
$sel:backupId:CreateServer' :: CreateServer -> Maybe Text
backupId} -> Maybe Text
backupId) (\s :: CreateServer
s@CreateServer' {} Maybe Text
a -> CreateServer
s {$sel:backupId:CreateServer' :: Maybe Text
backupId = Maybe Text
a} :: CreateServer)

-- | The number of automated backups that you want to keep. Whenever a new
-- backup is created, AWS OpsWorks CM deletes the oldest backups if this
-- number is exceeded. The default value is @1@.
createServer_backupRetentionCount :: Lens.Lens' CreateServer (Prelude.Maybe Prelude.Natural)
createServer_backupRetentionCount :: Lens' CreateServer (Maybe Natural)
createServer_backupRetentionCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Maybe Natural
backupRetentionCount :: Maybe Natural
$sel:backupRetentionCount:CreateServer' :: CreateServer -> Maybe Natural
backupRetentionCount} -> Maybe Natural
backupRetentionCount) (\s :: CreateServer
s@CreateServer' {} Maybe Natural
a -> CreateServer
s {$sel:backupRetentionCount:CreateServer' :: Maybe Natural
backupRetentionCount = Maybe Natural
a} :: CreateServer)

-- | A PEM-formatted HTTPS certificate. The value can be be a single,
-- self-signed certificate, or a certificate chain. If you specify a custom
-- certificate, you must also specify values for @CustomDomain@ and
-- @CustomPrivateKey@. The following are requirements for the
-- @CustomCertificate@ value:
--
-- -   You can provide either a self-signed, custom certificate, or the
--     full certificate chain.
--
-- -   The certificate must be a valid X509 certificate, or a certificate
--     chain in PEM format.
--
-- -   The certificate must be valid at the time of upload. A certificate
--     can\'t be used before its validity period begins (the certificate\'s
--     @NotBefore@ date), or after it expires (the certificate\'s
--     @NotAfter@ date).
--
-- -   The certificate’s common name or subject alternative names (SANs),
--     if present, must match the value of @CustomDomain@.
--
-- -   The certificate must match the value of @CustomPrivateKey@.
createServer_customCertificate :: Lens.Lens' CreateServer (Prelude.Maybe Prelude.Text)
createServer_customCertificate :: Lens' CreateServer (Maybe Text)
createServer_customCertificate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Maybe Text
customCertificate :: Maybe Text
$sel:customCertificate:CreateServer' :: CreateServer -> Maybe Text
customCertificate} -> Maybe Text
customCertificate) (\s :: CreateServer
s@CreateServer' {} Maybe Text
a -> CreateServer
s {$sel:customCertificate:CreateServer' :: Maybe Text
customCertificate = Maybe Text
a} :: CreateServer)

-- | An optional public endpoint of a server, such as
-- @https:\/\/aws.my-company.com@. To access the server, create a CNAME DNS
-- record in your preferred DNS service that points the custom domain to
-- the endpoint that is generated when the server is created (the value of
-- the CreateServer Endpoint attribute). You cannot access the server by
-- using the generated @Endpoint@ value if the server is using a custom
-- domain. If you specify a custom domain, you must also specify values for
-- @CustomCertificate@ and @CustomPrivateKey@.
createServer_customDomain :: Lens.Lens' CreateServer (Prelude.Maybe Prelude.Text)
createServer_customDomain :: Lens' CreateServer (Maybe Text)
createServer_customDomain = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Maybe Text
customDomain :: Maybe Text
$sel:customDomain:CreateServer' :: CreateServer -> Maybe Text
customDomain} -> Maybe Text
customDomain) (\s :: CreateServer
s@CreateServer' {} Maybe Text
a -> CreateServer
s {$sel:customDomain:CreateServer' :: Maybe Text
customDomain = Maybe Text
a} :: CreateServer)

-- | A private key in PEM format for connecting to the server by using HTTPS.
-- The private key must not be encrypted; it cannot be protected by a
-- password or passphrase. If you specify a custom private key, you must
-- also specify values for @CustomDomain@ and @CustomCertificate@.
createServer_customPrivateKey :: Lens.Lens' CreateServer (Prelude.Maybe Prelude.Text)
createServer_customPrivateKey :: Lens' CreateServer (Maybe Text)
createServer_customPrivateKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Maybe (Sensitive Text)
customPrivateKey :: Maybe (Sensitive Text)
$sel:customPrivateKey:CreateServer' :: CreateServer -> Maybe (Sensitive Text)
customPrivateKey} -> Maybe (Sensitive Text)
customPrivateKey) (\s :: CreateServer
s@CreateServer' {} Maybe (Sensitive Text)
a -> CreateServer
s {$sel:customPrivateKey:CreateServer' :: Maybe (Sensitive Text)
customPrivateKey = Maybe (Sensitive Text)
a} :: CreateServer) 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

-- | Enable or disable scheduled backups. Valid values are @true@ or @false@.
-- The default value is @true@.
createServer_disableAutomatedBackup :: Lens.Lens' CreateServer (Prelude.Maybe Prelude.Bool)
createServer_disableAutomatedBackup :: Lens' CreateServer (Maybe Bool)
createServer_disableAutomatedBackup = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Maybe Bool
disableAutomatedBackup :: Maybe Bool
$sel:disableAutomatedBackup:CreateServer' :: CreateServer -> Maybe Bool
disableAutomatedBackup} -> Maybe Bool
disableAutomatedBackup) (\s :: CreateServer
s@CreateServer' {} Maybe Bool
a -> CreateServer
s {$sel:disableAutomatedBackup:CreateServer' :: Maybe Bool
disableAutomatedBackup = Maybe Bool
a} :: CreateServer)

-- | Optional engine attributes on a specified server.
--
-- __Attributes accepted in a Chef createServer request:__
--
-- -   @CHEF_AUTOMATE_PIVOTAL_KEY@: A base64-encoded RSA public key. The
--     corresponding private key is required to access the Chef API. When
--     no CHEF_AUTOMATE_PIVOTAL_KEY is set, a private key is generated and
--     returned in the response.
--
-- -   @CHEF_AUTOMATE_ADMIN_PASSWORD@: The password for the administrative
--     user in the Chef Automate web-based dashboard. The password length
--     is a minimum of eight characters, and a maximum of 32. The password
--     can contain letters, numbers, and special characters
--     (!\/\@#$%^&+=_). The password must contain at least one lower case
--     letter, one upper case letter, one number, and one special
--     character. When no CHEF_AUTOMATE_ADMIN_PASSWORD is set, one is
--     generated and returned in the response.
--
-- __Attributes accepted in a Puppet createServer request:__
--
-- -   @PUPPET_ADMIN_PASSWORD@: To work with the Puppet Enterprise console,
--     a password must use ASCII characters.
--
-- -   @PUPPET_R10K_REMOTE@: The r10k remote is the URL of your control
--     repository (for example,
--     ssh:\/\/git\@your.git-repo.com:user\/control-repo.git). Specifying
--     an r10k remote opens TCP port 8170.
--
-- -   @PUPPET_R10K_PRIVATE_KEY@: If you are using a private Git
--     repository, add PUPPET_R10K_PRIVATE_KEY to specify a PEM-encoded
--     private SSH key.
createServer_engineAttributes :: Lens.Lens' CreateServer (Prelude.Maybe [EngineAttribute])
createServer_engineAttributes :: Lens' CreateServer (Maybe [EngineAttribute])
createServer_engineAttributes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Maybe [EngineAttribute]
engineAttributes :: Maybe [EngineAttribute]
$sel:engineAttributes:CreateServer' :: CreateServer -> Maybe [EngineAttribute]
engineAttributes} -> Maybe [EngineAttribute]
engineAttributes) (\s :: CreateServer
s@CreateServer' {} Maybe [EngineAttribute]
a -> CreateServer
s {$sel:engineAttributes:CreateServer' :: Maybe [EngineAttribute]
engineAttributes = Maybe [EngineAttribute]
a} :: CreateServer) 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 model of the server. Valid values in this release include
-- @Monolithic@ for Puppet and @Single@ for Chef.
createServer_engineModel :: Lens.Lens' CreateServer (Prelude.Maybe Prelude.Text)
createServer_engineModel :: Lens' CreateServer (Maybe Text)
createServer_engineModel = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Maybe Text
engineModel :: Maybe Text
$sel:engineModel:CreateServer' :: CreateServer -> Maybe Text
engineModel} -> Maybe Text
engineModel) (\s :: CreateServer
s@CreateServer' {} Maybe Text
a -> CreateServer
s {$sel:engineModel:CreateServer' :: Maybe Text
engineModel = Maybe Text
a} :: CreateServer)

-- | The major release version of the engine that you want to use. For a Chef
-- server, the valid value for EngineVersion is currently @2@. For a Puppet
-- server, valid values are @2019@ or @2017@.
createServer_engineVersion :: Lens.Lens' CreateServer (Prelude.Maybe Prelude.Text)
createServer_engineVersion :: Lens' CreateServer (Maybe Text)
createServer_engineVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Maybe Text
engineVersion :: Maybe Text
$sel:engineVersion:CreateServer' :: CreateServer -> Maybe Text
engineVersion} -> Maybe Text
engineVersion) (\s :: CreateServer
s@CreateServer' {} Maybe Text
a -> CreateServer
s {$sel:engineVersion:CreateServer' :: Maybe Text
engineVersion = Maybe Text
a} :: CreateServer)

-- | The Amazon EC2 key pair to set for the instance. This parameter is
-- optional; if desired, you may specify this parameter to connect to your
-- instances by using SSH.
createServer_keyPair :: Lens.Lens' CreateServer (Prelude.Maybe Prelude.Text)
createServer_keyPair :: Lens' CreateServer (Maybe Text)
createServer_keyPair = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Maybe Text
keyPair :: Maybe Text
$sel:keyPair:CreateServer' :: CreateServer -> Maybe Text
keyPair} -> Maybe Text
keyPair) (\s :: CreateServer
s@CreateServer' {} Maybe Text
a -> CreateServer
s {$sel:keyPair:CreateServer' :: Maybe Text
keyPair = Maybe Text
a} :: CreateServer)

-- | The start time for a one-hour period during which AWS OpsWorks CM backs
-- up application-level data on your server if automated backups are
-- enabled. Valid values must be specified in one of the following formats:
--
-- -   @HH:MM@ for daily backups
--
-- -   @DDD:HH:MM@ for weekly backups
--
-- @MM@ must be specified as @00@. The specified time is in coordinated
-- universal time (UTC). The default value is a random, daily start time.
--
-- __Example:__ @08:00@, which represents a daily start time of 08:00 UTC.
--
-- __Example:__ @Mon:08:00@, which represents a start time of every Monday
-- at 08:00 UTC. (8:00 a.m.)
createServer_preferredBackupWindow :: Lens.Lens' CreateServer (Prelude.Maybe Prelude.Text)
createServer_preferredBackupWindow :: Lens' CreateServer (Maybe Text)
createServer_preferredBackupWindow = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Maybe Text
preferredBackupWindow :: Maybe Text
$sel:preferredBackupWindow:CreateServer' :: CreateServer -> Maybe Text
preferredBackupWindow} -> Maybe Text
preferredBackupWindow) (\s :: CreateServer
s@CreateServer' {} Maybe Text
a -> CreateServer
s {$sel:preferredBackupWindow:CreateServer' :: Maybe Text
preferredBackupWindow = Maybe Text
a} :: CreateServer)

-- | The start time for a one-hour period each week during which AWS OpsWorks
-- CM performs maintenance on the instance. Valid values must be specified
-- in the following format: @DDD:HH:MM@. @MM@ must be specified as @00@.
-- The specified time is in coordinated universal time (UTC). The default
-- value is a random one-hour period on Tuesday, Wednesday, or Friday. See
-- @TimeWindowDefinition@ for more information.
--
-- __Example:__ @Mon:08:00@, which represents a start time of every Monday
-- at 08:00 UTC. (8:00 a.m.)
createServer_preferredMaintenanceWindow :: Lens.Lens' CreateServer (Prelude.Maybe Prelude.Text)
createServer_preferredMaintenanceWindow :: Lens' CreateServer (Maybe Text)
createServer_preferredMaintenanceWindow = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Maybe Text
preferredMaintenanceWindow :: Maybe Text
$sel:preferredMaintenanceWindow:CreateServer' :: CreateServer -> Maybe Text
preferredMaintenanceWindow} -> Maybe Text
preferredMaintenanceWindow) (\s :: CreateServer
s@CreateServer' {} Maybe Text
a -> CreateServer
s {$sel:preferredMaintenanceWindow:CreateServer' :: Maybe Text
preferredMaintenanceWindow = Maybe Text
a} :: CreateServer)

-- | A list of security group IDs to attach to the Amazon EC2 instance. If
-- you add this parameter, the specified security groups must be within the
-- VPC that is specified by @SubnetIds@.
--
-- If you do not specify this parameter, AWS OpsWorks CM creates one new
-- security group that uses TCP ports 22 and 443, open to 0.0.0.0\/0
-- (everyone).
createServer_securityGroupIds :: Lens.Lens' CreateServer (Prelude.Maybe [Prelude.Text])
createServer_securityGroupIds :: Lens' CreateServer (Maybe [Text])
createServer_securityGroupIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Maybe [Text]
securityGroupIds :: Maybe [Text]
$sel:securityGroupIds:CreateServer' :: CreateServer -> Maybe [Text]
securityGroupIds} -> Maybe [Text]
securityGroupIds) (\s :: CreateServer
s@CreateServer' {} Maybe [Text]
a -> CreateServer
s {$sel:securityGroupIds:CreateServer' :: Maybe [Text]
securityGroupIds = Maybe [Text]
a} :: CreateServer) 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 IDs of subnets in which to launch the server EC2 instance.
--
-- Amazon EC2-Classic customers: This field is required. All servers must
-- run within a VPC. The VPC must have \"Auto Assign Public IP\" enabled.
--
-- EC2-VPC customers: This field is optional. If you do not specify subnet
-- IDs, your EC2 instances are created in a default subnet that is selected
-- by Amazon EC2. If you specify subnet IDs, the VPC must have \"Auto
-- Assign Public IP\" enabled.
--
-- For more information about supported Amazon EC2 platforms, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-supported-platforms.html Supported Platforms>.
createServer_subnetIds :: Lens.Lens' CreateServer (Prelude.Maybe [Prelude.Text])
createServer_subnetIds :: Lens' CreateServer (Maybe [Text])
createServer_subnetIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Maybe [Text]
subnetIds :: Maybe [Text]
$sel:subnetIds:CreateServer' :: CreateServer -> Maybe [Text]
subnetIds} -> Maybe [Text]
subnetIds) (\s :: CreateServer
s@CreateServer' {} Maybe [Text]
a -> CreateServer
s {$sel:subnetIds:CreateServer' :: Maybe [Text]
subnetIds = Maybe [Text]
a} :: CreateServer) 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

-- | A map that contains tag keys and tag values to attach to an AWS OpsWorks
-- for Chef Automate or AWS OpsWorks for Puppet Enterprise server.
--
-- -   The key cannot be empty.
--
-- -   The key can be a maximum of 127 characters, and can contain only
--     Unicode letters, numbers, or separators, or the following special
--     characters: @+ - = . _ : \/ \@@
--
-- -   The value can be a maximum 255 characters, and contain only Unicode
--     letters, numbers, or separators, or the following special
--     characters: @+ - = . _ : \/ \@@
--
-- -   Leading and trailing white spaces are trimmed from both the key and
--     value.
--
-- -   A maximum of 50 user-applied tags is allowed for any AWS OpsWorks-CM
--     server.
createServer_tags :: Lens.Lens' CreateServer (Prelude.Maybe [Tag])
createServer_tags :: Lens' CreateServer (Maybe [Tag])
createServer_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateServer' :: CreateServer -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateServer
s@CreateServer' {} Maybe [Tag]
a -> CreateServer
s {$sel:tags:CreateServer' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateServer) 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 configuration management engine to use. Valid values include
-- @ChefAutomate@ and @Puppet@.
createServer_engine :: Lens.Lens' CreateServer Prelude.Text
createServer_engine :: Lens' CreateServer Text
createServer_engine = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Text
engine :: Text
$sel:engine:CreateServer' :: CreateServer -> Text
engine} -> Text
engine) (\s :: CreateServer
s@CreateServer' {} Text
a -> CreateServer
s {$sel:engine:CreateServer' :: Text
engine = Text
a} :: CreateServer)

-- | The name of the server. The server name must be unique within your AWS
-- account, within each region. Server names must start with a letter; then
-- letters, numbers, or hyphens (-) are allowed, up to a maximum of 40
-- characters.
createServer_serverName :: Lens.Lens' CreateServer Prelude.Text
createServer_serverName :: Lens' CreateServer Text
createServer_serverName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Text
serverName :: Text
$sel:serverName:CreateServer' :: CreateServer -> Text
serverName} -> Text
serverName) (\s :: CreateServer
s@CreateServer' {} Text
a -> CreateServer
s {$sel:serverName:CreateServer' :: Text
serverName = Text
a} :: CreateServer)

-- | The ARN of the instance profile that your Amazon EC2 instances use.
-- Although the AWS OpsWorks console typically creates the instance profile
-- for you, if you are using API commands instead, run the
-- service-role-creation.yaml AWS CloudFormation template, located at
-- https:\/\/s3.amazonaws.com\/opsworks-cm-us-east-1-prod-default-assets\/misc\/opsworks-cm-roles.yaml.
-- This template creates a CloudFormation stack that includes the instance
-- profile you need.
createServer_instanceProfileArn :: Lens.Lens' CreateServer Prelude.Text
createServer_instanceProfileArn :: Lens' CreateServer Text
createServer_instanceProfileArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Text
instanceProfileArn :: Text
$sel:instanceProfileArn:CreateServer' :: CreateServer -> Text
instanceProfileArn} -> Text
instanceProfileArn) (\s :: CreateServer
s@CreateServer' {} Text
a -> CreateServer
s {$sel:instanceProfileArn:CreateServer' :: Text
instanceProfileArn = Text
a} :: CreateServer)

-- | The Amazon EC2 instance type to use. For example, @m5.large@.
createServer_instanceType :: Lens.Lens' CreateServer Prelude.Text
createServer_instanceType :: Lens' CreateServer Text
createServer_instanceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Text
instanceType :: Text
$sel:instanceType:CreateServer' :: CreateServer -> Text
instanceType} -> Text
instanceType) (\s :: CreateServer
s@CreateServer' {} Text
a -> CreateServer
s {$sel:instanceType:CreateServer' :: Text
instanceType = Text
a} :: CreateServer)

-- | The service role that the AWS OpsWorks CM service backend uses to work
-- with your account. Although the AWS OpsWorks management console
-- typically creates the service role for you, if you are using the AWS CLI
-- or API commands, run the service-role-creation.yaml AWS CloudFormation
-- template, located at
-- https:\/\/s3.amazonaws.com\/opsworks-cm-us-east-1-prod-default-assets\/misc\/opsworks-cm-roles.yaml.
-- This template creates a CloudFormation stack that includes the service
-- role and instance profile that you need.
createServer_serviceRoleArn :: Lens.Lens' CreateServer Prelude.Text
createServer_serviceRoleArn :: Lens' CreateServer Text
createServer_serviceRoleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Text
serviceRoleArn :: Text
$sel:serviceRoleArn:CreateServer' :: CreateServer -> Text
serviceRoleArn} -> Text
serviceRoleArn) (\s :: CreateServer
s@CreateServer' {} Text
a -> CreateServer
s {$sel:serviceRoleArn:CreateServer' :: Text
serviceRoleArn = Text
a} :: CreateServer)

instance Core.AWSRequest CreateServer where
  type AWSResponse CreateServer = CreateServerResponse
  request :: (Service -> Service) -> CreateServer -> Request CreateServer
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 CreateServer
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateServer)))
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 ->
          Maybe Server -> Int -> CreateServerResponse
CreateServerResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Server")
            forall (f :: * -> *) a b. Applicative f => 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))
      )

instance Prelude.Hashable CreateServer where
  hashWithSalt :: Int -> CreateServer -> Int
hashWithSalt Int
_salt CreateServer' {Maybe Bool
Maybe Natural
Maybe [Text]
Maybe [EngineAttribute]
Maybe [Tag]
Maybe Text
Maybe (Sensitive Text)
Text
serviceRoleArn :: Text
instanceType :: Text
instanceProfileArn :: Text
serverName :: Text
engine :: Text
tags :: Maybe [Tag]
subnetIds :: Maybe [Text]
securityGroupIds :: Maybe [Text]
preferredMaintenanceWindow :: Maybe Text
preferredBackupWindow :: Maybe Text
keyPair :: Maybe Text
engineVersion :: Maybe Text
engineModel :: Maybe Text
engineAttributes :: Maybe [EngineAttribute]
disableAutomatedBackup :: Maybe Bool
customPrivateKey :: Maybe (Sensitive Text)
customDomain :: Maybe Text
customCertificate :: Maybe Text
backupRetentionCount :: Maybe Natural
backupId :: Maybe Text
associatePublicIpAddress :: Maybe Bool
$sel:serviceRoleArn:CreateServer' :: CreateServer -> Text
$sel:instanceType:CreateServer' :: CreateServer -> Text
$sel:instanceProfileArn:CreateServer' :: CreateServer -> Text
$sel:serverName:CreateServer' :: CreateServer -> Text
$sel:engine:CreateServer' :: CreateServer -> Text
$sel:tags:CreateServer' :: CreateServer -> Maybe [Tag]
$sel:subnetIds:CreateServer' :: CreateServer -> Maybe [Text]
$sel:securityGroupIds:CreateServer' :: CreateServer -> Maybe [Text]
$sel:preferredMaintenanceWindow:CreateServer' :: CreateServer -> Maybe Text
$sel:preferredBackupWindow:CreateServer' :: CreateServer -> Maybe Text
$sel:keyPair:CreateServer' :: CreateServer -> Maybe Text
$sel:engineVersion:CreateServer' :: CreateServer -> Maybe Text
$sel:engineModel:CreateServer' :: CreateServer -> Maybe Text
$sel:engineAttributes:CreateServer' :: CreateServer -> Maybe [EngineAttribute]
$sel:disableAutomatedBackup:CreateServer' :: CreateServer -> Maybe Bool
$sel:customPrivateKey:CreateServer' :: CreateServer -> Maybe (Sensitive Text)
$sel:customDomain:CreateServer' :: CreateServer -> Maybe Text
$sel:customCertificate:CreateServer' :: CreateServer -> Maybe Text
$sel:backupRetentionCount:CreateServer' :: CreateServer -> Maybe Natural
$sel:backupId:CreateServer' :: CreateServer -> Maybe Text
$sel:associatePublicIpAddress:CreateServer' :: CreateServer -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
associatePublicIpAddress
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
backupId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
backupRetentionCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
customCertificate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
customDomain
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
customPrivateKey
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
disableAutomatedBackup
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [EngineAttribute]
engineAttributes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
engineModel
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
engineVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
keyPair
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
preferredBackupWindow
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
preferredMaintenanceWindow
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
securityGroupIds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
subnetIds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
engine
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
serverName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
instanceProfileArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
instanceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
serviceRoleArn

instance Prelude.NFData CreateServer where
  rnf :: CreateServer -> ()
rnf CreateServer' {Maybe Bool
Maybe Natural
Maybe [Text]
Maybe [EngineAttribute]
Maybe [Tag]
Maybe Text
Maybe (Sensitive Text)
Text
serviceRoleArn :: Text
instanceType :: Text
instanceProfileArn :: Text
serverName :: Text
engine :: Text
tags :: Maybe [Tag]
subnetIds :: Maybe [Text]
securityGroupIds :: Maybe [Text]
preferredMaintenanceWindow :: Maybe Text
preferredBackupWindow :: Maybe Text
keyPair :: Maybe Text
engineVersion :: Maybe Text
engineModel :: Maybe Text
engineAttributes :: Maybe [EngineAttribute]
disableAutomatedBackup :: Maybe Bool
customPrivateKey :: Maybe (Sensitive Text)
customDomain :: Maybe Text
customCertificate :: Maybe Text
backupRetentionCount :: Maybe Natural
backupId :: Maybe Text
associatePublicIpAddress :: Maybe Bool
$sel:serviceRoleArn:CreateServer' :: CreateServer -> Text
$sel:instanceType:CreateServer' :: CreateServer -> Text
$sel:instanceProfileArn:CreateServer' :: CreateServer -> Text
$sel:serverName:CreateServer' :: CreateServer -> Text
$sel:engine:CreateServer' :: CreateServer -> Text
$sel:tags:CreateServer' :: CreateServer -> Maybe [Tag]
$sel:subnetIds:CreateServer' :: CreateServer -> Maybe [Text]
$sel:securityGroupIds:CreateServer' :: CreateServer -> Maybe [Text]
$sel:preferredMaintenanceWindow:CreateServer' :: CreateServer -> Maybe Text
$sel:preferredBackupWindow:CreateServer' :: CreateServer -> Maybe Text
$sel:keyPair:CreateServer' :: CreateServer -> Maybe Text
$sel:engineVersion:CreateServer' :: CreateServer -> Maybe Text
$sel:engineModel:CreateServer' :: CreateServer -> Maybe Text
$sel:engineAttributes:CreateServer' :: CreateServer -> Maybe [EngineAttribute]
$sel:disableAutomatedBackup:CreateServer' :: CreateServer -> Maybe Bool
$sel:customPrivateKey:CreateServer' :: CreateServer -> Maybe (Sensitive Text)
$sel:customDomain:CreateServer' :: CreateServer -> Maybe Text
$sel:customCertificate:CreateServer' :: CreateServer -> Maybe Text
$sel:backupRetentionCount:CreateServer' :: CreateServer -> Maybe Natural
$sel:backupId:CreateServer' :: CreateServer -> Maybe Text
$sel:associatePublicIpAddress:CreateServer' :: CreateServer -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
associatePublicIpAddress
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
backupId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
backupRetentionCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
customCertificate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
customDomain
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
customPrivateKey
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
disableAutomatedBackup
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [EngineAttribute]
engineAttributes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
engineModel
      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 Text
keyPair
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
preferredBackupWindow
      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 [Text]
securityGroupIds
      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 [Tag]
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
engine
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
serverName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
instanceProfileArn
      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
serviceRoleArn

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

instance Data.ToJSON CreateServer where
  toJSON :: CreateServer -> Value
toJSON CreateServer' {Maybe Bool
Maybe Natural
Maybe [Text]
Maybe [EngineAttribute]
Maybe [Tag]
Maybe Text
Maybe (Sensitive Text)
Text
serviceRoleArn :: Text
instanceType :: Text
instanceProfileArn :: Text
serverName :: Text
engine :: Text
tags :: Maybe [Tag]
subnetIds :: Maybe [Text]
securityGroupIds :: Maybe [Text]
preferredMaintenanceWindow :: Maybe Text
preferredBackupWindow :: Maybe Text
keyPair :: Maybe Text
engineVersion :: Maybe Text
engineModel :: Maybe Text
engineAttributes :: Maybe [EngineAttribute]
disableAutomatedBackup :: Maybe Bool
customPrivateKey :: Maybe (Sensitive Text)
customDomain :: Maybe Text
customCertificate :: Maybe Text
backupRetentionCount :: Maybe Natural
backupId :: Maybe Text
associatePublicIpAddress :: Maybe Bool
$sel:serviceRoleArn:CreateServer' :: CreateServer -> Text
$sel:instanceType:CreateServer' :: CreateServer -> Text
$sel:instanceProfileArn:CreateServer' :: CreateServer -> Text
$sel:serverName:CreateServer' :: CreateServer -> Text
$sel:engine:CreateServer' :: CreateServer -> Text
$sel:tags:CreateServer' :: CreateServer -> Maybe [Tag]
$sel:subnetIds:CreateServer' :: CreateServer -> Maybe [Text]
$sel:securityGroupIds:CreateServer' :: CreateServer -> Maybe [Text]
$sel:preferredMaintenanceWindow:CreateServer' :: CreateServer -> Maybe Text
$sel:preferredBackupWindow:CreateServer' :: CreateServer -> Maybe Text
$sel:keyPair:CreateServer' :: CreateServer -> Maybe Text
$sel:engineVersion:CreateServer' :: CreateServer -> Maybe Text
$sel:engineModel:CreateServer' :: CreateServer -> Maybe Text
$sel:engineAttributes:CreateServer' :: CreateServer -> Maybe [EngineAttribute]
$sel:disableAutomatedBackup:CreateServer' :: CreateServer -> Maybe Bool
$sel:customPrivateKey:CreateServer' :: CreateServer -> Maybe (Sensitive Text)
$sel:customDomain:CreateServer' :: CreateServer -> Maybe Text
$sel:customCertificate:CreateServer' :: CreateServer -> Maybe Text
$sel:backupRetentionCount:CreateServer' :: CreateServer -> Maybe Natural
$sel:backupId:CreateServer' :: CreateServer -> Maybe Text
$sel:associatePublicIpAddress:CreateServer' :: CreateServer -> Maybe Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AssociatePublicIpAddress" 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
associatePublicIpAddress,
            (Key
"BackupId" 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
backupId,
            (Key
"BackupRetentionCount" 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 Natural
backupRetentionCount,
            (Key
"CustomCertificate" 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
customCertificate,
            (Key
"CustomDomain" 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
customDomain,
            (Key
"CustomPrivateKey" 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)
customPrivateKey,
            (Key
"DisableAutomatedBackup" 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
disableAutomatedBackup,
            (Key
"EngineAttributes" 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 [EngineAttribute]
engineAttributes,
            (Key
"EngineModel" 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
engineModel,
            (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
"KeyPair" 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
keyPair,
            (Key
"PreferredBackupWindow" 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
preferredBackupWindow,
            (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
"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
"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 [Tag]
tags,
            forall a. a -> Maybe a
Prelude.Just (Key
"Engine" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
engine),
            forall a. a -> Maybe a
Prelude.Just (Key
"ServerName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
serverName),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"InstanceProfileArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
instanceProfileArn),
            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
"ServiceRoleArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
serviceRoleArn)
          ]
      )

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

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

-- | /See:/ 'newCreateServerResponse' smart constructor.
data CreateServerResponse = CreateServerResponse'
  { -- | The server that is created by the request.
    CreateServerResponse -> Maybe Server
server :: Prelude.Maybe Server,
    -- | The response's http status code.
    CreateServerResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateServerResponse -> CreateServerResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateServerResponse -> CreateServerResponse -> Bool
$c/= :: CreateServerResponse -> CreateServerResponse -> Bool
== :: CreateServerResponse -> CreateServerResponse -> Bool
$c== :: CreateServerResponse -> CreateServerResponse -> Bool
Prelude.Eq, Int -> CreateServerResponse -> ShowS
[CreateServerResponse] -> ShowS
CreateServerResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateServerResponse] -> ShowS
$cshowList :: [CreateServerResponse] -> ShowS
show :: CreateServerResponse -> String
$cshow :: CreateServerResponse -> String
showsPrec :: Int -> CreateServerResponse -> ShowS
$cshowsPrec :: Int -> CreateServerResponse -> ShowS
Prelude.Show, forall x. Rep CreateServerResponse x -> CreateServerResponse
forall x. CreateServerResponse -> Rep CreateServerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateServerResponse x -> CreateServerResponse
$cfrom :: forall x. CreateServerResponse -> Rep CreateServerResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateServerResponse' 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:
--
-- 'server', 'createServerResponse_server' - The server that is created by the request.
--
-- 'httpStatus', 'createServerResponse_httpStatus' - The response's http status code.
newCreateServerResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateServerResponse
newCreateServerResponse :: Int -> CreateServerResponse
newCreateServerResponse Int
pHttpStatus_ =
  CreateServerResponse'
    { $sel:server:CreateServerResponse' :: Maybe Server
server = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateServerResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The server that is created by the request.
createServerResponse_server :: Lens.Lens' CreateServerResponse (Prelude.Maybe Server)
createServerResponse_server :: Lens' CreateServerResponse (Maybe Server)
createServerResponse_server = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServerResponse' {Maybe Server
server :: Maybe Server
$sel:server:CreateServerResponse' :: CreateServerResponse -> Maybe Server
server} -> Maybe Server
server) (\s :: CreateServerResponse
s@CreateServerResponse' {} Maybe Server
a -> CreateServerResponse
s {$sel:server:CreateServerResponse' :: Maybe Server
server = Maybe Server
a} :: CreateServerResponse)

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

instance Prelude.NFData CreateServerResponse where
  rnf :: CreateServerResponse -> ()
rnf CreateServerResponse' {Int
Maybe Server
httpStatus :: Int
server :: Maybe Server
$sel:httpStatus:CreateServerResponse' :: CreateServerResponse -> Int
$sel:server:CreateServerResponse' :: CreateServerResponse -> Maybe Server
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Server
server
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus