{-# 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.Transfer.CreateServer
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Instantiates an auto-scaling virtual server based on the selected file
-- transfer protocol in Amazon Web Services. When you make updates to your
-- file transfer protocol-enabled server or when you work with users, use
-- the service-generated @ServerId@ property that is assigned to the newly
-- created server.
module Amazonka.Transfer.CreateServer
  ( -- * Creating a Request
    CreateServer (..),
    newCreateServer,

    -- * Request Lenses
    createServer_loggingRole,
    createServer_hostKey,
    createServer_identityProviderType,
    createServer_protocols,
    createServer_domain,
    createServer_endpointType,
    createServer_securityPolicyName,
    createServer_certificate,
    createServer_identityProviderDetails,
    createServer_workflowDetails,
    createServer_tags,
    createServer_endpointDetails,

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

    -- * Response Lenses
    createServerResponse_httpStatus,
    createServerResponse_serverId,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Transfer.Types

-- | /See:/ 'newCreateServer' smart constructor.
data CreateServer = CreateServer'
  { -- | Specifies the Amazon Resource Name (ARN) of the Amazon Web Services
    -- Identity and Access Management (IAM) role that allows a server to turn
    -- on Amazon CloudWatch logging for Amazon S3 or Amazon EFS events. When
    -- set, user activity can be viewed in your CloudWatch logs.
    CreateServer -> Maybe Text
loggingRole :: Prelude.Maybe Prelude.Text,
    -- | The RSA private key as generated by the
    -- @ssh-keygen -N \"\" -m PEM -f my-new-server-key@ command.
    --
    -- If you aren\'t planning to migrate existing users from an existing
    -- SFTP-enabled server to a new server, don\'t update the host key.
    -- Accidentally changing a server\'s host key can be disruptive.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/transfer/latest/userguide/edit-server-config.html#configuring-servers-change-host-key Change the host key for your SFTP-enabled server>
    -- in the /Amazon Web Services Transfer Family User Guide/.
    CreateServer -> Maybe (Sensitive Text)
hostKey :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | Specifies the mode of authentication for a server. The default value is
    -- @SERVICE_MANAGED@, which allows you to store and access user credentials
    -- within the Amazon Web Services Transfer Family service.
    --
    -- Use @AWS_DIRECTORY_SERVICE@ to provide access to Active Directory groups
    -- in Amazon Web Services Managed Active Directory or Microsoft Active
    -- Directory in your on-premises environment or in Amazon Web Services
    -- using AD Connectors. This option also requires you to provide a
    -- Directory ID using the @IdentityProviderDetails@ parameter.
    --
    -- Use the @API_GATEWAY@ value to integrate with an identity provider of
    -- your choosing. The @API_GATEWAY@ setting requires you to provide an API
    -- Gateway endpoint URL to call for authentication using the
    -- @IdentityProviderDetails@ parameter.
    CreateServer -> Maybe IdentityProviderType
identityProviderType :: Prelude.Maybe IdentityProviderType,
    -- | Specifies the file transfer protocol or protocols over which your file
    -- transfer protocol client can connect to your server\'s endpoint. The
    -- available protocols are:
    --
    -- -   @SFTP@ (Secure Shell (SSH) File Transfer Protocol): File transfer
    --     over SSH
    --
    -- -   @FTPS@ (File Transfer Protocol Secure): File transfer with TLS
    --     encryption
    --
    -- -   @FTP@ (File Transfer Protocol): Unencrypted file transfer
    --
    -- If you select @FTPS@, you must choose a certificate stored in Amazon Web
    -- Services Certificate Manager (ACM) which is used to identify your server
    -- when clients connect to it over FTPS.
    --
    -- If @Protocol@ includes either @FTP@ or @FTPS@, then the @EndpointType@
    -- must be @VPC@ and the @IdentityProviderType@ must be
    -- @AWS_DIRECTORY_SERVICE@ or @API_GATEWAY@.
    --
    -- If @Protocol@ includes @FTP@, then @AddressAllocationIds@ cannot be
    -- associated.
    --
    -- If @Protocol@ is set only to @SFTP@, the @EndpointType@ can be set to
    -- @PUBLIC@ and the @IdentityProviderType@ can be set to @SERVICE_MANAGED@.
    CreateServer -> Maybe (NonEmpty Protocol)
protocols :: Prelude.Maybe (Prelude.NonEmpty Protocol),
    -- | The domain of the storage system that is used for file transfers. There
    -- are two domains available: Amazon Simple Storage Service (Amazon S3) and
    -- Amazon Elastic File System (Amazon EFS). The default value is S3.
    --
    -- After the server is created, the domain cannot be changed.
    CreateServer -> Maybe Domain
domain :: Prelude.Maybe Domain,
    -- | The type of endpoint that you want your server to use. You can choose to
    -- make your server\'s endpoint publicly accessible (PUBLIC) or host it
    -- inside your VPC. With an endpoint that is hosted in a VPC, you can
    -- restrict access to your server and resources only within your VPC or
    -- choose to make it internet facing by attaching Elastic IP addresses
    -- directly to it.
    --
    -- After May 19, 2021, you won\'t be able to create a server using
    -- @EndpointType=VPC_ENDPOINT@ in your Amazon Web Services account if your
    -- account hasn\'t already done so before May 19, 2021. If you have already
    -- created servers with @EndpointType=VPC_ENDPOINT@ in your Amazon Web
    -- Services account on or before May 19, 2021, you will not be affected.
    -- After this date, use @EndpointType@=@VPC@.
    --
    -- For more information, see
    -- https:\/\/docs.aws.amazon.com\/transfer\/latest\/userguide\/create-server-in-vpc.html#deprecate-vpc-endpoint.
    --
    -- It is recommended that you use @VPC@ as the @EndpointType@. With this
    -- endpoint type, you have the option to directly associate up to three
    -- Elastic IPv4 addresses (BYO IP included) with your server\'s endpoint
    -- and use VPC security groups to restrict traffic by the client\'s public
    -- IP address. This is not possible with @EndpointType@ set to
    -- @VPC_ENDPOINT@.
    CreateServer -> Maybe EndpointType
endpointType :: Prelude.Maybe EndpointType,
    -- | Specifies the name of the security policy that is attached to the
    -- server.
    CreateServer -> Maybe Text
securityPolicyName :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the Amazon Web Services Certificate
    -- Manager (ACM) certificate. Required when @Protocols@ is set to @FTPS@.
    --
    -- To request a new public certificate, see
    -- <https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-request-public.html Request a public certificate>
    -- in the /Amazon Web Services Certificate Manager User Guide/.
    --
    -- To import an existing certificate into ACM, see
    -- <https://docs.aws.amazon.com/acm/latest/userguide/import-certificate.html Importing certificates into ACM>
    -- in the /Amazon Web Services Certificate Manager User Guide/.
    --
    -- To request a private certificate to use FTPS through private IP
    -- addresses, see
    -- <https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-request-private.html Request a private certificate>
    -- in the /Amazon Web Services Certificate Manager User Guide/.
    --
    -- Certificates with the following cryptographic algorithms and key sizes
    -- are supported:
    --
    -- -   2048-bit RSA (RSA_2048)
    --
    -- -   4096-bit RSA (RSA_4096)
    --
    -- -   Elliptic Prime Curve 256 bit (EC_prime256v1)
    --
    -- -   Elliptic Prime Curve 384 bit (EC_secp384r1)
    --
    -- -   Elliptic Prime Curve 521 bit (EC_secp521r1)
    --
    -- The certificate must be a valid SSL\/TLS X.509 version 3 certificate
    -- with FQDN or IP address specified and information about the issuer.
    CreateServer -> Maybe Text
certificate :: Prelude.Maybe Prelude.Text,
    -- | Required when @IdentityProviderType@ is set to @AWS_DIRECTORY_SERVICE@
    -- or @API_GATEWAY@. Accepts an array containing all of the information
    -- required to use a directory in @AWS_DIRECTORY_SERVICE@ or invoke a
    -- customer-supplied authentication API, including the API Gateway URL. Not
    -- required when @IdentityProviderType@ is set to @SERVICE_MANAGED@.
    CreateServer -> Maybe IdentityProviderDetails
identityProviderDetails :: Prelude.Maybe IdentityProviderDetails,
    -- | Specifies the workflow ID for the workflow to assign and the execution
    -- role used for executing the workflow.
    CreateServer -> Maybe WorkflowDetails
workflowDetails :: Prelude.Maybe WorkflowDetails,
    -- | Key-value pairs that can be used to group and search for servers.
    CreateServer -> Maybe (NonEmpty Tag)
tags :: Prelude.Maybe (Prelude.NonEmpty Tag),
    -- | The virtual private cloud (VPC) endpoint settings that are configured
    -- for your server. When you host your endpoint within your VPC, you can
    -- make it accessible only to resources within your VPC, or you can attach
    -- Elastic IP addresses and make it accessible to clients over the
    -- internet. Your VPC\'s default security groups are automatically assigned
    -- to your endpoint.
    CreateServer -> Maybe EndpointDetails
endpointDetails :: Prelude.Maybe EndpointDetails
  }
  deriving (CreateServer -> CreateServer -> Bool
(CreateServer -> CreateServer -> Bool)
-> (CreateServer -> CreateServer -> Bool) -> Eq CreateServer
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
(Int -> CreateServer -> ShowS)
-> (CreateServer -> String)
-> ([CreateServer] -> ShowS)
-> Show CreateServer
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. CreateServer -> Rep CreateServer x)
-> (forall x. Rep CreateServer x -> CreateServer)
-> Generic CreateServer
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:
--
-- 'loggingRole', 'createServer_loggingRole' - Specifies the Amazon Resource Name (ARN) of the Amazon Web Services
-- Identity and Access Management (IAM) role that allows a server to turn
-- on Amazon CloudWatch logging for Amazon S3 or Amazon EFS events. When
-- set, user activity can be viewed in your CloudWatch logs.
--
-- 'hostKey', 'createServer_hostKey' - The RSA private key as generated by the
-- @ssh-keygen -N \"\" -m PEM -f my-new-server-key@ command.
--
-- If you aren\'t planning to migrate existing users from an existing
-- SFTP-enabled server to a new server, don\'t update the host key.
-- Accidentally changing a server\'s host key can be disruptive.
--
-- For more information, see
-- <https://docs.aws.amazon.com/transfer/latest/userguide/edit-server-config.html#configuring-servers-change-host-key Change the host key for your SFTP-enabled server>
-- in the /Amazon Web Services Transfer Family User Guide/.
--
-- 'identityProviderType', 'createServer_identityProviderType' - Specifies the mode of authentication for a server. The default value is
-- @SERVICE_MANAGED@, which allows you to store and access user credentials
-- within the Amazon Web Services Transfer Family service.
--
-- Use @AWS_DIRECTORY_SERVICE@ to provide access to Active Directory groups
-- in Amazon Web Services Managed Active Directory or Microsoft Active
-- Directory in your on-premises environment or in Amazon Web Services
-- using AD Connectors. This option also requires you to provide a
-- Directory ID using the @IdentityProviderDetails@ parameter.
--
-- Use the @API_GATEWAY@ value to integrate with an identity provider of
-- your choosing. The @API_GATEWAY@ setting requires you to provide an API
-- Gateway endpoint URL to call for authentication using the
-- @IdentityProviderDetails@ parameter.
--
-- 'protocols', 'createServer_protocols' - Specifies the file transfer protocol or protocols over which your file
-- transfer protocol client can connect to your server\'s endpoint. The
-- available protocols are:
--
-- -   @SFTP@ (Secure Shell (SSH) File Transfer Protocol): File transfer
--     over SSH
--
-- -   @FTPS@ (File Transfer Protocol Secure): File transfer with TLS
--     encryption
--
-- -   @FTP@ (File Transfer Protocol): Unencrypted file transfer
--
-- If you select @FTPS@, you must choose a certificate stored in Amazon Web
-- Services Certificate Manager (ACM) which is used to identify your server
-- when clients connect to it over FTPS.
--
-- If @Protocol@ includes either @FTP@ or @FTPS@, then the @EndpointType@
-- must be @VPC@ and the @IdentityProviderType@ must be
-- @AWS_DIRECTORY_SERVICE@ or @API_GATEWAY@.
--
-- If @Protocol@ includes @FTP@, then @AddressAllocationIds@ cannot be
-- associated.
--
-- If @Protocol@ is set only to @SFTP@, the @EndpointType@ can be set to
-- @PUBLIC@ and the @IdentityProviderType@ can be set to @SERVICE_MANAGED@.
--
-- 'domain', 'createServer_domain' - The domain of the storage system that is used for file transfers. There
-- are two domains available: Amazon Simple Storage Service (Amazon S3) and
-- Amazon Elastic File System (Amazon EFS). The default value is S3.
--
-- After the server is created, the domain cannot be changed.
--
-- 'endpointType', 'createServer_endpointType' - The type of endpoint that you want your server to use. You can choose to
-- make your server\'s endpoint publicly accessible (PUBLIC) or host it
-- inside your VPC. With an endpoint that is hosted in a VPC, you can
-- restrict access to your server and resources only within your VPC or
-- choose to make it internet facing by attaching Elastic IP addresses
-- directly to it.
--
-- After May 19, 2021, you won\'t be able to create a server using
-- @EndpointType=VPC_ENDPOINT@ in your Amazon Web Services account if your
-- account hasn\'t already done so before May 19, 2021. If you have already
-- created servers with @EndpointType=VPC_ENDPOINT@ in your Amazon Web
-- Services account on or before May 19, 2021, you will not be affected.
-- After this date, use @EndpointType@=@VPC@.
--
-- For more information, see
-- https:\/\/docs.aws.amazon.com\/transfer\/latest\/userguide\/create-server-in-vpc.html#deprecate-vpc-endpoint.
--
-- It is recommended that you use @VPC@ as the @EndpointType@. With this
-- endpoint type, you have the option to directly associate up to three
-- Elastic IPv4 addresses (BYO IP included) with your server\'s endpoint
-- and use VPC security groups to restrict traffic by the client\'s public
-- IP address. This is not possible with @EndpointType@ set to
-- @VPC_ENDPOINT@.
--
-- 'securityPolicyName', 'createServer_securityPolicyName' - Specifies the name of the security policy that is attached to the
-- server.
--
-- 'certificate', 'createServer_certificate' - The Amazon Resource Name (ARN) of the Amazon Web Services Certificate
-- Manager (ACM) certificate. Required when @Protocols@ is set to @FTPS@.
--
-- To request a new public certificate, see
-- <https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-request-public.html Request a public certificate>
-- in the /Amazon Web Services Certificate Manager User Guide/.
--
-- To import an existing certificate into ACM, see
-- <https://docs.aws.amazon.com/acm/latest/userguide/import-certificate.html Importing certificates into ACM>
-- in the /Amazon Web Services Certificate Manager User Guide/.
--
-- To request a private certificate to use FTPS through private IP
-- addresses, see
-- <https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-request-private.html Request a private certificate>
-- in the /Amazon Web Services Certificate Manager User Guide/.
--
-- Certificates with the following cryptographic algorithms and key sizes
-- are supported:
--
-- -   2048-bit RSA (RSA_2048)
--
-- -   4096-bit RSA (RSA_4096)
--
-- -   Elliptic Prime Curve 256 bit (EC_prime256v1)
--
-- -   Elliptic Prime Curve 384 bit (EC_secp384r1)
--
-- -   Elliptic Prime Curve 521 bit (EC_secp521r1)
--
-- The certificate must be a valid SSL\/TLS X.509 version 3 certificate
-- with FQDN or IP address specified and information about the issuer.
--
-- 'identityProviderDetails', 'createServer_identityProviderDetails' - Required when @IdentityProviderType@ is set to @AWS_DIRECTORY_SERVICE@
-- or @API_GATEWAY@. Accepts an array containing all of the information
-- required to use a directory in @AWS_DIRECTORY_SERVICE@ or invoke a
-- customer-supplied authentication API, including the API Gateway URL. Not
-- required when @IdentityProviderType@ is set to @SERVICE_MANAGED@.
--
-- 'workflowDetails', 'createServer_workflowDetails' - Specifies the workflow ID for the workflow to assign and the execution
-- role used for executing the workflow.
--
-- 'tags', 'createServer_tags' - Key-value pairs that can be used to group and search for servers.
--
-- 'endpointDetails', 'createServer_endpointDetails' - The virtual private cloud (VPC) endpoint settings that are configured
-- for your server. When you host your endpoint within your VPC, you can
-- make it accessible only to resources within your VPC, or you can attach
-- Elastic IP addresses and make it accessible to clients over the
-- internet. Your VPC\'s default security groups are automatically assigned
-- to your endpoint.
newCreateServer ::
  CreateServer
newCreateServer :: CreateServer
newCreateServer =
  CreateServer' :: Maybe Text
-> Maybe (Sensitive Text)
-> Maybe IdentityProviderType
-> Maybe (NonEmpty Protocol)
-> Maybe Domain
-> Maybe EndpointType
-> Maybe Text
-> Maybe Text
-> Maybe IdentityProviderDetails
-> Maybe WorkflowDetails
-> Maybe (NonEmpty Tag)
-> Maybe EndpointDetails
-> CreateServer
CreateServer'
    { $sel:loggingRole:CreateServer' :: Maybe Text
loggingRole = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:hostKey:CreateServer' :: Maybe (Sensitive Text)
hostKey = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:identityProviderType:CreateServer' :: Maybe IdentityProviderType
identityProviderType = Maybe IdentityProviderType
forall a. Maybe a
Prelude.Nothing,
      $sel:protocols:CreateServer' :: Maybe (NonEmpty Protocol)
protocols = Maybe (NonEmpty Protocol)
forall a. Maybe a
Prelude.Nothing,
      $sel:domain:CreateServer' :: Maybe Domain
domain = Maybe Domain
forall a. Maybe a
Prelude.Nothing,
      $sel:endpointType:CreateServer' :: Maybe EndpointType
endpointType = Maybe EndpointType
forall a. Maybe a
Prelude.Nothing,
      $sel:securityPolicyName:CreateServer' :: Maybe Text
securityPolicyName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:certificate:CreateServer' :: Maybe Text
certificate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:identityProviderDetails:CreateServer' :: Maybe IdentityProviderDetails
identityProviderDetails = Maybe IdentityProviderDetails
forall a. Maybe a
Prelude.Nothing,
      $sel:workflowDetails:CreateServer' :: Maybe WorkflowDetails
workflowDetails = Maybe WorkflowDetails
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateServer' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
forall a. Maybe a
Prelude.Nothing,
      $sel:endpointDetails:CreateServer' :: Maybe EndpointDetails
endpointDetails = Maybe EndpointDetails
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies the Amazon Resource Name (ARN) of the Amazon Web Services
-- Identity and Access Management (IAM) role that allows a server to turn
-- on Amazon CloudWatch logging for Amazon S3 or Amazon EFS events. When
-- set, user activity can be viewed in your CloudWatch logs.
createServer_loggingRole :: Lens.Lens' CreateServer (Prelude.Maybe Prelude.Text)
createServer_loggingRole :: (Maybe Text -> f (Maybe Text)) -> CreateServer -> f CreateServer
createServer_loggingRole = (CreateServer -> Maybe Text)
-> (CreateServer -> Maybe Text -> CreateServer)
-> Lens CreateServer CreateServer (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Maybe Text
loggingRole :: Maybe Text
$sel:loggingRole:CreateServer' :: CreateServer -> Maybe Text
loggingRole} -> Maybe Text
loggingRole) (\s :: CreateServer
s@CreateServer' {} Maybe Text
a -> CreateServer
s {$sel:loggingRole:CreateServer' :: Maybe Text
loggingRole = Maybe Text
a} :: CreateServer)

-- | The RSA private key as generated by the
-- @ssh-keygen -N \"\" -m PEM -f my-new-server-key@ command.
--
-- If you aren\'t planning to migrate existing users from an existing
-- SFTP-enabled server to a new server, don\'t update the host key.
-- Accidentally changing a server\'s host key can be disruptive.
--
-- For more information, see
-- <https://docs.aws.amazon.com/transfer/latest/userguide/edit-server-config.html#configuring-servers-change-host-key Change the host key for your SFTP-enabled server>
-- in the /Amazon Web Services Transfer Family User Guide/.
createServer_hostKey :: Lens.Lens' CreateServer (Prelude.Maybe Prelude.Text)
createServer_hostKey :: (Maybe Text -> f (Maybe Text)) -> CreateServer -> f CreateServer
createServer_hostKey = (CreateServer -> Maybe (Sensitive Text))
-> (CreateServer -> Maybe (Sensitive Text) -> CreateServer)
-> Lens
     CreateServer
     CreateServer
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Maybe (Sensitive Text)
hostKey :: Maybe (Sensitive Text)
$sel:hostKey:CreateServer' :: CreateServer -> Maybe (Sensitive Text)
hostKey} -> Maybe (Sensitive Text)
hostKey) (\s :: CreateServer
s@CreateServer' {} Maybe (Sensitive Text)
a -> CreateServer
s {$sel:hostKey:CreateServer' :: Maybe (Sensitive Text)
hostKey = Maybe (Sensitive Text)
a} :: CreateServer) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> CreateServer -> f CreateServer)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> CreateServer
-> f CreateServer
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | Specifies the mode of authentication for a server. The default value is
-- @SERVICE_MANAGED@, which allows you to store and access user credentials
-- within the Amazon Web Services Transfer Family service.
--
-- Use @AWS_DIRECTORY_SERVICE@ to provide access to Active Directory groups
-- in Amazon Web Services Managed Active Directory or Microsoft Active
-- Directory in your on-premises environment or in Amazon Web Services
-- using AD Connectors. This option also requires you to provide a
-- Directory ID using the @IdentityProviderDetails@ parameter.
--
-- Use the @API_GATEWAY@ value to integrate with an identity provider of
-- your choosing. The @API_GATEWAY@ setting requires you to provide an API
-- Gateway endpoint URL to call for authentication using the
-- @IdentityProviderDetails@ parameter.
createServer_identityProviderType :: Lens.Lens' CreateServer (Prelude.Maybe IdentityProviderType)
createServer_identityProviderType :: (Maybe IdentityProviderType -> f (Maybe IdentityProviderType))
-> CreateServer -> f CreateServer
createServer_identityProviderType = (CreateServer -> Maybe IdentityProviderType)
-> (CreateServer -> Maybe IdentityProviderType -> CreateServer)
-> Lens
     CreateServer
     CreateServer
     (Maybe IdentityProviderType)
     (Maybe IdentityProviderType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Maybe IdentityProviderType
identityProviderType :: Maybe IdentityProviderType
$sel:identityProviderType:CreateServer' :: CreateServer -> Maybe IdentityProviderType
identityProviderType} -> Maybe IdentityProviderType
identityProviderType) (\s :: CreateServer
s@CreateServer' {} Maybe IdentityProviderType
a -> CreateServer
s {$sel:identityProviderType:CreateServer' :: Maybe IdentityProviderType
identityProviderType = Maybe IdentityProviderType
a} :: CreateServer)

-- | Specifies the file transfer protocol or protocols over which your file
-- transfer protocol client can connect to your server\'s endpoint. The
-- available protocols are:
--
-- -   @SFTP@ (Secure Shell (SSH) File Transfer Protocol): File transfer
--     over SSH
--
-- -   @FTPS@ (File Transfer Protocol Secure): File transfer with TLS
--     encryption
--
-- -   @FTP@ (File Transfer Protocol): Unencrypted file transfer
--
-- If you select @FTPS@, you must choose a certificate stored in Amazon Web
-- Services Certificate Manager (ACM) which is used to identify your server
-- when clients connect to it over FTPS.
--
-- If @Protocol@ includes either @FTP@ or @FTPS@, then the @EndpointType@
-- must be @VPC@ and the @IdentityProviderType@ must be
-- @AWS_DIRECTORY_SERVICE@ or @API_GATEWAY@.
--
-- If @Protocol@ includes @FTP@, then @AddressAllocationIds@ cannot be
-- associated.
--
-- If @Protocol@ is set only to @SFTP@, the @EndpointType@ can be set to
-- @PUBLIC@ and the @IdentityProviderType@ can be set to @SERVICE_MANAGED@.
createServer_protocols :: Lens.Lens' CreateServer (Prelude.Maybe (Prelude.NonEmpty Protocol))
createServer_protocols :: (Maybe (NonEmpty Protocol) -> f (Maybe (NonEmpty Protocol)))
-> CreateServer -> f CreateServer
createServer_protocols = (CreateServer -> Maybe (NonEmpty Protocol))
-> (CreateServer -> Maybe (NonEmpty Protocol) -> CreateServer)
-> Lens
     CreateServer
     CreateServer
     (Maybe (NonEmpty Protocol))
     (Maybe (NonEmpty Protocol))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Maybe (NonEmpty Protocol)
protocols :: Maybe (NonEmpty Protocol)
$sel:protocols:CreateServer' :: CreateServer -> Maybe (NonEmpty Protocol)
protocols} -> Maybe (NonEmpty Protocol)
protocols) (\s :: CreateServer
s@CreateServer' {} Maybe (NonEmpty Protocol)
a -> CreateServer
s {$sel:protocols:CreateServer' :: Maybe (NonEmpty Protocol)
protocols = Maybe (NonEmpty Protocol)
a} :: CreateServer) ((Maybe (NonEmpty Protocol) -> f (Maybe (NonEmpty Protocol)))
 -> CreateServer -> f CreateServer)
-> ((Maybe (NonEmpty Protocol) -> f (Maybe (NonEmpty Protocol)))
    -> Maybe (NonEmpty Protocol) -> f (Maybe (NonEmpty Protocol)))
-> (Maybe (NonEmpty Protocol) -> f (Maybe (NonEmpty Protocol)))
-> CreateServer
-> f CreateServer
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Protocol)
  (NonEmpty Protocol)
  (NonEmpty Protocol)
  (NonEmpty Protocol)
-> Iso
     (Maybe (NonEmpty Protocol))
     (Maybe (NonEmpty Protocol))
     (Maybe (NonEmpty Protocol))
     (Maybe (NonEmpty Protocol))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (NonEmpty Protocol)
  (NonEmpty Protocol)
  (NonEmpty Protocol)
  (NonEmpty Protocol)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The domain of the storage system that is used for file transfers. There
-- are two domains available: Amazon Simple Storage Service (Amazon S3) and
-- Amazon Elastic File System (Amazon EFS). The default value is S3.
--
-- After the server is created, the domain cannot be changed.
createServer_domain :: Lens.Lens' CreateServer (Prelude.Maybe Domain)
createServer_domain :: (Maybe Domain -> f (Maybe Domain))
-> CreateServer -> f CreateServer
createServer_domain = (CreateServer -> Maybe Domain)
-> (CreateServer -> Maybe Domain -> CreateServer)
-> Lens CreateServer CreateServer (Maybe Domain) (Maybe Domain)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Maybe Domain
domain :: Maybe Domain
$sel:domain:CreateServer' :: CreateServer -> Maybe Domain
domain} -> Maybe Domain
domain) (\s :: CreateServer
s@CreateServer' {} Maybe Domain
a -> CreateServer
s {$sel:domain:CreateServer' :: Maybe Domain
domain = Maybe Domain
a} :: CreateServer)

-- | The type of endpoint that you want your server to use. You can choose to
-- make your server\'s endpoint publicly accessible (PUBLIC) or host it
-- inside your VPC. With an endpoint that is hosted in a VPC, you can
-- restrict access to your server and resources only within your VPC or
-- choose to make it internet facing by attaching Elastic IP addresses
-- directly to it.
--
-- After May 19, 2021, you won\'t be able to create a server using
-- @EndpointType=VPC_ENDPOINT@ in your Amazon Web Services account if your
-- account hasn\'t already done so before May 19, 2021. If you have already
-- created servers with @EndpointType=VPC_ENDPOINT@ in your Amazon Web
-- Services account on or before May 19, 2021, you will not be affected.
-- After this date, use @EndpointType@=@VPC@.
--
-- For more information, see
-- https:\/\/docs.aws.amazon.com\/transfer\/latest\/userguide\/create-server-in-vpc.html#deprecate-vpc-endpoint.
--
-- It is recommended that you use @VPC@ as the @EndpointType@. With this
-- endpoint type, you have the option to directly associate up to three
-- Elastic IPv4 addresses (BYO IP included) with your server\'s endpoint
-- and use VPC security groups to restrict traffic by the client\'s public
-- IP address. This is not possible with @EndpointType@ set to
-- @VPC_ENDPOINT@.
createServer_endpointType :: Lens.Lens' CreateServer (Prelude.Maybe EndpointType)
createServer_endpointType :: (Maybe EndpointType -> f (Maybe EndpointType))
-> CreateServer -> f CreateServer
createServer_endpointType = (CreateServer -> Maybe EndpointType)
-> (CreateServer -> Maybe EndpointType -> CreateServer)
-> Lens
     CreateServer CreateServer (Maybe EndpointType) (Maybe EndpointType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Maybe EndpointType
endpointType :: Maybe EndpointType
$sel:endpointType:CreateServer' :: CreateServer -> Maybe EndpointType
endpointType} -> Maybe EndpointType
endpointType) (\s :: CreateServer
s@CreateServer' {} Maybe EndpointType
a -> CreateServer
s {$sel:endpointType:CreateServer' :: Maybe EndpointType
endpointType = Maybe EndpointType
a} :: CreateServer)

-- | Specifies the name of the security policy that is attached to the
-- server.
createServer_securityPolicyName :: Lens.Lens' CreateServer (Prelude.Maybe Prelude.Text)
createServer_securityPolicyName :: (Maybe Text -> f (Maybe Text)) -> CreateServer -> f CreateServer
createServer_securityPolicyName = (CreateServer -> Maybe Text)
-> (CreateServer -> Maybe Text -> CreateServer)
-> Lens CreateServer CreateServer (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Maybe Text
securityPolicyName :: Maybe Text
$sel:securityPolicyName:CreateServer' :: CreateServer -> Maybe Text
securityPolicyName} -> Maybe Text
securityPolicyName) (\s :: CreateServer
s@CreateServer' {} Maybe Text
a -> CreateServer
s {$sel:securityPolicyName:CreateServer' :: Maybe Text
securityPolicyName = Maybe Text
a} :: CreateServer)

-- | The Amazon Resource Name (ARN) of the Amazon Web Services Certificate
-- Manager (ACM) certificate. Required when @Protocols@ is set to @FTPS@.
--
-- To request a new public certificate, see
-- <https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-request-public.html Request a public certificate>
-- in the /Amazon Web Services Certificate Manager User Guide/.
--
-- To import an existing certificate into ACM, see
-- <https://docs.aws.amazon.com/acm/latest/userguide/import-certificate.html Importing certificates into ACM>
-- in the /Amazon Web Services Certificate Manager User Guide/.
--
-- To request a private certificate to use FTPS through private IP
-- addresses, see
-- <https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-request-private.html Request a private certificate>
-- in the /Amazon Web Services Certificate Manager User Guide/.
--
-- Certificates with the following cryptographic algorithms and key sizes
-- are supported:
--
-- -   2048-bit RSA (RSA_2048)
--
-- -   4096-bit RSA (RSA_4096)
--
-- -   Elliptic Prime Curve 256 bit (EC_prime256v1)
--
-- -   Elliptic Prime Curve 384 bit (EC_secp384r1)
--
-- -   Elliptic Prime Curve 521 bit (EC_secp521r1)
--
-- The certificate must be a valid SSL\/TLS X.509 version 3 certificate
-- with FQDN or IP address specified and information about the issuer.
createServer_certificate :: Lens.Lens' CreateServer (Prelude.Maybe Prelude.Text)
createServer_certificate :: (Maybe Text -> f (Maybe Text)) -> CreateServer -> f CreateServer
createServer_certificate = (CreateServer -> Maybe Text)
-> (CreateServer -> Maybe Text -> CreateServer)
-> Lens CreateServer CreateServer (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Maybe Text
certificate :: Maybe Text
$sel:certificate:CreateServer' :: CreateServer -> Maybe Text
certificate} -> Maybe Text
certificate) (\s :: CreateServer
s@CreateServer' {} Maybe Text
a -> CreateServer
s {$sel:certificate:CreateServer' :: Maybe Text
certificate = Maybe Text
a} :: CreateServer)

-- | Required when @IdentityProviderType@ is set to @AWS_DIRECTORY_SERVICE@
-- or @API_GATEWAY@. Accepts an array containing all of the information
-- required to use a directory in @AWS_DIRECTORY_SERVICE@ or invoke a
-- customer-supplied authentication API, including the API Gateway URL. Not
-- required when @IdentityProviderType@ is set to @SERVICE_MANAGED@.
createServer_identityProviderDetails :: Lens.Lens' CreateServer (Prelude.Maybe IdentityProviderDetails)
createServer_identityProviderDetails :: (Maybe IdentityProviderDetails
 -> f (Maybe IdentityProviderDetails))
-> CreateServer -> f CreateServer
createServer_identityProviderDetails = (CreateServer -> Maybe IdentityProviderDetails)
-> (CreateServer -> Maybe IdentityProviderDetails -> CreateServer)
-> Lens
     CreateServer
     CreateServer
     (Maybe IdentityProviderDetails)
     (Maybe IdentityProviderDetails)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Maybe IdentityProviderDetails
identityProviderDetails :: Maybe IdentityProviderDetails
$sel:identityProviderDetails:CreateServer' :: CreateServer -> Maybe IdentityProviderDetails
identityProviderDetails} -> Maybe IdentityProviderDetails
identityProviderDetails) (\s :: CreateServer
s@CreateServer' {} Maybe IdentityProviderDetails
a -> CreateServer
s {$sel:identityProviderDetails:CreateServer' :: Maybe IdentityProviderDetails
identityProviderDetails = Maybe IdentityProviderDetails
a} :: CreateServer)

-- | Specifies the workflow ID for the workflow to assign and the execution
-- role used for executing the workflow.
createServer_workflowDetails :: Lens.Lens' CreateServer (Prelude.Maybe WorkflowDetails)
createServer_workflowDetails :: (Maybe WorkflowDetails -> f (Maybe WorkflowDetails))
-> CreateServer -> f CreateServer
createServer_workflowDetails = (CreateServer -> Maybe WorkflowDetails)
-> (CreateServer -> Maybe WorkflowDetails -> CreateServer)
-> Lens
     CreateServer
     CreateServer
     (Maybe WorkflowDetails)
     (Maybe WorkflowDetails)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Maybe WorkflowDetails
workflowDetails :: Maybe WorkflowDetails
$sel:workflowDetails:CreateServer' :: CreateServer -> Maybe WorkflowDetails
workflowDetails} -> Maybe WorkflowDetails
workflowDetails) (\s :: CreateServer
s@CreateServer' {} Maybe WorkflowDetails
a -> CreateServer
s {$sel:workflowDetails:CreateServer' :: Maybe WorkflowDetails
workflowDetails = Maybe WorkflowDetails
a} :: CreateServer)

-- | Key-value pairs that can be used to group and search for servers.
createServer_tags :: Lens.Lens' CreateServer (Prelude.Maybe (Prelude.NonEmpty Tag))
createServer_tags :: (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateServer -> f CreateServer
createServer_tags = (CreateServer -> Maybe (NonEmpty Tag))
-> (CreateServer -> Maybe (NonEmpty Tag) -> CreateServer)
-> Lens
     CreateServer
     CreateServer
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Maybe (NonEmpty Tag)
tags :: Maybe (NonEmpty Tag)
$sel:tags:CreateServer' :: CreateServer -> Maybe (NonEmpty Tag)
tags} -> Maybe (NonEmpty Tag)
tags) (\s :: CreateServer
s@CreateServer' {} Maybe (NonEmpty Tag)
a -> CreateServer
s {$sel:tags:CreateServer' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
a} :: CreateServer) ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
 -> CreateServer -> f CreateServer)
-> ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
    -> Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateServer
-> f CreateServer
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag)
-> Iso
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The virtual private cloud (VPC) endpoint settings that are configured
-- for your server. When you host your endpoint within your VPC, you can
-- make it accessible only to resources within your VPC, or you can attach
-- Elastic IP addresses and make it accessible to clients over the
-- internet. Your VPC\'s default security groups are automatically assigned
-- to your endpoint.
createServer_endpointDetails :: Lens.Lens' CreateServer (Prelude.Maybe EndpointDetails)
createServer_endpointDetails :: (Maybe EndpointDetails -> f (Maybe EndpointDetails))
-> CreateServer -> f CreateServer
createServer_endpointDetails = (CreateServer -> Maybe EndpointDetails)
-> (CreateServer -> Maybe EndpointDetails -> CreateServer)
-> Lens
     CreateServer
     CreateServer
     (Maybe EndpointDetails)
     (Maybe EndpointDetails)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServer' {Maybe EndpointDetails
endpointDetails :: Maybe EndpointDetails
$sel:endpointDetails:CreateServer' :: CreateServer -> Maybe EndpointDetails
endpointDetails} -> Maybe EndpointDetails
endpointDetails) (\s :: CreateServer
s@CreateServer' {} Maybe EndpointDetails
a -> CreateServer
s {$sel:endpointDetails:CreateServer' :: Maybe EndpointDetails
endpointDetails = Maybe EndpointDetails
a} :: CreateServer)

instance Core.AWSRequest CreateServer where
  type AWSResponse CreateServer = CreateServerResponse
  request :: CreateServer -> Request CreateServer
request = Service -> CreateServer -> Request CreateServer
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateServer
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateServer)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateServer))
-> Logger
-> Service
-> Proxy CreateServer
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateServer)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> Text -> CreateServerResponse
CreateServerResponse'
            (Int -> Text -> CreateServerResponse)
-> Either String Int
-> Either String (Text -> CreateServerResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            Either String (Text -> CreateServerResponse)
-> Either String Text -> Either String CreateServerResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"ServerId")
      )

instance Prelude.Hashable CreateServer

instance Prelude.NFData CreateServer

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

instance Core.ToJSON CreateServer where
  toJSON :: CreateServer -> Value
toJSON CreateServer' {Maybe (NonEmpty Protocol)
Maybe (NonEmpty Tag)
Maybe Text
Maybe (Sensitive Text)
Maybe Domain
Maybe EndpointDetails
Maybe EndpointType
Maybe IdentityProviderDetails
Maybe IdentityProviderType
Maybe WorkflowDetails
endpointDetails :: Maybe EndpointDetails
tags :: Maybe (NonEmpty Tag)
workflowDetails :: Maybe WorkflowDetails
identityProviderDetails :: Maybe IdentityProviderDetails
certificate :: Maybe Text
securityPolicyName :: Maybe Text
endpointType :: Maybe EndpointType
domain :: Maybe Domain
protocols :: Maybe (NonEmpty Protocol)
identityProviderType :: Maybe IdentityProviderType
hostKey :: Maybe (Sensitive Text)
loggingRole :: Maybe Text
$sel:endpointDetails:CreateServer' :: CreateServer -> Maybe EndpointDetails
$sel:tags:CreateServer' :: CreateServer -> Maybe (NonEmpty Tag)
$sel:workflowDetails:CreateServer' :: CreateServer -> Maybe WorkflowDetails
$sel:identityProviderDetails:CreateServer' :: CreateServer -> Maybe IdentityProviderDetails
$sel:certificate:CreateServer' :: CreateServer -> Maybe Text
$sel:securityPolicyName:CreateServer' :: CreateServer -> Maybe Text
$sel:endpointType:CreateServer' :: CreateServer -> Maybe EndpointType
$sel:domain:CreateServer' :: CreateServer -> Maybe Domain
$sel:protocols:CreateServer' :: CreateServer -> Maybe (NonEmpty Protocol)
$sel:identityProviderType:CreateServer' :: CreateServer -> Maybe IdentityProviderType
$sel:hostKey:CreateServer' :: CreateServer -> Maybe (Sensitive Text)
$sel:loggingRole:CreateServer' :: CreateServer -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"LoggingRole" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
loggingRole,
            (Text
"HostKey" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
hostKey,
            (Text
"IdentityProviderType" Text -> IdentityProviderType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (IdentityProviderType -> Pair)
-> Maybe IdentityProviderType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe IdentityProviderType
identityProviderType,
            (Text
"Protocols" Text -> NonEmpty Protocol -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Protocol -> Pair)
-> Maybe (NonEmpty Protocol) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Protocol)
protocols,
            (Text
"Domain" Text -> Domain -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Domain -> Pair) -> Maybe Domain -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Domain
domain,
            (Text
"EndpointType" Text -> EndpointType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (EndpointType -> Pair) -> Maybe EndpointType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EndpointType
endpointType,
            (Text
"SecurityPolicyName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
securityPolicyName,
            (Text
"Certificate" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
certificate,
            (Text
"IdentityProviderDetails" Text -> IdentityProviderDetails -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (IdentityProviderDetails -> Pair)
-> Maybe IdentityProviderDetails -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe IdentityProviderDetails
identityProviderDetails,
            (Text
"WorkflowDetails" Text -> WorkflowDetails -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (WorkflowDetails -> Pair) -> Maybe WorkflowDetails -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe WorkflowDetails
workflowDetails,
            (Text
"Tags" Text -> NonEmpty Tag -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Tag -> Pair) -> Maybe (NonEmpty Tag) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Tag)
tags,
            (Text
"EndpointDetails" Text -> EndpointDetails -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (EndpointDetails -> Pair) -> Maybe EndpointDetails -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EndpointDetails
endpointDetails
          ]
      )

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

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

-- | /See:/ 'newCreateServerResponse' smart constructor.
data CreateServerResponse = CreateServerResponse'
  { -- | The response's http status code.
    CreateServerResponse -> Int
httpStatus :: Prelude.Int,
    -- | The service-assigned ID of the server that is created.
    CreateServerResponse -> Text
serverId :: Prelude.Text
  }
  deriving (CreateServerResponse -> CreateServerResponse -> Bool
(CreateServerResponse -> CreateServerResponse -> Bool)
-> (CreateServerResponse -> CreateServerResponse -> Bool)
-> Eq CreateServerResponse
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, ReadPrec [CreateServerResponse]
ReadPrec CreateServerResponse
Int -> ReadS CreateServerResponse
ReadS [CreateServerResponse]
(Int -> ReadS CreateServerResponse)
-> ReadS [CreateServerResponse]
-> ReadPrec CreateServerResponse
-> ReadPrec [CreateServerResponse]
-> Read CreateServerResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateServerResponse]
$creadListPrec :: ReadPrec [CreateServerResponse]
readPrec :: ReadPrec CreateServerResponse
$creadPrec :: ReadPrec CreateServerResponse
readList :: ReadS [CreateServerResponse]
$creadList :: ReadS [CreateServerResponse]
readsPrec :: Int -> ReadS CreateServerResponse
$creadsPrec :: Int -> ReadS CreateServerResponse
Prelude.Read, Int -> CreateServerResponse -> ShowS
[CreateServerResponse] -> ShowS
CreateServerResponse -> String
(Int -> CreateServerResponse -> ShowS)
-> (CreateServerResponse -> String)
-> ([CreateServerResponse] -> ShowS)
-> Show CreateServerResponse
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. CreateServerResponse -> Rep CreateServerResponse x)
-> (forall x. Rep CreateServerResponse x -> CreateServerResponse)
-> Generic CreateServerResponse
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:
--
-- 'httpStatus', 'createServerResponse_httpStatus' - The response's http status code.
--
-- 'serverId', 'createServerResponse_serverId' - The service-assigned ID of the server that is created.
newCreateServerResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'serverId'
  Prelude.Text ->
  CreateServerResponse
newCreateServerResponse :: Int -> Text -> CreateServerResponse
newCreateServerResponse Int
pHttpStatus_ Text
pServerId_ =
  CreateServerResponse' :: Int -> Text -> CreateServerResponse
CreateServerResponse'
    { $sel:httpStatus:CreateServerResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:serverId:CreateServerResponse' :: Text
serverId = Text
pServerId_
    }

-- | The response's http status code.
createServerResponse_httpStatus :: Lens.Lens' CreateServerResponse Prelude.Int
createServerResponse_httpStatus :: (Int -> f Int) -> CreateServerResponse -> f CreateServerResponse
createServerResponse_httpStatus = (CreateServerResponse -> Int)
-> (CreateServerResponse -> Int -> CreateServerResponse)
-> Lens CreateServerResponse CreateServerResponse Int Int
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)

-- | The service-assigned ID of the server that is created.
createServerResponse_serverId :: Lens.Lens' CreateServerResponse Prelude.Text
createServerResponse_serverId :: (Text -> f Text) -> CreateServerResponse -> f CreateServerResponse
createServerResponse_serverId = (CreateServerResponse -> Text)
-> (CreateServerResponse -> Text -> CreateServerResponse)
-> Lens CreateServerResponse CreateServerResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServerResponse' {Text
serverId :: Text
$sel:serverId:CreateServerResponse' :: CreateServerResponse -> Text
serverId} -> Text
serverId) (\s :: CreateServerResponse
s@CreateServerResponse' {} Text
a -> CreateServerResponse
s {$sel:serverId:CreateServerResponse' :: Text
serverId = Text
a} :: CreateServerResponse)

instance Prelude.NFData CreateServerResponse