{-# 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 #-}
module Amazonka.KMS.CreateCustomKeyStore
(
CreateCustomKeyStore (..),
newCreateCustomKeyStore,
createCustomKeyStore_customKeyStoreName,
createCustomKeyStore_cloudHsmClusterId,
createCustomKeyStore_trustAnchorCertificate,
createCustomKeyStore_keyStorePassword,
CreateCustomKeyStoreResponse (..),
newCreateCustomKeyStoreResponse,
createCustomKeyStoreResponse_customKeyStoreId,
createCustomKeyStoreResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.KMS.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateCustomKeyStore = CreateCustomKeyStore'
{
CreateCustomKeyStore -> Text
customKeyStoreName :: Prelude.Text,
CreateCustomKeyStore -> Text
cloudHsmClusterId :: Prelude.Text,
CreateCustomKeyStore -> Text
trustAnchorCertificate :: Prelude.Text,
CreateCustomKeyStore -> Sensitive Text
keyStorePassword :: Core.Sensitive Prelude.Text
}
deriving (CreateCustomKeyStore -> CreateCustomKeyStore -> Bool
(CreateCustomKeyStore -> CreateCustomKeyStore -> Bool)
-> (CreateCustomKeyStore -> CreateCustomKeyStore -> Bool)
-> Eq CreateCustomKeyStore
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
(Int -> CreateCustomKeyStore -> ShowS)
-> (CreateCustomKeyStore -> String)
-> ([CreateCustomKeyStore] -> ShowS)
-> Show CreateCustomKeyStore
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. CreateCustomKeyStore -> Rep CreateCustomKeyStore x)
-> (forall x. Rep CreateCustomKeyStore x -> CreateCustomKeyStore)
-> Generic CreateCustomKeyStore
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)
newCreateCustomKeyStore ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
CreateCustomKeyStore
newCreateCustomKeyStore :: Text -> Text -> Text -> Text -> CreateCustomKeyStore
newCreateCustomKeyStore
Text
pCustomKeyStoreName_
Text
pCloudHsmClusterId_
Text
pTrustAnchorCertificate_
Text
pKeyStorePassword_ =
CreateCustomKeyStore' :: Text -> Text -> Text -> Sensitive Text -> CreateCustomKeyStore
CreateCustomKeyStore'
{ $sel:customKeyStoreName:CreateCustomKeyStore' :: Text
customKeyStoreName =
Text
pCustomKeyStoreName_,
$sel:cloudHsmClusterId:CreateCustomKeyStore' :: Text
cloudHsmClusterId = Text
pCloudHsmClusterId_,
$sel:trustAnchorCertificate:CreateCustomKeyStore' :: Text
trustAnchorCertificate = Text
pTrustAnchorCertificate_,
$sel:keyStorePassword:CreateCustomKeyStore' :: Sensitive Text
keyStorePassword =
Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pKeyStorePassword_
}
createCustomKeyStore_customKeyStoreName :: Lens.Lens' CreateCustomKeyStore Prelude.Text
createCustomKeyStore_customKeyStoreName :: (Text -> f Text) -> CreateCustomKeyStore -> f CreateCustomKeyStore
createCustomKeyStore_customKeyStoreName = (CreateCustomKeyStore -> Text)
-> (CreateCustomKeyStore -> Text -> CreateCustomKeyStore)
-> Lens CreateCustomKeyStore CreateCustomKeyStore Text Text
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)
createCustomKeyStore_cloudHsmClusterId :: Lens.Lens' CreateCustomKeyStore Prelude.Text
createCustomKeyStore_cloudHsmClusterId :: (Text -> f Text) -> CreateCustomKeyStore -> f CreateCustomKeyStore
createCustomKeyStore_cloudHsmClusterId = (CreateCustomKeyStore -> Text)
-> (CreateCustomKeyStore -> Text -> CreateCustomKeyStore)
-> Lens CreateCustomKeyStore CreateCustomKeyStore Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomKeyStore' {Text
cloudHsmClusterId :: Text
$sel:cloudHsmClusterId:CreateCustomKeyStore' :: CreateCustomKeyStore -> Text
cloudHsmClusterId} -> Text
cloudHsmClusterId) (\s :: CreateCustomKeyStore
s@CreateCustomKeyStore' {} Text
a -> CreateCustomKeyStore
s {$sel:cloudHsmClusterId:CreateCustomKeyStore' :: Text
cloudHsmClusterId = Text
a} :: CreateCustomKeyStore)
createCustomKeyStore_trustAnchorCertificate :: Lens.Lens' CreateCustomKeyStore Prelude.Text
createCustomKeyStore_trustAnchorCertificate :: (Text -> f Text) -> CreateCustomKeyStore -> f CreateCustomKeyStore
createCustomKeyStore_trustAnchorCertificate = (CreateCustomKeyStore -> Text)
-> (CreateCustomKeyStore -> Text -> CreateCustomKeyStore)
-> Lens CreateCustomKeyStore CreateCustomKeyStore Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomKeyStore' {Text
trustAnchorCertificate :: Text
$sel:trustAnchorCertificate:CreateCustomKeyStore' :: CreateCustomKeyStore -> Text
trustAnchorCertificate} -> Text
trustAnchorCertificate) (\s :: CreateCustomKeyStore
s@CreateCustomKeyStore' {} Text
a -> CreateCustomKeyStore
s {$sel:trustAnchorCertificate:CreateCustomKeyStore' :: Text
trustAnchorCertificate = Text
a} :: CreateCustomKeyStore)
createCustomKeyStore_keyStorePassword :: Lens.Lens' CreateCustomKeyStore Prelude.Text
createCustomKeyStore_keyStorePassword :: (Text -> f Text) -> CreateCustomKeyStore -> f CreateCustomKeyStore
createCustomKeyStore_keyStorePassword = (CreateCustomKeyStore -> Sensitive Text)
-> (CreateCustomKeyStore -> Sensitive Text -> CreateCustomKeyStore)
-> Lens
CreateCustomKeyStore
CreateCustomKeyStore
(Sensitive Text)
(Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomKeyStore' {Sensitive Text
keyStorePassword :: Sensitive Text
$sel:keyStorePassword:CreateCustomKeyStore' :: CreateCustomKeyStore -> Sensitive Text
keyStorePassword} -> Sensitive Text
keyStorePassword) (\s :: CreateCustomKeyStore
s@CreateCustomKeyStore' {} Sensitive Text
a -> CreateCustomKeyStore
s {$sel:keyStorePassword:CreateCustomKeyStore' :: Sensitive Text
keyStorePassword = Sensitive Text
a} :: CreateCustomKeyStore) ((Sensitive Text -> f (Sensitive Text))
-> CreateCustomKeyStore -> f CreateCustomKeyStore)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> CreateCustomKeyStore
-> f CreateCustomKeyStore
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive
instance Core.AWSRequest CreateCustomKeyStore where
type
AWSResponse CreateCustomKeyStore =
CreateCustomKeyStoreResponse
request :: CreateCustomKeyStore -> Request CreateCustomKeyStore
request = Service -> CreateCustomKeyStore -> Request CreateCustomKeyStore
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateCustomKeyStore
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateCustomKeyStore)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateCustomKeyStore))
-> Logger
-> Service
-> Proxy CreateCustomKeyStore
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateCustomKeyStore)))
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 -> CreateCustomKeyStoreResponse
CreateCustomKeyStoreResponse'
(Maybe Text -> Int -> CreateCustomKeyStoreResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateCustomKeyStoreResponse)
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
"CustomKeyStoreId")
Either String (Int -> CreateCustomKeyStoreResponse)
-> Either String Int -> Either String CreateCustomKeyStoreResponse
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 CreateCustomKeyStore
instance Prelude.NFData CreateCustomKeyStore
instance Core.ToHeaders CreateCustomKeyStore where
toHeaders :: CreateCustomKeyStore -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateCustomKeyStore -> 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
"TrentService.CreateCustomKeyStore" ::
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 CreateCustomKeyStore where
toJSON :: CreateCustomKeyStore -> Value
toJSON CreateCustomKeyStore' {Text
Sensitive Text
keyStorePassword :: Sensitive Text
trustAnchorCertificate :: Text
cloudHsmClusterId :: Text
customKeyStoreName :: Text
$sel:keyStorePassword:CreateCustomKeyStore' :: CreateCustomKeyStore -> Sensitive Text
$sel:trustAnchorCertificate:CreateCustomKeyStore' :: CreateCustomKeyStore -> Text
$sel:cloudHsmClusterId:CreateCustomKeyStore' :: CreateCustomKeyStore -> Text
$sel:customKeyStoreName:CreateCustomKeyStore' :: CreateCustomKeyStore -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"CustomKeyStoreName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
customKeyStoreName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"CloudHsmClusterId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
cloudHsmClusterId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"TrustAnchorCertificate"
Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
trustAnchorCertificate
),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"KeyStorePassword" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
keyStorePassword)
]
)
instance Core.ToPath CreateCustomKeyStore where
toPath :: CreateCustomKeyStore -> ByteString
toPath = ByteString -> CreateCustomKeyStore -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateCustomKeyStore where
toQuery :: CreateCustomKeyStore -> QueryString
toQuery = QueryString -> CreateCustomKeyStore -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateCustomKeyStoreResponse = CreateCustomKeyStoreResponse'
{
CreateCustomKeyStoreResponse -> Maybe Text
customKeyStoreId :: Prelude.Maybe Prelude.Text,
CreateCustomKeyStoreResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateCustomKeyStoreResponse
-> CreateCustomKeyStoreResponse -> Bool
(CreateCustomKeyStoreResponse
-> CreateCustomKeyStoreResponse -> Bool)
-> (CreateCustomKeyStoreResponse
-> CreateCustomKeyStoreResponse -> Bool)
-> Eq CreateCustomKeyStoreResponse
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]
(Int -> ReadS CreateCustomKeyStoreResponse)
-> ReadS [CreateCustomKeyStoreResponse]
-> ReadPrec CreateCustomKeyStoreResponse
-> ReadPrec [CreateCustomKeyStoreResponse]
-> Read 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
(Int -> CreateCustomKeyStoreResponse -> ShowS)
-> (CreateCustomKeyStoreResponse -> String)
-> ([CreateCustomKeyStoreResponse] -> ShowS)
-> Show CreateCustomKeyStoreResponse
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.
CreateCustomKeyStoreResponse -> Rep CreateCustomKeyStoreResponse x)
-> (forall x.
Rep CreateCustomKeyStoreResponse x -> CreateCustomKeyStoreResponse)
-> Generic CreateCustomKeyStoreResponse
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)
newCreateCustomKeyStoreResponse ::
Prelude.Int ->
CreateCustomKeyStoreResponse
newCreateCustomKeyStoreResponse :: Int -> CreateCustomKeyStoreResponse
newCreateCustomKeyStoreResponse Int
pHttpStatus_ =
CreateCustomKeyStoreResponse' :: Maybe Text -> Int -> CreateCustomKeyStoreResponse
CreateCustomKeyStoreResponse'
{ $sel:customKeyStoreId:CreateCustomKeyStoreResponse' :: Maybe Text
customKeyStoreId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateCustomKeyStoreResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createCustomKeyStoreResponse_customKeyStoreId :: Lens.Lens' CreateCustomKeyStoreResponse (Prelude.Maybe Prelude.Text)
createCustomKeyStoreResponse_customKeyStoreId :: (Maybe Text -> f (Maybe Text))
-> CreateCustomKeyStoreResponse -> f CreateCustomKeyStoreResponse
createCustomKeyStoreResponse_customKeyStoreId = (CreateCustomKeyStoreResponse -> Maybe Text)
-> (CreateCustomKeyStoreResponse
-> Maybe Text -> CreateCustomKeyStoreResponse)
-> Lens
CreateCustomKeyStoreResponse
CreateCustomKeyStoreResponse
(Maybe Text)
(Maybe Text)
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)
createCustomKeyStoreResponse_httpStatus :: Lens.Lens' CreateCustomKeyStoreResponse Prelude.Int
createCustomKeyStoreResponse_httpStatus :: (Int -> f Int)
-> CreateCustomKeyStoreResponse -> f CreateCustomKeyStoreResponse
createCustomKeyStoreResponse_httpStatus = (CreateCustomKeyStoreResponse -> Int)
-> (CreateCustomKeyStoreResponse
-> Int -> CreateCustomKeyStoreResponse)
-> Lens
CreateCustomKeyStoreResponse CreateCustomKeyStoreResponse Int Int
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