{-# 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.KMS.CreateCustomKeyStore
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a
-- <https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html custom key store>
-- backed by a key store that you own and manage. When you use a KMS key in
-- a custom key store for a cryptographic operation, the cryptographic
-- operation is actually performed in your key store using your keys. KMS
-- supports
-- <https://docs.aws.amazon.com/kms/latest/developerguide/keystore-cloudhsm.html CloudHSM key stores>
-- backed by an
-- <https://docs.aws.amazon.com/cloudhsm/latest/userguide/clusters.html CloudHSM cluster>
-- and
-- <https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html external key stores>
-- backed by an external key store proxy and external key manager outside
-- of Amazon Web Services.
--
-- This operation is part of the
-- <https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html custom key stores>
-- feature in KMS, which combines the convenience and extensive integration
-- of KMS with the isolation and control of a key store that you own and
-- manage.
--
-- Before you create the custom key store, the required elements must be in
-- place and operational. We recommend that you use the test tools that KMS
-- provides to verify the configuration your external key store proxy. For
-- details about the required elements and verification tests, see
-- <https://docs.aws.amazon.com/kms/latest/developerguide/create-keystore.html#before-keystore Assemble the prerequisites (for CloudHSM key stores)>
-- or
-- <https://docs.aws.amazon.com/kms/latest/developerguide/create-xks-keystore.html#xks-requirements Assemble the prerequisites (for external key stores)>
-- in the /Key Management Service Developer Guide/.
--
-- To create a custom key store, use the following parameters.
--
-- -   To create an CloudHSM key store, specify the @CustomKeyStoreName@,
--     @CloudHsmClusterId@, @KeyStorePassword@, and
--     @TrustAnchorCertificate@. The @CustomKeyStoreType@ parameter is
--     optional for CloudHSM key stores. If you include it, set it to the
--     default value, @AWS_CLOUDHSM@. For help with failures, see
--     <https://docs.aws.amazon.com/kms/latest/developerguide/fix-keystore.html Troubleshooting an CloudHSM key store>
--     in the /Key Management Service Developer Guide/.
--
-- -   To create an external key store, specify the @CustomKeyStoreName@
--     and a @CustomKeyStoreType@ of @EXTERNAL_KEY_STORE@. Also, specify
--     values for @XksProxyConnectivity@,
--     @XksProxyAuthenticationCredential@, @XksProxyUriEndpoint@, and
--     @XksProxyUriPath@. If your @XksProxyConnectivity@ value is
--     @VPC_ENDPOINT_SERVICE@, specify the @XksProxyVpcEndpointServiceName@
--     parameter. For help with failures, see
--     <https://docs.aws.amazon.com/kms/latest/developerguide/xks-troubleshooting.html Troubleshooting an external key store>
--     in the /Key Management Service Developer Guide/.
--
-- For external key stores:
--
-- Some external key managers provide a simpler method for creating an
-- external key store. For details, see your external key manager
-- documentation.
--
-- When creating an external key store in the KMS console, you can upload a
-- JSON-based proxy configuration file with the desired values. You cannot
-- use a proxy configuration with the @CreateCustomKeyStore@ operation.
-- However, you can use the values in the file to help you determine the
-- correct values for the @CreateCustomKeyStore@ parameters.
--
-- When the operation completes successfully, it returns the ID of the new
-- custom key store. Before you can use your new custom key store, you need
-- to use the ConnectCustomKeyStore operation to connect a new CloudHSM key
-- store to its CloudHSM cluster, or to connect a new external key store to
-- the external key store proxy for your external key manager. Even if you
-- are not going to use your custom key store immediately, you might want
-- to connect it to verify that all settings are correct and then
-- disconnect it until you are ready to use it.
--
-- For help with failures, see
-- <https://docs.aws.amazon.com/kms/latest/developerguide/fix-keystore.html Troubleshooting a custom key store>
-- in the /Key Management Service Developer Guide/.
--
-- __Cross-account use__: No. You cannot perform this operation on a custom
-- key store in a different Amazon Web Services account.
--
-- __Required permissions__:
-- <https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html kms:CreateCustomKeyStore>
-- (IAM policy).
--
-- __Related operations:__
--
-- -   ConnectCustomKeyStore
--
-- -   DeleteCustomKeyStore
--
-- -   DescribeCustomKeyStores
--
-- -   DisconnectCustomKeyStore
--
-- -   UpdateCustomKeyStore
module Amazonka.KMS.CreateCustomKeyStore
  ( -- * Creating a Request
    CreateCustomKeyStore (..),
    newCreateCustomKeyStore,

    -- * Request Lenses
    createCustomKeyStore_cloudHsmClusterId,
    createCustomKeyStore_customKeyStoreType,
    createCustomKeyStore_keyStorePassword,
    createCustomKeyStore_trustAnchorCertificate,
    createCustomKeyStore_xksProxyAuthenticationCredential,
    createCustomKeyStore_xksProxyConnectivity,
    createCustomKeyStore_xksProxyUriEndpoint,
    createCustomKeyStore_xksProxyUriPath,
    createCustomKeyStore_xksProxyVpcEndpointServiceName,
    createCustomKeyStore_customKeyStoreName,

    -- * Destructuring the Response
    CreateCustomKeyStoreResponse (..),
    newCreateCustomKeyStoreResponse,

    -- * Response Lenses
    createCustomKeyStoreResponse_customKeyStoreId,
    createCustomKeyStoreResponse_httpStatus,
  )
where

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

-- | /See:/ 'newCreateCustomKeyStore' smart constructor.
data CreateCustomKeyStore = CreateCustomKeyStore'
  { -- | Identifies the CloudHSM cluster for an CloudHSM key store. This
    -- parameter is required for custom key stores with @CustomKeyStoreType@ of
    -- @AWS_CLOUDHSM@.
    --
    -- Enter the cluster ID of any active CloudHSM cluster that is not already
    -- associated with a custom key store. To find the cluster ID, use the
    -- <https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_DescribeClusters.html DescribeClusters>
    -- operation.
    CreateCustomKeyStore -> Maybe Text
cloudHsmClusterId :: Prelude.Maybe Prelude.Text,
    -- | Specifies the type of custom key store. The default value is
    -- @AWS_CLOUDHSM@.
    --
    -- For a custom key store backed by an CloudHSM cluster, omit the parameter
    -- or enter @AWS_CLOUDHSM@. For a custom key store backed by an external
    -- key manager outside of Amazon Web Services, enter @EXTERNAL_KEY_STORE@.
    -- You cannot change this property after the key store is created.
    CreateCustomKeyStore -> Maybe CustomKeyStoreType
customKeyStoreType :: Prelude.Maybe CustomKeyStoreType,
    -- | Specifies the @kmsuser@ password for an CloudHSM key store. This
    -- parameter is required for custom key stores with a @CustomKeyStoreType@
    -- of @AWS_CLOUDHSM@.
    --
    -- Enter the password of the
    -- <https://docs.aws.amazon.com/kms/latest/developerguide/key-store-concepts.html#concept-kmsuser kmsuser crypto user (CU) account>
    -- in the specified CloudHSM cluster. KMS logs into the cluster as this
    -- user to manage key material on your behalf.
    --
    -- The password must be a string of 7 to 32 characters. Its value is case
    -- sensitive.
    --
    -- This parameter tells KMS the @kmsuser@ account password; it does not
    -- change the password in the CloudHSM cluster.
    CreateCustomKeyStore -> Maybe (Sensitive Text)
keyStorePassword :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | Specifies the certificate for an CloudHSM key store. This parameter is
    -- required for custom key stores with a @CustomKeyStoreType@ of
    -- @AWS_CLOUDHSM@.
    --
    -- Enter the content of the trust anchor certificate for the CloudHSM
    -- cluster. This is the content of the @customerCA.crt@ file that you
    -- created when you
    -- <https://docs.aws.amazon.com/cloudhsm/latest/userguide/initialize-cluster.html initialized the cluster>.
    CreateCustomKeyStore -> Maybe Text
trustAnchorCertificate :: Prelude.Maybe Prelude.Text,
    -- | Specifies an authentication credential for the external key store proxy
    -- (XKS proxy). This parameter is required for all custom key stores with a
    -- @CustomKeyStoreType@ of @EXTERNAL_KEY_STORE@.
    --
    -- The @XksProxyAuthenticationCredential@ has two required elements:
    -- @RawSecretAccessKey@, a secret key, and @AccessKeyId@, a unique
    -- identifier for the @RawSecretAccessKey@. For character requirements, see
    -- <kms/latest/APIReference/API_XksProxyAuthenticationCredentialType.html XksProxyAuthenticationCredentialType>.
    --
    -- KMS uses this authentication credential to sign requests to the external
    -- key store proxy on your behalf. This credential is unrelated to Identity
    -- and Access Management (IAM) and Amazon Web Services credentials.
    --
    -- This parameter doesn\'t set or change the authentication credentials on
    -- the XKS proxy. It just tells KMS the credential that you established on
    -- your external key store proxy. If you rotate your proxy authentication
    -- credential, use the UpdateCustomKeyStore operation to provide the new
    -- credential to KMS.
    CreateCustomKeyStore -> Maybe XksProxyAuthenticationCredentialType
xksProxyAuthenticationCredential :: Prelude.Maybe XksProxyAuthenticationCredentialType,
    -- | Indicates how KMS communicates with the external key store proxy. This
    -- parameter is required for custom key stores with a @CustomKeyStoreType@
    -- of @EXTERNAL_KEY_STORE@.
    --
    -- If the external key store proxy uses a public endpoint, specify
    -- @PUBLIC_ENDPOINT@. If the external key store proxy uses a Amazon VPC
    -- endpoint service for communication with KMS, specify
    -- @VPC_ENDPOINT_SERVICE@. For help making this choice, see
    -- <https://docs.aws.amazon.com/kms/latest/developerguide/plan-xks-keystore.html#choose-xks-connectivity Choosing a connectivity option>
    -- in the /Key Management Service Developer Guide/.
    --
    -- An Amazon VPC endpoint service keeps your communication with KMS in a
    -- private address space entirely within Amazon Web Services, but it
    -- requires more configuration, including establishing a Amazon VPC with
    -- multiple subnets, a VPC endpoint service, a network load balancer, and a
    -- verified private DNS name. A public endpoint is simpler to set up, but
    -- it might be slower and might not fulfill your security requirements. You
    -- might consider testing with a public endpoint, and then establishing a
    -- VPC endpoint service for production tasks. Note that this choice does
    -- not determine the location of the external key store proxy. Even if you
    -- choose a VPC endpoint service, the proxy can be hosted within the VPC or
    -- outside of Amazon Web Services such as in your corporate data center.
    CreateCustomKeyStore -> Maybe XksProxyConnectivityType
xksProxyConnectivity :: Prelude.Maybe XksProxyConnectivityType,
    -- | Specifies the endpoint that KMS uses to send requests to the external
    -- key store proxy (XKS proxy). This parameter is required for custom key
    -- stores with a @CustomKeyStoreType@ of @EXTERNAL_KEY_STORE@.
    --
    -- The protocol must be HTTPS. KMS communicates on port 443. Do not specify
    -- the port in the @XksProxyUriEndpoint@ value.
    --
    -- For external key stores with @XksProxyConnectivity@ value of
    -- @VPC_ENDPOINT_SERVICE@, specify @https:\/\/@ followed by the private DNS
    -- name of the VPC endpoint service.
    --
    -- For external key stores with @PUBLIC_ENDPOINT@ connectivity, this
    -- endpoint must be reachable before you create the custom key store. KMS
    -- connects to the external key store proxy while creating the custom key
    -- store. For external key stores with @VPC_ENDPOINT_SERVICE@ connectivity,
    -- KMS connects when you call the ConnectCustomKeyStore operation.
    --
    -- The value of this parameter must begin with @https:\/\/@. The remainder
    -- can contain upper and lower case letters (A-Z and a-z), numbers (0-9),
    -- dots (@.@), and hyphens (@-@). Additional slashes (@\/@ and @\\@) are
    -- not permitted.
    --
    -- __Uniqueness requirements:__
    --
    -- -   The combined @XksProxyUriEndpoint@ and @XksProxyUriPath@ values must
    --     be unique in the Amazon Web Services account and Region.
    --
    -- -   An external key store with @PUBLIC_ENDPOINT@ connectivity cannot use
    --     the same @XksProxyUriEndpoint@ value as an external key store with
    --     @VPC_ENDPOINT_SERVICE@ connectivity in the same Amazon Web Services
    --     Region.
    --
    -- -   Each external key store with @VPC_ENDPOINT_SERVICE@ connectivity
    --     must have its own private DNS name. The @XksProxyUriEndpoint@ value
    --     for external key stores with @VPC_ENDPOINT_SERVICE@ connectivity
    --     (private DNS name) must be unique in the Amazon Web Services account
    --     and Region.
    CreateCustomKeyStore -> Maybe Text
xksProxyUriEndpoint :: Prelude.Maybe Prelude.Text,
    -- | Specifies the base path to the proxy APIs for this external key store.
    -- To find this value, see the documentation for your external key store
    -- proxy. This parameter is required for all custom key stores with a
    -- @CustomKeyStoreType@ of @EXTERNAL_KEY_STORE@.
    --
    -- The value must start with @\/@ and must end with @\/kms\/xks\/v1@ where
    -- @v1@ represents the version of the KMS external key store proxy API.
    -- This path can include an optional prefix between the required elements
    -- such as @\/@/@prefix@/@\/kms\/xks\/v1@.
    --
    -- __Uniqueness requirements:__
    --
    -- -   The combined @XksProxyUriEndpoint@ and @XksProxyUriPath@ values must
    --     be unique in the Amazon Web Services account and Region.
    CreateCustomKeyStore -> Maybe Text
xksProxyUriPath :: Prelude.Maybe Prelude.Text,
    -- | Specifies the name of the Amazon VPC endpoint service for interface
    -- endpoints that is used to communicate with your external key store proxy
    -- (XKS proxy). This parameter is required when the value of
    -- @CustomKeyStoreType@ is @EXTERNAL_KEY_STORE@ and the value of
    -- @XksProxyConnectivity@ is @VPC_ENDPOINT_SERVICE@.
    --
    -- The Amazon VPC endpoint service must
    -- <https://docs.aws.amazon.com/kms/latest/developerguide/create-xks-keystore.html#xks-requirements fulfill all requirements>
    -- for use with an external key store.
    --
    -- __Uniqueness requirements:__
    --
    -- -   External key stores with @VPC_ENDPOINT_SERVICE@ connectivity can
    --     share an Amazon VPC, but each external key store must have its own
    --     VPC endpoint service and private DNS name.
    CreateCustomKeyStore -> Maybe Text
xksProxyVpcEndpointServiceName :: Prelude.Maybe Prelude.Text,
    -- | Specifies a friendly name for the custom key store. The name must be
    -- unique in your Amazon Web Services account and Region. This parameter is
    -- required for all custom key stores.
    CreateCustomKeyStore -> Text
customKeyStoreName :: Prelude.Text
  }
  deriving (CreateCustomKeyStore -> CreateCustomKeyStore -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCustomKeyStore -> CreateCustomKeyStore -> Bool
$c/= :: CreateCustomKeyStore -> CreateCustomKeyStore -> Bool
== :: CreateCustomKeyStore -> CreateCustomKeyStore -> Bool
$c== :: CreateCustomKeyStore -> CreateCustomKeyStore -> Bool
Prelude.Eq, Int -> CreateCustomKeyStore -> ShowS
[CreateCustomKeyStore] -> ShowS
CreateCustomKeyStore -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCustomKeyStore] -> ShowS
$cshowList :: [CreateCustomKeyStore] -> ShowS
show :: CreateCustomKeyStore -> String
$cshow :: CreateCustomKeyStore -> String
showsPrec :: Int -> CreateCustomKeyStore -> ShowS
$cshowsPrec :: Int -> CreateCustomKeyStore -> ShowS
Prelude.Show, forall x. Rep CreateCustomKeyStore x -> CreateCustomKeyStore
forall x. CreateCustomKeyStore -> Rep CreateCustomKeyStore x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateCustomKeyStore x -> CreateCustomKeyStore
$cfrom :: forall x. CreateCustomKeyStore -> Rep CreateCustomKeyStore x
Prelude.Generic)

-- |
-- Create a value of 'CreateCustomKeyStore' 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:
--
-- 'cloudHsmClusterId', 'createCustomKeyStore_cloudHsmClusterId' - Identifies the CloudHSM cluster for an CloudHSM key store. This
-- parameter is required for custom key stores with @CustomKeyStoreType@ of
-- @AWS_CLOUDHSM@.
--
-- Enter the cluster ID of any active CloudHSM cluster that is not already
-- associated with a custom key store. To find the cluster ID, use the
-- <https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_DescribeClusters.html DescribeClusters>
-- operation.
--
-- 'customKeyStoreType', 'createCustomKeyStore_customKeyStoreType' - Specifies the type of custom key store. The default value is
-- @AWS_CLOUDHSM@.
--
-- For a custom key store backed by an CloudHSM cluster, omit the parameter
-- or enter @AWS_CLOUDHSM@. For a custom key store backed by an external
-- key manager outside of Amazon Web Services, enter @EXTERNAL_KEY_STORE@.
-- You cannot change this property after the key store is created.
--
-- 'keyStorePassword', 'createCustomKeyStore_keyStorePassword' - Specifies the @kmsuser@ password for an CloudHSM key store. This
-- parameter is required for custom key stores with a @CustomKeyStoreType@
-- of @AWS_CLOUDHSM@.
--
-- Enter the password of the
-- <https://docs.aws.amazon.com/kms/latest/developerguide/key-store-concepts.html#concept-kmsuser kmsuser crypto user (CU) account>
-- in the specified CloudHSM cluster. KMS logs into the cluster as this
-- user to manage key material on your behalf.
--
-- The password must be a string of 7 to 32 characters. Its value is case
-- sensitive.
--
-- This parameter tells KMS the @kmsuser@ account password; it does not
-- change the password in the CloudHSM cluster.
--
-- 'trustAnchorCertificate', 'createCustomKeyStore_trustAnchorCertificate' - Specifies the certificate for an CloudHSM key store. This parameter is
-- required for custom key stores with a @CustomKeyStoreType@ of
-- @AWS_CLOUDHSM@.
--
-- Enter the content of the trust anchor certificate for the CloudHSM
-- cluster. This is the content of the @customerCA.crt@ file that you
-- created when you
-- <https://docs.aws.amazon.com/cloudhsm/latest/userguide/initialize-cluster.html initialized the cluster>.
--
-- 'xksProxyAuthenticationCredential', 'createCustomKeyStore_xksProxyAuthenticationCredential' - Specifies an authentication credential for the external key store proxy
-- (XKS proxy). This parameter is required for all custom key stores with a
-- @CustomKeyStoreType@ of @EXTERNAL_KEY_STORE@.
--
-- The @XksProxyAuthenticationCredential@ has two required elements:
-- @RawSecretAccessKey@, a secret key, and @AccessKeyId@, a unique
-- identifier for the @RawSecretAccessKey@. For character requirements, see
-- <kms/latest/APIReference/API_XksProxyAuthenticationCredentialType.html XksProxyAuthenticationCredentialType>.
--
-- KMS uses this authentication credential to sign requests to the external
-- key store proxy on your behalf. This credential is unrelated to Identity
-- and Access Management (IAM) and Amazon Web Services credentials.
--
-- This parameter doesn\'t set or change the authentication credentials on
-- the XKS proxy. It just tells KMS the credential that you established on
-- your external key store proxy. If you rotate your proxy authentication
-- credential, use the UpdateCustomKeyStore operation to provide the new
-- credential to KMS.
--
-- 'xksProxyConnectivity', 'createCustomKeyStore_xksProxyConnectivity' - Indicates how KMS communicates with the external key store proxy. This
-- parameter is required for custom key stores with a @CustomKeyStoreType@
-- of @EXTERNAL_KEY_STORE@.
--
-- If the external key store proxy uses a public endpoint, specify
-- @PUBLIC_ENDPOINT@. If the external key store proxy uses a Amazon VPC
-- endpoint service for communication with KMS, specify
-- @VPC_ENDPOINT_SERVICE@. For help making this choice, see
-- <https://docs.aws.amazon.com/kms/latest/developerguide/plan-xks-keystore.html#choose-xks-connectivity Choosing a connectivity option>
-- in the /Key Management Service Developer Guide/.
--
-- An Amazon VPC endpoint service keeps your communication with KMS in a
-- private address space entirely within Amazon Web Services, but it
-- requires more configuration, including establishing a Amazon VPC with
-- multiple subnets, a VPC endpoint service, a network load balancer, and a
-- verified private DNS name. A public endpoint is simpler to set up, but
-- it might be slower and might not fulfill your security requirements. You
-- might consider testing with a public endpoint, and then establishing a
-- VPC endpoint service for production tasks. Note that this choice does
-- not determine the location of the external key store proxy. Even if you
-- choose a VPC endpoint service, the proxy can be hosted within the VPC or
-- outside of Amazon Web Services such as in your corporate data center.
--
-- 'xksProxyUriEndpoint', 'createCustomKeyStore_xksProxyUriEndpoint' - Specifies the endpoint that KMS uses to send requests to the external
-- key store proxy (XKS proxy). This parameter is required for custom key
-- stores with a @CustomKeyStoreType@ of @EXTERNAL_KEY_STORE@.
--
-- The protocol must be HTTPS. KMS communicates on port 443. Do not specify
-- the port in the @XksProxyUriEndpoint@ value.
--
-- For external key stores with @XksProxyConnectivity@ value of
-- @VPC_ENDPOINT_SERVICE@, specify @https:\/\/@ followed by the private DNS
-- name of the VPC endpoint service.
--
-- For external key stores with @PUBLIC_ENDPOINT@ connectivity, this
-- endpoint must be reachable before you create the custom key store. KMS
-- connects to the external key store proxy while creating the custom key
-- store. For external key stores with @VPC_ENDPOINT_SERVICE@ connectivity,
-- KMS connects when you call the ConnectCustomKeyStore operation.
--
-- The value of this parameter must begin with @https:\/\/@. The remainder
-- can contain upper and lower case letters (A-Z and a-z), numbers (0-9),
-- dots (@.@), and hyphens (@-@). Additional slashes (@\/@ and @\\@) are
-- not permitted.
--
-- __Uniqueness requirements:__
--
-- -   The combined @XksProxyUriEndpoint@ and @XksProxyUriPath@ values must
--     be unique in the Amazon Web Services account and Region.
--
-- -   An external key store with @PUBLIC_ENDPOINT@ connectivity cannot use
--     the same @XksProxyUriEndpoint@ value as an external key store with
--     @VPC_ENDPOINT_SERVICE@ connectivity in the same Amazon Web Services
--     Region.
--
-- -   Each external key store with @VPC_ENDPOINT_SERVICE@ connectivity
--     must have its own private DNS name. The @XksProxyUriEndpoint@ value
--     for external key stores with @VPC_ENDPOINT_SERVICE@ connectivity
--     (private DNS name) must be unique in the Amazon Web Services account
--     and Region.
--
-- 'xksProxyUriPath', 'createCustomKeyStore_xksProxyUriPath' - Specifies the base path to the proxy APIs for this external key store.
-- To find this value, see the documentation for your external key store
-- proxy. This parameter is required for all custom key stores with a
-- @CustomKeyStoreType@ of @EXTERNAL_KEY_STORE@.
--
-- The value must start with @\/@ and must end with @\/kms\/xks\/v1@ where
-- @v1@ represents the version of the KMS external key store proxy API.
-- This path can include an optional prefix between the required elements
-- such as @\/@/@prefix@/@\/kms\/xks\/v1@.
--
-- __Uniqueness requirements:__
--
-- -   The combined @XksProxyUriEndpoint@ and @XksProxyUriPath@ values must
--     be unique in the Amazon Web Services account and Region.
--
-- 'xksProxyVpcEndpointServiceName', 'createCustomKeyStore_xksProxyVpcEndpointServiceName' - Specifies the name of the Amazon VPC endpoint service for interface
-- endpoints that is used to communicate with your external key store proxy
-- (XKS proxy). This parameter is required when the value of
-- @CustomKeyStoreType@ is @EXTERNAL_KEY_STORE@ and the value of
-- @XksProxyConnectivity@ is @VPC_ENDPOINT_SERVICE@.
--
-- The Amazon VPC endpoint service must
-- <https://docs.aws.amazon.com/kms/latest/developerguide/create-xks-keystore.html#xks-requirements fulfill all requirements>
-- for use with an external key store.
--
-- __Uniqueness requirements:__
--
-- -   External key stores with @VPC_ENDPOINT_SERVICE@ connectivity can
--     share an Amazon VPC, but each external key store must have its own
--     VPC endpoint service and private DNS name.
--
-- 'customKeyStoreName', 'createCustomKeyStore_customKeyStoreName' - Specifies a friendly name for the custom key store. The name must be
-- unique in your Amazon Web Services account and Region. This parameter is
-- required for all custom key stores.
newCreateCustomKeyStore ::
  -- | 'customKeyStoreName'
  Prelude.Text ->
  CreateCustomKeyStore
newCreateCustomKeyStore :: Text -> CreateCustomKeyStore
newCreateCustomKeyStore Text
pCustomKeyStoreName_ =
  CreateCustomKeyStore'
    { $sel:cloudHsmClusterId:CreateCustomKeyStore' :: Maybe Text
cloudHsmClusterId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:customKeyStoreType:CreateCustomKeyStore' :: Maybe CustomKeyStoreType
customKeyStoreType = forall a. Maybe a
Prelude.Nothing,
      $sel:keyStorePassword:CreateCustomKeyStore' :: Maybe (Sensitive Text)
keyStorePassword = forall a. Maybe a
Prelude.Nothing,
      $sel:trustAnchorCertificate:CreateCustomKeyStore' :: Maybe Text
trustAnchorCertificate = forall a. Maybe a
Prelude.Nothing,
      $sel:xksProxyAuthenticationCredential:CreateCustomKeyStore' :: Maybe XksProxyAuthenticationCredentialType
xksProxyAuthenticationCredential = forall a. Maybe a
Prelude.Nothing,
      $sel:xksProxyConnectivity:CreateCustomKeyStore' :: Maybe XksProxyConnectivityType
xksProxyConnectivity = forall a. Maybe a
Prelude.Nothing,
      $sel:xksProxyUriEndpoint:CreateCustomKeyStore' :: Maybe Text
xksProxyUriEndpoint = forall a. Maybe a
Prelude.Nothing,
      $sel:xksProxyUriPath:CreateCustomKeyStore' :: Maybe Text
xksProxyUriPath = forall a. Maybe a
Prelude.Nothing,
      $sel:xksProxyVpcEndpointServiceName:CreateCustomKeyStore' :: Maybe Text
xksProxyVpcEndpointServiceName = forall a. Maybe a
Prelude.Nothing,
      $sel:customKeyStoreName:CreateCustomKeyStore' :: Text
customKeyStoreName = Text
pCustomKeyStoreName_
    }

-- | Identifies the CloudHSM cluster for an CloudHSM key store. This
-- parameter is required for custom key stores with @CustomKeyStoreType@ of
-- @AWS_CLOUDHSM@.
--
-- Enter the cluster ID of any active CloudHSM cluster that is not already
-- associated with a custom key store. To find the cluster ID, use the
-- <https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_DescribeClusters.html DescribeClusters>
-- operation.
createCustomKeyStore_cloudHsmClusterId :: Lens.Lens' CreateCustomKeyStore (Prelude.Maybe Prelude.Text)
createCustomKeyStore_cloudHsmClusterId :: Lens' CreateCustomKeyStore (Maybe Text)
createCustomKeyStore_cloudHsmClusterId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomKeyStore' {Maybe Text
cloudHsmClusterId :: Maybe Text
$sel:cloudHsmClusterId:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe Text
cloudHsmClusterId} -> Maybe Text
cloudHsmClusterId) (\s :: CreateCustomKeyStore
s@CreateCustomKeyStore' {} Maybe Text
a -> CreateCustomKeyStore
s {$sel:cloudHsmClusterId:CreateCustomKeyStore' :: Maybe Text
cloudHsmClusterId = Maybe Text
a} :: CreateCustomKeyStore)

-- | Specifies the type of custom key store. The default value is
-- @AWS_CLOUDHSM@.
--
-- For a custom key store backed by an CloudHSM cluster, omit the parameter
-- or enter @AWS_CLOUDHSM@. For a custom key store backed by an external
-- key manager outside of Amazon Web Services, enter @EXTERNAL_KEY_STORE@.
-- You cannot change this property after the key store is created.
createCustomKeyStore_customKeyStoreType :: Lens.Lens' CreateCustomKeyStore (Prelude.Maybe CustomKeyStoreType)
createCustomKeyStore_customKeyStoreType :: Lens' CreateCustomKeyStore (Maybe CustomKeyStoreType)
createCustomKeyStore_customKeyStoreType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomKeyStore' {Maybe CustomKeyStoreType
customKeyStoreType :: Maybe CustomKeyStoreType
$sel:customKeyStoreType:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe CustomKeyStoreType
customKeyStoreType} -> Maybe CustomKeyStoreType
customKeyStoreType) (\s :: CreateCustomKeyStore
s@CreateCustomKeyStore' {} Maybe CustomKeyStoreType
a -> CreateCustomKeyStore
s {$sel:customKeyStoreType:CreateCustomKeyStore' :: Maybe CustomKeyStoreType
customKeyStoreType = Maybe CustomKeyStoreType
a} :: CreateCustomKeyStore)

-- | Specifies the @kmsuser@ password for an CloudHSM key store. This
-- parameter is required for custom key stores with a @CustomKeyStoreType@
-- of @AWS_CLOUDHSM@.
--
-- Enter the password of the
-- <https://docs.aws.amazon.com/kms/latest/developerguide/key-store-concepts.html#concept-kmsuser kmsuser crypto user (CU) account>
-- in the specified CloudHSM cluster. KMS logs into the cluster as this
-- user to manage key material on your behalf.
--
-- The password must be a string of 7 to 32 characters. Its value is case
-- sensitive.
--
-- This parameter tells KMS the @kmsuser@ account password; it does not
-- change the password in the CloudHSM cluster.
createCustomKeyStore_keyStorePassword :: Lens.Lens' CreateCustomKeyStore (Prelude.Maybe Prelude.Text)
createCustomKeyStore_keyStorePassword :: Lens' CreateCustomKeyStore (Maybe Text)
createCustomKeyStore_keyStorePassword = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomKeyStore' {Maybe (Sensitive Text)
keyStorePassword :: Maybe (Sensitive Text)
$sel:keyStorePassword:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe (Sensitive Text)
keyStorePassword} -> Maybe (Sensitive Text)
keyStorePassword) (\s :: CreateCustomKeyStore
s@CreateCustomKeyStore' {} Maybe (Sensitive Text)
a -> CreateCustomKeyStore
s {$sel:keyStorePassword:CreateCustomKeyStore' :: Maybe (Sensitive Text)
keyStorePassword = Maybe (Sensitive Text)
a} :: CreateCustomKeyStore) 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

-- | Specifies the certificate for an CloudHSM key store. This parameter is
-- required for custom key stores with a @CustomKeyStoreType@ of
-- @AWS_CLOUDHSM@.
--
-- Enter the content of the trust anchor certificate for the CloudHSM
-- cluster. This is the content of the @customerCA.crt@ file that you
-- created when you
-- <https://docs.aws.amazon.com/cloudhsm/latest/userguide/initialize-cluster.html initialized the cluster>.
createCustomKeyStore_trustAnchorCertificate :: Lens.Lens' CreateCustomKeyStore (Prelude.Maybe Prelude.Text)
createCustomKeyStore_trustAnchorCertificate :: Lens' CreateCustomKeyStore (Maybe Text)
createCustomKeyStore_trustAnchorCertificate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomKeyStore' {Maybe Text
trustAnchorCertificate :: Maybe Text
$sel:trustAnchorCertificate:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe Text
trustAnchorCertificate} -> Maybe Text
trustAnchorCertificate) (\s :: CreateCustomKeyStore
s@CreateCustomKeyStore' {} Maybe Text
a -> CreateCustomKeyStore
s {$sel:trustAnchorCertificate:CreateCustomKeyStore' :: Maybe Text
trustAnchorCertificate = Maybe Text
a} :: CreateCustomKeyStore)

-- | Specifies an authentication credential for the external key store proxy
-- (XKS proxy). This parameter is required for all custom key stores with a
-- @CustomKeyStoreType@ of @EXTERNAL_KEY_STORE@.
--
-- The @XksProxyAuthenticationCredential@ has two required elements:
-- @RawSecretAccessKey@, a secret key, and @AccessKeyId@, a unique
-- identifier for the @RawSecretAccessKey@. For character requirements, see
-- <kms/latest/APIReference/API_XksProxyAuthenticationCredentialType.html XksProxyAuthenticationCredentialType>.
--
-- KMS uses this authentication credential to sign requests to the external
-- key store proxy on your behalf. This credential is unrelated to Identity
-- and Access Management (IAM) and Amazon Web Services credentials.
--
-- This parameter doesn\'t set or change the authentication credentials on
-- the XKS proxy. It just tells KMS the credential that you established on
-- your external key store proxy. If you rotate your proxy authentication
-- credential, use the UpdateCustomKeyStore operation to provide the new
-- credential to KMS.
createCustomKeyStore_xksProxyAuthenticationCredential :: Lens.Lens' CreateCustomKeyStore (Prelude.Maybe XksProxyAuthenticationCredentialType)
createCustomKeyStore_xksProxyAuthenticationCredential :: Lens'
  CreateCustomKeyStore (Maybe XksProxyAuthenticationCredentialType)
createCustomKeyStore_xksProxyAuthenticationCredential = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomKeyStore' {Maybe XksProxyAuthenticationCredentialType
xksProxyAuthenticationCredential :: Maybe XksProxyAuthenticationCredentialType
$sel:xksProxyAuthenticationCredential:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe XksProxyAuthenticationCredentialType
xksProxyAuthenticationCredential} -> Maybe XksProxyAuthenticationCredentialType
xksProxyAuthenticationCredential) (\s :: CreateCustomKeyStore
s@CreateCustomKeyStore' {} Maybe XksProxyAuthenticationCredentialType
a -> CreateCustomKeyStore
s {$sel:xksProxyAuthenticationCredential:CreateCustomKeyStore' :: Maybe XksProxyAuthenticationCredentialType
xksProxyAuthenticationCredential = Maybe XksProxyAuthenticationCredentialType
a} :: CreateCustomKeyStore)

-- | Indicates how KMS communicates with the external key store proxy. This
-- parameter is required for custom key stores with a @CustomKeyStoreType@
-- of @EXTERNAL_KEY_STORE@.
--
-- If the external key store proxy uses a public endpoint, specify
-- @PUBLIC_ENDPOINT@. If the external key store proxy uses a Amazon VPC
-- endpoint service for communication with KMS, specify
-- @VPC_ENDPOINT_SERVICE@. For help making this choice, see
-- <https://docs.aws.amazon.com/kms/latest/developerguide/plan-xks-keystore.html#choose-xks-connectivity Choosing a connectivity option>
-- in the /Key Management Service Developer Guide/.
--
-- An Amazon VPC endpoint service keeps your communication with KMS in a
-- private address space entirely within Amazon Web Services, but it
-- requires more configuration, including establishing a Amazon VPC with
-- multiple subnets, a VPC endpoint service, a network load balancer, and a
-- verified private DNS name. A public endpoint is simpler to set up, but
-- it might be slower and might not fulfill your security requirements. You
-- might consider testing with a public endpoint, and then establishing a
-- VPC endpoint service for production tasks. Note that this choice does
-- not determine the location of the external key store proxy. Even if you
-- choose a VPC endpoint service, the proxy can be hosted within the VPC or
-- outside of Amazon Web Services such as in your corporate data center.
createCustomKeyStore_xksProxyConnectivity :: Lens.Lens' CreateCustomKeyStore (Prelude.Maybe XksProxyConnectivityType)
createCustomKeyStore_xksProxyConnectivity :: Lens' CreateCustomKeyStore (Maybe XksProxyConnectivityType)
createCustomKeyStore_xksProxyConnectivity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomKeyStore' {Maybe XksProxyConnectivityType
xksProxyConnectivity :: Maybe XksProxyConnectivityType
$sel:xksProxyConnectivity:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe XksProxyConnectivityType
xksProxyConnectivity} -> Maybe XksProxyConnectivityType
xksProxyConnectivity) (\s :: CreateCustomKeyStore
s@CreateCustomKeyStore' {} Maybe XksProxyConnectivityType
a -> CreateCustomKeyStore
s {$sel:xksProxyConnectivity:CreateCustomKeyStore' :: Maybe XksProxyConnectivityType
xksProxyConnectivity = Maybe XksProxyConnectivityType
a} :: CreateCustomKeyStore)

-- | Specifies the endpoint that KMS uses to send requests to the external
-- key store proxy (XKS proxy). This parameter is required for custom key
-- stores with a @CustomKeyStoreType@ of @EXTERNAL_KEY_STORE@.
--
-- The protocol must be HTTPS. KMS communicates on port 443. Do not specify
-- the port in the @XksProxyUriEndpoint@ value.
--
-- For external key stores with @XksProxyConnectivity@ value of
-- @VPC_ENDPOINT_SERVICE@, specify @https:\/\/@ followed by the private DNS
-- name of the VPC endpoint service.
--
-- For external key stores with @PUBLIC_ENDPOINT@ connectivity, this
-- endpoint must be reachable before you create the custom key store. KMS
-- connects to the external key store proxy while creating the custom key
-- store. For external key stores with @VPC_ENDPOINT_SERVICE@ connectivity,
-- KMS connects when you call the ConnectCustomKeyStore operation.
--
-- The value of this parameter must begin with @https:\/\/@. The remainder
-- can contain upper and lower case letters (A-Z and a-z), numbers (0-9),
-- dots (@.@), and hyphens (@-@). Additional slashes (@\/@ and @\\@) are
-- not permitted.
--
-- __Uniqueness requirements:__
--
-- -   The combined @XksProxyUriEndpoint@ and @XksProxyUriPath@ values must
--     be unique in the Amazon Web Services account and Region.
--
-- -   An external key store with @PUBLIC_ENDPOINT@ connectivity cannot use
--     the same @XksProxyUriEndpoint@ value as an external key store with
--     @VPC_ENDPOINT_SERVICE@ connectivity in the same Amazon Web Services
--     Region.
--
-- -   Each external key store with @VPC_ENDPOINT_SERVICE@ connectivity
--     must have its own private DNS name. The @XksProxyUriEndpoint@ value
--     for external key stores with @VPC_ENDPOINT_SERVICE@ connectivity
--     (private DNS name) must be unique in the Amazon Web Services account
--     and Region.
createCustomKeyStore_xksProxyUriEndpoint :: Lens.Lens' CreateCustomKeyStore (Prelude.Maybe Prelude.Text)
createCustomKeyStore_xksProxyUriEndpoint :: Lens' CreateCustomKeyStore (Maybe Text)
createCustomKeyStore_xksProxyUriEndpoint = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomKeyStore' {Maybe Text
xksProxyUriEndpoint :: Maybe Text
$sel:xksProxyUriEndpoint:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe Text
xksProxyUriEndpoint} -> Maybe Text
xksProxyUriEndpoint) (\s :: CreateCustomKeyStore
s@CreateCustomKeyStore' {} Maybe Text
a -> CreateCustomKeyStore
s {$sel:xksProxyUriEndpoint:CreateCustomKeyStore' :: Maybe Text
xksProxyUriEndpoint = Maybe Text
a} :: CreateCustomKeyStore)

-- | Specifies the base path to the proxy APIs for this external key store.
-- To find this value, see the documentation for your external key store
-- proxy. This parameter is required for all custom key stores with a
-- @CustomKeyStoreType@ of @EXTERNAL_KEY_STORE@.
--
-- The value must start with @\/@ and must end with @\/kms\/xks\/v1@ where
-- @v1@ represents the version of the KMS external key store proxy API.
-- This path can include an optional prefix between the required elements
-- such as @\/@/@prefix@/@\/kms\/xks\/v1@.
--
-- __Uniqueness requirements:__
--
-- -   The combined @XksProxyUriEndpoint@ and @XksProxyUriPath@ values must
--     be unique in the Amazon Web Services account and Region.
createCustomKeyStore_xksProxyUriPath :: Lens.Lens' CreateCustomKeyStore (Prelude.Maybe Prelude.Text)
createCustomKeyStore_xksProxyUriPath :: Lens' CreateCustomKeyStore (Maybe Text)
createCustomKeyStore_xksProxyUriPath = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomKeyStore' {Maybe Text
xksProxyUriPath :: Maybe Text
$sel:xksProxyUriPath:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe Text
xksProxyUriPath} -> Maybe Text
xksProxyUriPath) (\s :: CreateCustomKeyStore
s@CreateCustomKeyStore' {} Maybe Text
a -> CreateCustomKeyStore
s {$sel:xksProxyUriPath:CreateCustomKeyStore' :: Maybe Text
xksProxyUriPath = Maybe Text
a} :: CreateCustomKeyStore)

-- | Specifies the name of the Amazon VPC endpoint service for interface
-- endpoints that is used to communicate with your external key store proxy
-- (XKS proxy). This parameter is required when the value of
-- @CustomKeyStoreType@ is @EXTERNAL_KEY_STORE@ and the value of
-- @XksProxyConnectivity@ is @VPC_ENDPOINT_SERVICE@.
--
-- The Amazon VPC endpoint service must
-- <https://docs.aws.amazon.com/kms/latest/developerguide/create-xks-keystore.html#xks-requirements fulfill all requirements>
-- for use with an external key store.
--
-- __Uniqueness requirements:__
--
-- -   External key stores with @VPC_ENDPOINT_SERVICE@ connectivity can
--     share an Amazon VPC, but each external key store must have its own
--     VPC endpoint service and private DNS name.
createCustomKeyStore_xksProxyVpcEndpointServiceName :: Lens.Lens' CreateCustomKeyStore (Prelude.Maybe Prelude.Text)
createCustomKeyStore_xksProxyVpcEndpointServiceName :: Lens' CreateCustomKeyStore (Maybe Text)
createCustomKeyStore_xksProxyVpcEndpointServiceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomKeyStore' {Maybe Text
xksProxyVpcEndpointServiceName :: Maybe Text
$sel:xksProxyVpcEndpointServiceName:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe Text
xksProxyVpcEndpointServiceName} -> Maybe Text
xksProxyVpcEndpointServiceName) (\s :: CreateCustomKeyStore
s@CreateCustomKeyStore' {} Maybe Text
a -> CreateCustomKeyStore
s {$sel:xksProxyVpcEndpointServiceName:CreateCustomKeyStore' :: Maybe Text
xksProxyVpcEndpointServiceName = Maybe Text
a} :: CreateCustomKeyStore)

-- | Specifies a friendly name for the custom key store. The name must be
-- unique in your Amazon Web Services account and Region. This parameter is
-- required for all custom key stores.
createCustomKeyStore_customKeyStoreName :: Lens.Lens' CreateCustomKeyStore Prelude.Text
createCustomKeyStore_customKeyStoreName :: Lens' CreateCustomKeyStore Text
createCustomKeyStore_customKeyStoreName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomKeyStore' {Text
customKeyStoreName :: Text
$sel:customKeyStoreName:CreateCustomKeyStore' :: CreateCustomKeyStore -> Text
customKeyStoreName} -> Text
customKeyStoreName) (\s :: CreateCustomKeyStore
s@CreateCustomKeyStore' {} Text
a -> CreateCustomKeyStore
s {$sel:customKeyStoreName:CreateCustomKeyStore' :: Text
customKeyStoreName = Text
a} :: CreateCustomKeyStore)

instance Core.AWSRequest CreateCustomKeyStore where
  type
    AWSResponse CreateCustomKeyStore =
      CreateCustomKeyStoreResponse
  request :: (Service -> Service)
-> CreateCustomKeyStore -> Request CreateCustomKeyStore
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 CreateCustomKeyStore
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateCustomKeyStore)))
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 Text -> Int -> CreateCustomKeyStoreResponse
CreateCustomKeyStoreResponse'
            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
"CustomKeyStoreId")
            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 CreateCustomKeyStore where
  hashWithSalt :: Int -> CreateCustomKeyStore -> Int
hashWithSalt Int
_salt CreateCustomKeyStore' {Maybe Text
Maybe (Sensitive Text)
Maybe CustomKeyStoreType
Maybe XksProxyAuthenticationCredentialType
Maybe XksProxyConnectivityType
Text
customKeyStoreName :: Text
xksProxyVpcEndpointServiceName :: Maybe Text
xksProxyUriPath :: Maybe Text
xksProxyUriEndpoint :: Maybe Text
xksProxyConnectivity :: Maybe XksProxyConnectivityType
xksProxyAuthenticationCredential :: Maybe XksProxyAuthenticationCredentialType
trustAnchorCertificate :: Maybe Text
keyStorePassword :: Maybe (Sensitive Text)
customKeyStoreType :: Maybe CustomKeyStoreType
cloudHsmClusterId :: Maybe Text
$sel:customKeyStoreName:CreateCustomKeyStore' :: CreateCustomKeyStore -> Text
$sel:xksProxyVpcEndpointServiceName:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe Text
$sel:xksProxyUriPath:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe Text
$sel:xksProxyUriEndpoint:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe Text
$sel:xksProxyConnectivity:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe XksProxyConnectivityType
$sel:xksProxyAuthenticationCredential:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe XksProxyAuthenticationCredentialType
$sel:trustAnchorCertificate:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe Text
$sel:keyStorePassword:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe (Sensitive Text)
$sel:customKeyStoreType:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe CustomKeyStoreType
$sel:cloudHsmClusterId:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
cloudHsmClusterId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CustomKeyStoreType
customKeyStoreType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
keyStorePassword
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
trustAnchorCertificate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe XksProxyAuthenticationCredentialType
xksProxyAuthenticationCredential
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe XksProxyConnectivityType
xksProxyConnectivity
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
xksProxyUriEndpoint
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
xksProxyUriPath
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
xksProxyVpcEndpointServiceName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
customKeyStoreName

instance Prelude.NFData CreateCustomKeyStore where
  rnf :: CreateCustomKeyStore -> ()
rnf CreateCustomKeyStore' {Maybe Text
Maybe (Sensitive Text)
Maybe CustomKeyStoreType
Maybe XksProxyAuthenticationCredentialType
Maybe XksProxyConnectivityType
Text
customKeyStoreName :: Text
xksProxyVpcEndpointServiceName :: Maybe Text
xksProxyUriPath :: Maybe Text
xksProxyUriEndpoint :: Maybe Text
xksProxyConnectivity :: Maybe XksProxyConnectivityType
xksProxyAuthenticationCredential :: Maybe XksProxyAuthenticationCredentialType
trustAnchorCertificate :: Maybe Text
keyStorePassword :: Maybe (Sensitive Text)
customKeyStoreType :: Maybe CustomKeyStoreType
cloudHsmClusterId :: Maybe Text
$sel:customKeyStoreName:CreateCustomKeyStore' :: CreateCustomKeyStore -> Text
$sel:xksProxyVpcEndpointServiceName:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe Text
$sel:xksProxyUriPath:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe Text
$sel:xksProxyUriEndpoint:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe Text
$sel:xksProxyConnectivity:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe XksProxyConnectivityType
$sel:xksProxyAuthenticationCredential:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe XksProxyAuthenticationCredentialType
$sel:trustAnchorCertificate:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe Text
$sel:keyStorePassword:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe (Sensitive Text)
$sel:customKeyStoreType:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe CustomKeyStoreType
$sel:cloudHsmClusterId:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
cloudHsmClusterId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CustomKeyStoreType
customKeyStoreType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
keyStorePassword
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
trustAnchorCertificate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe XksProxyAuthenticationCredentialType
xksProxyAuthenticationCredential
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe XksProxyConnectivityType
xksProxyConnectivity
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
xksProxyUriEndpoint
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
xksProxyUriPath
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
xksProxyVpcEndpointServiceName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
customKeyStoreName

instance Data.ToHeaders CreateCustomKeyStore where
  toHeaders :: CreateCustomKeyStore -> 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
"TrentService.CreateCustomKeyStore" ::
                          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 CreateCustomKeyStore where
  toJSON :: CreateCustomKeyStore -> Value
toJSON CreateCustomKeyStore' {Maybe Text
Maybe (Sensitive Text)
Maybe CustomKeyStoreType
Maybe XksProxyAuthenticationCredentialType
Maybe XksProxyConnectivityType
Text
customKeyStoreName :: Text
xksProxyVpcEndpointServiceName :: Maybe Text
xksProxyUriPath :: Maybe Text
xksProxyUriEndpoint :: Maybe Text
xksProxyConnectivity :: Maybe XksProxyConnectivityType
xksProxyAuthenticationCredential :: Maybe XksProxyAuthenticationCredentialType
trustAnchorCertificate :: Maybe Text
keyStorePassword :: Maybe (Sensitive Text)
customKeyStoreType :: Maybe CustomKeyStoreType
cloudHsmClusterId :: Maybe Text
$sel:customKeyStoreName:CreateCustomKeyStore' :: CreateCustomKeyStore -> Text
$sel:xksProxyVpcEndpointServiceName:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe Text
$sel:xksProxyUriPath:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe Text
$sel:xksProxyUriEndpoint:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe Text
$sel:xksProxyConnectivity:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe XksProxyConnectivityType
$sel:xksProxyAuthenticationCredential:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe XksProxyAuthenticationCredentialType
$sel:trustAnchorCertificate:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe Text
$sel:keyStorePassword:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe (Sensitive Text)
$sel:customKeyStoreType:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe CustomKeyStoreType
$sel:cloudHsmClusterId:CreateCustomKeyStore' :: CreateCustomKeyStore -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"CloudHsmClusterId" 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
cloudHsmClusterId,
            (Key
"CustomKeyStoreType" 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 CustomKeyStoreType
customKeyStoreType,
            (Key
"KeyStorePassword" 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)
keyStorePassword,
            (Key
"TrustAnchorCertificate" 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
trustAnchorCertificate,
            (Key
"XksProxyAuthenticationCredential" 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 XksProxyAuthenticationCredentialType
xksProxyAuthenticationCredential,
            (Key
"XksProxyConnectivity" 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 XksProxyConnectivityType
xksProxyConnectivity,
            (Key
"XksProxyUriEndpoint" 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
xksProxyUriEndpoint,
            (Key
"XksProxyUriPath" 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
xksProxyUriPath,
            (Key
"XksProxyVpcEndpointServiceName" 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
xksProxyVpcEndpointServiceName,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"CustomKeyStoreName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
customKeyStoreName)
          ]
      )

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

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

-- | /See:/ 'newCreateCustomKeyStoreResponse' smart constructor.
data CreateCustomKeyStoreResponse = CreateCustomKeyStoreResponse'
  { -- | A unique identifier for the new custom key store.
    CreateCustomKeyStoreResponse -> Maybe Text
customKeyStoreId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateCustomKeyStoreResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateCustomKeyStoreResponse
-> CreateCustomKeyStoreResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCustomKeyStoreResponse
-> CreateCustomKeyStoreResponse -> Bool
$c/= :: CreateCustomKeyStoreResponse
-> CreateCustomKeyStoreResponse -> Bool
== :: CreateCustomKeyStoreResponse
-> CreateCustomKeyStoreResponse -> Bool
$c== :: CreateCustomKeyStoreResponse
-> CreateCustomKeyStoreResponse -> Bool
Prelude.Eq, ReadPrec [CreateCustomKeyStoreResponse]
ReadPrec CreateCustomKeyStoreResponse
Int -> ReadS CreateCustomKeyStoreResponse
ReadS [CreateCustomKeyStoreResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCustomKeyStoreResponse]
$creadListPrec :: ReadPrec [CreateCustomKeyStoreResponse]
readPrec :: ReadPrec CreateCustomKeyStoreResponse
$creadPrec :: ReadPrec CreateCustomKeyStoreResponse
readList :: ReadS [CreateCustomKeyStoreResponse]
$creadList :: ReadS [CreateCustomKeyStoreResponse]
readsPrec :: Int -> ReadS CreateCustomKeyStoreResponse
$creadsPrec :: Int -> ReadS CreateCustomKeyStoreResponse
Prelude.Read, Int -> CreateCustomKeyStoreResponse -> ShowS
[CreateCustomKeyStoreResponse] -> ShowS
CreateCustomKeyStoreResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCustomKeyStoreResponse] -> ShowS
$cshowList :: [CreateCustomKeyStoreResponse] -> ShowS
show :: CreateCustomKeyStoreResponse -> String
$cshow :: CreateCustomKeyStoreResponse -> String
showsPrec :: Int -> CreateCustomKeyStoreResponse -> ShowS
$cshowsPrec :: Int -> CreateCustomKeyStoreResponse -> ShowS
Prelude.Show, forall x.
Rep CreateCustomKeyStoreResponse x -> CreateCustomKeyStoreResponse
forall x.
CreateCustomKeyStoreResponse -> Rep CreateCustomKeyStoreResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateCustomKeyStoreResponse x -> CreateCustomKeyStoreResponse
$cfrom :: forall x.
CreateCustomKeyStoreResponse -> Rep CreateCustomKeyStoreResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateCustomKeyStoreResponse' 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:
--
-- 'customKeyStoreId', 'createCustomKeyStoreResponse_customKeyStoreId' - A unique identifier for the new custom key store.
--
-- 'httpStatus', 'createCustomKeyStoreResponse_httpStatus' - The response's http status code.
newCreateCustomKeyStoreResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateCustomKeyStoreResponse
newCreateCustomKeyStoreResponse :: Int -> CreateCustomKeyStoreResponse
newCreateCustomKeyStoreResponse Int
pHttpStatus_ =
  CreateCustomKeyStoreResponse'
    { $sel:customKeyStoreId:CreateCustomKeyStoreResponse' :: Maybe Text
customKeyStoreId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateCustomKeyStoreResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A unique identifier for the new custom key store.
createCustomKeyStoreResponse_customKeyStoreId :: Lens.Lens' CreateCustomKeyStoreResponse (Prelude.Maybe Prelude.Text)
createCustomKeyStoreResponse_customKeyStoreId :: Lens' CreateCustomKeyStoreResponse (Maybe Text)
createCustomKeyStoreResponse_customKeyStoreId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomKeyStoreResponse' {Maybe Text
customKeyStoreId :: Maybe Text
$sel:customKeyStoreId:CreateCustomKeyStoreResponse' :: CreateCustomKeyStoreResponse -> Maybe Text
customKeyStoreId} -> Maybe Text
customKeyStoreId) (\s :: CreateCustomKeyStoreResponse
s@CreateCustomKeyStoreResponse' {} Maybe Text
a -> CreateCustomKeyStoreResponse
s {$sel:customKeyStoreId:CreateCustomKeyStoreResponse' :: Maybe Text
customKeyStoreId = Maybe Text
a} :: CreateCustomKeyStoreResponse)

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

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