{-# 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.CloudHSM.CreateHsm
-- 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)
--
-- This is documentation for __AWS CloudHSM Classic__. For more
-- information, see
-- <http://aws.amazon.com/cloudhsm/faqs-classic/ AWS CloudHSM Classic FAQs>,
-- the
-- <https://docs.aws.amazon.com/cloudhsm/classic/userguide/ AWS CloudHSM Classic User Guide>,
-- and the
-- <https://docs.aws.amazon.com/cloudhsm/classic/APIReference/ AWS CloudHSM Classic API Reference>.
--
-- __For information about the current version of AWS CloudHSM__, see
-- <http://aws.amazon.com/cloudhsm/ AWS CloudHSM>, the
-- <https://docs.aws.amazon.com/cloudhsm/latest/userguide/ AWS CloudHSM User Guide>,
-- and the
-- <https://docs.aws.amazon.com/cloudhsm/latest/APIReference/ AWS CloudHSM API Reference>.
--
-- Creates an uninitialized HSM instance.
--
-- There is an upfront fee charged for each HSM instance that you create
-- with the @CreateHsm@ operation. If you accidentally provision an HSM and
-- want to request a refund, delete the instance using the DeleteHsm
-- operation, go to the
-- <https://console.aws.amazon.com/support/home AWS Support Center>, create
-- a new case, and select __Account and Billing Support__.
--
-- It can take up to 20 minutes to create and provision an HSM. You can
-- monitor the status of the HSM with the DescribeHsm operation. The HSM is
-- ready to be initialized when the status changes to @RUNNING@.
module Amazonka.CloudHSM.CreateHsm
  ( -- * Creating a Request
    CreateHsm (..),
    newCreateHsm,

    -- * Request Lenses
    createHsm_clientToken,
    createHsm_syslogIp,
    createHsm_externalId,
    createHsm_eniIp,
    createHsm_subnetId,
    createHsm_sshKey,
    createHsm_iamRoleArn,
    createHsm_subscriptionType,

    -- * Destructuring the Response
    CreateHsmResponse (..),
    newCreateHsmResponse,

    -- * Response Lenses
    createHsmResponse_hsmArn,
    createHsmResponse_httpStatus,
  )
where

import Amazonka.CloudHSM.Types
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

-- | Contains the inputs for the @CreateHsm@ operation.
--
-- /See:/ 'newCreateHsm' smart constructor.
data CreateHsm = CreateHsm'
  { -- | A user-defined token to ensure idempotence. Subsequent calls to this
    -- operation with the same token will be ignored.
    CreateHsm -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | The IP address for the syslog monitoring server. The AWS CloudHSM
    -- service only supports one syslog monitoring server.
    CreateHsm -> Maybe Text
syslogIp :: Prelude.Maybe Prelude.Text,
    -- | The external ID from @IamRoleArn@, if present.
    CreateHsm -> Maybe Text
externalId :: Prelude.Maybe Prelude.Text,
    -- | The IP address to assign to the HSM\'s ENI.
    --
    -- If an IP address is not specified, an IP address will be randomly chosen
    -- from the CIDR range of the subnet.
    CreateHsm -> Maybe Text
eniIp :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the subnet in your VPC in which to place the HSM.
    CreateHsm -> Text
subnetId :: Prelude.Text,
    -- | The SSH public key to install on the HSM.
    CreateHsm -> Text
sshKey :: Prelude.Text,
    -- | The ARN of an IAM role to enable the AWS CloudHSM service to allocate an
    -- ENI on your behalf.
    CreateHsm -> Text
iamRoleArn :: Prelude.Text,
    CreateHsm -> SubscriptionType
subscriptionType :: SubscriptionType
  }
  deriving (CreateHsm -> CreateHsm -> Bool
(CreateHsm -> CreateHsm -> Bool)
-> (CreateHsm -> CreateHsm -> Bool) -> Eq CreateHsm
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateHsm -> CreateHsm -> Bool
$c/= :: CreateHsm -> CreateHsm -> Bool
== :: CreateHsm -> CreateHsm -> Bool
$c== :: CreateHsm -> CreateHsm -> Bool
Prelude.Eq, ReadPrec [CreateHsm]
ReadPrec CreateHsm
Int -> ReadS CreateHsm
ReadS [CreateHsm]
(Int -> ReadS CreateHsm)
-> ReadS [CreateHsm]
-> ReadPrec CreateHsm
-> ReadPrec [CreateHsm]
-> Read CreateHsm
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateHsm]
$creadListPrec :: ReadPrec [CreateHsm]
readPrec :: ReadPrec CreateHsm
$creadPrec :: ReadPrec CreateHsm
readList :: ReadS [CreateHsm]
$creadList :: ReadS [CreateHsm]
readsPrec :: Int -> ReadS CreateHsm
$creadsPrec :: Int -> ReadS CreateHsm
Prelude.Read, Int -> CreateHsm -> ShowS
[CreateHsm] -> ShowS
CreateHsm -> String
(Int -> CreateHsm -> ShowS)
-> (CreateHsm -> String)
-> ([CreateHsm] -> ShowS)
-> Show CreateHsm
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateHsm] -> ShowS
$cshowList :: [CreateHsm] -> ShowS
show :: CreateHsm -> String
$cshow :: CreateHsm -> String
showsPrec :: Int -> CreateHsm -> ShowS
$cshowsPrec :: Int -> CreateHsm -> ShowS
Prelude.Show, (forall x. CreateHsm -> Rep CreateHsm x)
-> (forall x. Rep CreateHsm x -> CreateHsm) -> Generic CreateHsm
forall x. Rep CreateHsm x -> CreateHsm
forall x. CreateHsm -> Rep CreateHsm x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateHsm x -> CreateHsm
$cfrom :: forall x. CreateHsm -> Rep CreateHsm x
Prelude.Generic)

-- |
-- Create a value of 'CreateHsm' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'clientToken', 'createHsm_clientToken' - A user-defined token to ensure idempotence. Subsequent calls to this
-- operation with the same token will be ignored.
--
-- 'syslogIp', 'createHsm_syslogIp' - The IP address for the syslog monitoring server. The AWS CloudHSM
-- service only supports one syslog monitoring server.
--
-- 'externalId', 'createHsm_externalId' - The external ID from @IamRoleArn@, if present.
--
-- 'eniIp', 'createHsm_eniIp' - The IP address to assign to the HSM\'s ENI.
--
-- If an IP address is not specified, an IP address will be randomly chosen
-- from the CIDR range of the subnet.
--
-- 'subnetId', 'createHsm_subnetId' - The identifier of the subnet in your VPC in which to place the HSM.
--
-- 'sshKey', 'createHsm_sshKey' - The SSH public key to install on the HSM.
--
-- 'iamRoleArn', 'createHsm_iamRoleArn' - The ARN of an IAM role to enable the AWS CloudHSM service to allocate an
-- ENI on your behalf.
--
-- 'subscriptionType', 'createHsm_subscriptionType' - Undocumented member.
newCreateHsm ::
  -- | 'subnetId'
  Prelude.Text ->
  -- | 'sshKey'
  Prelude.Text ->
  -- | 'iamRoleArn'
  Prelude.Text ->
  -- | 'subscriptionType'
  SubscriptionType ->
  CreateHsm
newCreateHsm :: Text -> Text -> Text -> SubscriptionType -> CreateHsm
newCreateHsm
  Text
pSubnetId_
  Text
pSshKey_
  Text
pIamRoleArn_
  SubscriptionType
pSubscriptionType_ =
    CreateHsm' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> Text
-> SubscriptionType
-> CreateHsm
CreateHsm'
      { $sel:clientToken:CreateHsm' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:syslogIp:CreateHsm' :: Maybe Text
syslogIp = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:externalId:CreateHsm' :: Maybe Text
externalId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:eniIp:CreateHsm' :: Maybe Text
eniIp = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:subnetId:CreateHsm' :: Text
subnetId = Text
pSubnetId_,
        $sel:sshKey:CreateHsm' :: Text
sshKey = Text
pSshKey_,
        $sel:iamRoleArn:CreateHsm' :: Text
iamRoleArn = Text
pIamRoleArn_,
        $sel:subscriptionType:CreateHsm' :: SubscriptionType
subscriptionType = SubscriptionType
pSubscriptionType_
      }

-- | A user-defined token to ensure idempotence. Subsequent calls to this
-- operation with the same token will be ignored.
createHsm_clientToken :: Lens.Lens' CreateHsm (Prelude.Maybe Prelude.Text)
createHsm_clientToken :: (Maybe Text -> f (Maybe Text)) -> CreateHsm -> f CreateHsm
createHsm_clientToken = (CreateHsm -> Maybe Text)
-> (CreateHsm -> Maybe Text -> CreateHsm)
-> Lens CreateHsm CreateHsm (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHsm' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateHsm' :: CreateHsm -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateHsm
s@CreateHsm' {} Maybe Text
a -> CreateHsm
s {$sel:clientToken:CreateHsm' :: Maybe Text
clientToken = Maybe Text
a} :: CreateHsm)

-- | The IP address for the syslog monitoring server. The AWS CloudHSM
-- service only supports one syslog monitoring server.
createHsm_syslogIp :: Lens.Lens' CreateHsm (Prelude.Maybe Prelude.Text)
createHsm_syslogIp :: (Maybe Text -> f (Maybe Text)) -> CreateHsm -> f CreateHsm
createHsm_syslogIp = (CreateHsm -> Maybe Text)
-> (CreateHsm -> Maybe Text -> CreateHsm)
-> Lens CreateHsm CreateHsm (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHsm' {Maybe Text
syslogIp :: Maybe Text
$sel:syslogIp:CreateHsm' :: CreateHsm -> Maybe Text
syslogIp} -> Maybe Text
syslogIp) (\s :: CreateHsm
s@CreateHsm' {} Maybe Text
a -> CreateHsm
s {$sel:syslogIp:CreateHsm' :: Maybe Text
syslogIp = Maybe Text
a} :: CreateHsm)

-- | The external ID from @IamRoleArn@, if present.
createHsm_externalId :: Lens.Lens' CreateHsm (Prelude.Maybe Prelude.Text)
createHsm_externalId :: (Maybe Text -> f (Maybe Text)) -> CreateHsm -> f CreateHsm
createHsm_externalId = (CreateHsm -> Maybe Text)
-> (CreateHsm -> Maybe Text -> CreateHsm)
-> Lens CreateHsm CreateHsm (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHsm' {Maybe Text
externalId :: Maybe Text
$sel:externalId:CreateHsm' :: CreateHsm -> Maybe Text
externalId} -> Maybe Text
externalId) (\s :: CreateHsm
s@CreateHsm' {} Maybe Text
a -> CreateHsm
s {$sel:externalId:CreateHsm' :: Maybe Text
externalId = Maybe Text
a} :: CreateHsm)

-- | The IP address to assign to the HSM\'s ENI.
--
-- If an IP address is not specified, an IP address will be randomly chosen
-- from the CIDR range of the subnet.
createHsm_eniIp :: Lens.Lens' CreateHsm (Prelude.Maybe Prelude.Text)
createHsm_eniIp :: (Maybe Text -> f (Maybe Text)) -> CreateHsm -> f CreateHsm
createHsm_eniIp = (CreateHsm -> Maybe Text)
-> (CreateHsm -> Maybe Text -> CreateHsm)
-> Lens CreateHsm CreateHsm (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHsm' {Maybe Text
eniIp :: Maybe Text
$sel:eniIp:CreateHsm' :: CreateHsm -> Maybe Text
eniIp} -> Maybe Text
eniIp) (\s :: CreateHsm
s@CreateHsm' {} Maybe Text
a -> CreateHsm
s {$sel:eniIp:CreateHsm' :: Maybe Text
eniIp = Maybe Text
a} :: CreateHsm)

-- | The identifier of the subnet in your VPC in which to place the HSM.
createHsm_subnetId :: Lens.Lens' CreateHsm Prelude.Text
createHsm_subnetId :: (Text -> f Text) -> CreateHsm -> f CreateHsm
createHsm_subnetId = (CreateHsm -> Text)
-> (CreateHsm -> Text -> CreateHsm)
-> Lens CreateHsm CreateHsm Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHsm' {Text
subnetId :: Text
$sel:subnetId:CreateHsm' :: CreateHsm -> Text
subnetId} -> Text
subnetId) (\s :: CreateHsm
s@CreateHsm' {} Text
a -> CreateHsm
s {$sel:subnetId:CreateHsm' :: Text
subnetId = Text
a} :: CreateHsm)

-- | The SSH public key to install on the HSM.
createHsm_sshKey :: Lens.Lens' CreateHsm Prelude.Text
createHsm_sshKey :: (Text -> f Text) -> CreateHsm -> f CreateHsm
createHsm_sshKey = (CreateHsm -> Text)
-> (CreateHsm -> Text -> CreateHsm)
-> Lens CreateHsm CreateHsm Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHsm' {Text
sshKey :: Text
$sel:sshKey:CreateHsm' :: CreateHsm -> Text
sshKey} -> Text
sshKey) (\s :: CreateHsm
s@CreateHsm' {} Text
a -> CreateHsm
s {$sel:sshKey:CreateHsm' :: Text
sshKey = Text
a} :: CreateHsm)

-- | The ARN of an IAM role to enable the AWS CloudHSM service to allocate an
-- ENI on your behalf.
createHsm_iamRoleArn :: Lens.Lens' CreateHsm Prelude.Text
createHsm_iamRoleArn :: (Text -> f Text) -> CreateHsm -> f CreateHsm
createHsm_iamRoleArn = (CreateHsm -> Text)
-> (CreateHsm -> Text -> CreateHsm)
-> Lens CreateHsm CreateHsm Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHsm' {Text
iamRoleArn :: Text
$sel:iamRoleArn:CreateHsm' :: CreateHsm -> Text
iamRoleArn} -> Text
iamRoleArn) (\s :: CreateHsm
s@CreateHsm' {} Text
a -> CreateHsm
s {$sel:iamRoleArn:CreateHsm' :: Text
iamRoleArn = Text
a} :: CreateHsm)

-- | Undocumented member.
createHsm_subscriptionType :: Lens.Lens' CreateHsm SubscriptionType
createHsm_subscriptionType :: (SubscriptionType -> f SubscriptionType)
-> CreateHsm -> f CreateHsm
createHsm_subscriptionType = (CreateHsm -> SubscriptionType)
-> (CreateHsm -> SubscriptionType -> CreateHsm)
-> Lens CreateHsm CreateHsm SubscriptionType SubscriptionType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHsm' {SubscriptionType
subscriptionType :: SubscriptionType
$sel:subscriptionType:CreateHsm' :: CreateHsm -> SubscriptionType
subscriptionType} -> SubscriptionType
subscriptionType) (\s :: CreateHsm
s@CreateHsm' {} SubscriptionType
a -> CreateHsm
s {$sel:subscriptionType:CreateHsm' :: SubscriptionType
subscriptionType = SubscriptionType
a} :: CreateHsm)

instance Core.AWSRequest CreateHsm where
  type AWSResponse CreateHsm = CreateHsmResponse
  request :: CreateHsm -> Request CreateHsm
request = Service -> CreateHsm -> Request CreateHsm
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateHsm
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateHsm)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateHsm))
-> Logger
-> Service
-> Proxy CreateHsm
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateHsm)))
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 ->
          Maybe Text -> Int -> CreateHsmResponse
CreateHsmResponse'
            (Maybe Text -> Int -> CreateHsmResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateHsmResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"HsmArn")
            Either String (Int -> CreateHsmResponse)
-> Either String Int -> Either String CreateHsmResponse
forall (f :: * -> *) a b. Applicative f => 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))
      )

instance Prelude.Hashable CreateHsm

instance Prelude.NFData CreateHsm

instance Core.ToHeaders CreateHsm where
  toHeaders :: CreateHsm -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateHsm -> 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
"CloudHsmFrontendService.CreateHsm" ::
                          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 CreateHsm where
  toJSON :: CreateHsm -> Value
toJSON CreateHsm' {Maybe Text
Text
SubscriptionType
subscriptionType :: SubscriptionType
iamRoleArn :: Text
sshKey :: Text
subnetId :: Text
eniIp :: Maybe Text
externalId :: Maybe Text
syslogIp :: Maybe Text
clientToken :: Maybe Text
$sel:subscriptionType:CreateHsm' :: CreateHsm -> SubscriptionType
$sel:iamRoleArn:CreateHsm' :: CreateHsm -> Text
$sel:sshKey:CreateHsm' :: CreateHsm -> Text
$sel:subnetId:CreateHsm' :: CreateHsm -> Text
$sel:eniIp:CreateHsm' :: CreateHsm -> Maybe Text
$sel:externalId:CreateHsm' :: CreateHsm -> Maybe Text
$sel:syslogIp:CreateHsm' :: CreateHsm -> Maybe Text
$sel:clientToken:CreateHsm' :: CreateHsm -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ClientToken" 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
clientToken,
            (Text
"SyslogIp" 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
syslogIp,
            (Text
"ExternalId" 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
externalId,
            (Text
"EniIp" 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
eniIp,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"SubnetId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
subnetId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"SshKey" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
sshKey),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"IamRoleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
iamRoleArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"SubscriptionType" Text -> SubscriptionType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= SubscriptionType
subscriptionType)
          ]
      )

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

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

-- | Contains the output of the @CreateHsm@ operation.
--
-- /See:/ 'newCreateHsmResponse' smart constructor.
data CreateHsmResponse = CreateHsmResponse'
  { -- | The ARN of the HSM.
    CreateHsmResponse -> Maybe Text
hsmArn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateHsmResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateHsmResponse -> CreateHsmResponse -> Bool
(CreateHsmResponse -> CreateHsmResponse -> Bool)
-> (CreateHsmResponse -> CreateHsmResponse -> Bool)
-> Eq CreateHsmResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateHsmResponse -> CreateHsmResponse -> Bool
$c/= :: CreateHsmResponse -> CreateHsmResponse -> Bool
== :: CreateHsmResponse -> CreateHsmResponse -> Bool
$c== :: CreateHsmResponse -> CreateHsmResponse -> Bool
Prelude.Eq, ReadPrec [CreateHsmResponse]
ReadPrec CreateHsmResponse
Int -> ReadS CreateHsmResponse
ReadS [CreateHsmResponse]
(Int -> ReadS CreateHsmResponse)
-> ReadS [CreateHsmResponse]
-> ReadPrec CreateHsmResponse
-> ReadPrec [CreateHsmResponse]
-> Read CreateHsmResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateHsmResponse]
$creadListPrec :: ReadPrec [CreateHsmResponse]
readPrec :: ReadPrec CreateHsmResponse
$creadPrec :: ReadPrec CreateHsmResponse
readList :: ReadS [CreateHsmResponse]
$creadList :: ReadS [CreateHsmResponse]
readsPrec :: Int -> ReadS CreateHsmResponse
$creadsPrec :: Int -> ReadS CreateHsmResponse
Prelude.Read, Int -> CreateHsmResponse -> ShowS
[CreateHsmResponse] -> ShowS
CreateHsmResponse -> String
(Int -> CreateHsmResponse -> ShowS)
-> (CreateHsmResponse -> String)
-> ([CreateHsmResponse] -> ShowS)
-> Show CreateHsmResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateHsmResponse] -> ShowS
$cshowList :: [CreateHsmResponse] -> ShowS
show :: CreateHsmResponse -> String
$cshow :: CreateHsmResponse -> String
showsPrec :: Int -> CreateHsmResponse -> ShowS
$cshowsPrec :: Int -> CreateHsmResponse -> ShowS
Prelude.Show, (forall x. CreateHsmResponse -> Rep CreateHsmResponse x)
-> (forall x. Rep CreateHsmResponse x -> CreateHsmResponse)
-> Generic CreateHsmResponse
forall x. Rep CreateHsmResponse x -> CreateHsmResponse
forall x. CreateHsmResponse -> Rep CreateHsmResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateHsmResponse x -> CreateHsmResponse
$cfrom :: forall x. CreateHsmResponse -> Rep CreateHsmResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateHsmResponse' 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:
--
-- 'hsmArn', 'createHsmResponse_hsmArn' - The ARN of the HSM.
--
-- 'httpStatus', 'createHsmResponse_httpStatus' - The response's http status code.
newCreateHsmResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateHsmResponse
newCreateHsmResponse :: Int -> CreateHsmResponse
newCreateHsmResponse Int
pHttpStatus_ =
  CreateHsmResponse' :: Maybe Text -> Int -> CreateHsmResponse
CreateHsmResponse'
    { $sel:hsmArn:CreateHsmResponse' :: Maybe Text
hsmArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateHsmResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ARN of the HSM.
createHsmResponse_hsmArn :: Lens.Lens' CreateHsmResponse (Prelude.Maybe Prelude.Text)
createHsmResponse_hsmArn :: (Maybe Text -> f (Maybe Text))
-> CreateHsmResponse -> f CreateHsmResponse
createHsmResponse_hsmArn = (CreateHsmResponse -> Maybe Text)
-> (CreateHsmResponse -> Maybe Text -> CreateHsmResponse)
-> Lens
     CreateHsmResponse CreateHsmResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHsmResponse' {Maybe Text
hsmArn :: Maybe Text
$sel:hsmArn:CreateHsmResponse' :: CreateHsmResponse -> Maybe Text
hsmArn} -> Maybe Text
hsmArn) (\s :: CreateHsmResponse
s@CreateHsmResponse' {} Maybe Text
a -> CreateHsmResponse
s {$sel:hsmArn:CreateHsmResponse' :: Maybe Text
hsmArn = Maybe Text
a} :: CreateHsmResponse)

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

instance Prelude.NFData CreateHsmResponse