{-# 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.CloudHSM.CreateLunaClient
(
CreateLunaClient (..),
newCreateLunaClient,
createLunaClient_label,
createLunaClient_certificate,
CreateLunaClientResponse (..),
newCreateLunaClientResponse,
createLunaClientResponse_clientArn,
createLunaClientResponse_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
data CreateLunaClient = CreateLunaClient'
{
CreateLunaClient -> Maybe Text
label :: Prelude.Maybe Prelude.Text,
CreateLunaClient -> Text
certificate :: Prelude.Text
}
deriving (CreateLunaClient -> CreateLunaClient -> Bool
(CreateLunaClient -> CreateLunaClient -> Bool)
-> (CreateLunaClient -> CreateLunaClient -> Bool)
-> Eq CreateLunaClient
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLunaClient -> CreateLunaClient -> Bool
$c/= :: CreateLunaClient -> CreateLunaClient -> Bool
== :: CreateLunaClient -> CreateLunaClient -> Bool
$c== :: CreateLunaClient -> CreateLunaClient -> Bool
Prelude.Eq, ReadPrec [CreateLunaClient]
ReadPrec CreateLunaClient
Int -> ReadS CreateLunaClient
ReadS [CreateLunaClient]
(Int -> ReadS CreateLunaClient)
-> ReadS [CreateLunaClient]
-> ReadPrec CreateLunaClient
-> ReadPrec [CreateLunaClient]
-> Read CreateLunaClient
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateLunaClient]
$creadListPrec :: ReadPrec [CreateLunaClient]
readPrec :: ReadPrec CreateLunaClient
$creadPrec :: ReadPrec CreateLunaClient
readList :: ReadS [CreateLunaClient]
$creadList :: ReadS [CreateLunaClient]
readsPrec :: Int -> ReadS CreateLunaClient
$creadsPrec :: Int -> ReadS CreateLunaClient
Prelude.Read, Int -> CreateLunaClient -> ShowS
[CreateLunaClient] -> ShowS
CreateLunaClient -> String
(Int -> CreateLunaClient -> ShowS)
-> (CreateLunaClient -> String)
-> ([CreateLunaClient] -> ShowS)
-> Show CreateLunaClient
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLunaClient] -> ShowS
$cshowList :: [CreateLunaClient] -> ShowS
show :: CreateLunaClient -> String
$cshow :: CreateLunaClient -> String
showsPrec :: Int -> CreateLunaClient -> ShowS
$cshowsPrec :: Int -> CreateLunaClient -> ShowS
Prelude.Show, (forall x. CreateLunaClient -> Rep CreateLunaClient x)
-> (forall x. Rep CreateLunaClient x -> CreateLunaClient)
-> Generic CreateLunaClient
forall x. Rep CreateLunaClient x -> CreateLunaClient
forall x. CreateLunaClient -> Rep CreateLunaClient x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateLunaClient x -> CreateLunaClient
$cfrom :: forall x. CreateLunaClient -> Rep CreateLunaClient x
Prelude.Generic)
newCreateLunaClient ::
Prelude.Text ->
CreateLunaClient
newCreateLunaClient :: Text -> CreateLunaClient
newCreateLunaClient Text
pCertificate_ =
CreateLunaClient' :: Maybe Text -> Text -> CreateLunaClient
CreateLunaClient'
{ $sel:label:CreateLunaClient' :: Maybe Text
label = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:certificate:CreateLunaClient' :: Text
certificate = Text
pCertificate_
}
createLunaClient_label :: Lens.Lens' CreateLunaClient (Prelude.Maybe Prelude.Text)
createLunaClient_label :: (Maybe Text -> f (Maybe Text))
-> CreateLunaClient -> f CreateLunaClient
createLunaClient_label = (CreateLunaClient -> Maybe Text)
-> (CreateLunaClient -> Maybe Text -> CreateLunaClient)
-> Lens CreateLunaClient CreateLunaClient (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLunaClient' {Maybe Text
label :: Maybe Text
$sel:label:CreateLunaClient' :: CreateLunaClient -> Maybe Text
label} -> Maybe Text
label) (\s :: CreateLunaClient
s@CreateLunaClient' {} Maybe Text
a -> CreateLunaClient
s {$sel:label:CreateLunaClient' :: Maybe Text
label = Maybe Text
a} :: CreateLunaClient)
createLunaClient_certificate :: Lens.Lens' CreateLunaClient Prelude.Text
createLunaClient_certificate :: (Text -> f Text) -> CreateLunaClient -> f CreateLunaClient
createLunaClient_certificate = (CreateLunaClient -> Text)
-> (CreateLunaClient -> Text -> CreateLunaClient)
-> Lens CreateLunaClient CreateLunaClient Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLunaClient' {Text
certificate :: Text
$sel:certificate:CreateLunaClient' :: CreateLunaClient -> Text
certificate} -> Text
certificate) (\s :: CreateLunaClient
s@CreateLunaClient' {} Text
a -> CreateLunaClient
s {$sel:certificate:CreateLunaClient' :: Text
certificate = Text
a} :: CreateLunaClient)
instance Core.AWSRequest CreateLunaClient where
type
AWSResponse CreateLunaClient =
CreateLunaClientResponse
request :: CreateLunaClient -> Request CreateLunaClient
request = Service -> CreateLunaClient -> Request CreateLunaClient
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateLunaClient
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateLunaClient)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateLunaClient))
-> Logger
-> Service
-> Proxy CreateLunaClient
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateLunaClient)))
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 -> CreateLunaClientResponse
CreateLunaClientResponse'
(Maybe Text -> Int -> CreateLunaClientResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateLunaClientResponse)
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
"ClientArn")
Either String (Int -> CreateLunaClientResponse)
-> Either String Int -> Either String CreateLunaClientResponse
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 CreateLunaClient
instance Prelude.NFData CreateLunaClient
instance Core.ToHeaders CreateLunaClient where
toHeaders :: CreateLunaClient -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateLunaClient -> 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.CreateLunaClient" ::
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 CreateLunaClient where
toJSON :: CreateLunaClient -> Value
toJSON CreateLunaClient' {Maybe Text
Text
certificate :: Text
label :: Maybe Text
$sel:certificate:CreateLunaClient' :: CreateLunaClient -> Text
$sel:label:CreateLunaClient' :: CreateLunaClient -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Label" 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
label,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Certificate" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
certificate)
]
)
instance Core.ToPath CreateLunaClient where
toPath :: CreateLunaClient -> ByteString
toPath = ByteString -> CreateLunaClient -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateLunaClient where
toQuery :: CreateLunaClient -> QueryString
toQuery = QueryString -> CreateLunaClient -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateLunaClientResponse = CreateLunaClientResponse'
{
CreateLunaClientResponse -> Maybe Text
clientArn :: Prelude.Maybe Prelude.Text,
CreateLunaClientResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateLunaClientResponse -> CreateLunaClientResponse -> Bool
(CreateLunaClientResponse -> CreateLunaClientResponse -> Bool)
-> (CreateLunaClientResponse -> CreateLunaClientResponse -> Bool)
-> Eq CreateLunaClientResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLunaClientResponse -> CreateLunaClientResponse -> Bool
$c/= :: CreateLunaClientResponse -> CreateLunaClientResponse -> Bool
== :: CreateLunaClientResponse -> CreateLunaClientResponse -> Bool
$c== :: CreateLunaClientResponse -> CreateLunaClientResponse -> Bool
Prelude.Eq, ReadPrec [CreateLunaClientResponse]
ReadPrec CreateLunaClientResponse
Int -> ReadS CreateLunaClientResponse
ReadS [CreateLunaClientResponse]
(Int -> ReadS CreateLunaClientResponse)
-> ReadS [CreateLunaClientResponse]
-> ReadPrec CreateLunaClientResponse
-> ReadPrec [CreateLunaClientResponse]
-> Read CreateLunaClientResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateLunaClientResponse]
$creadListPrec :: ReadPrec [CreateLunaClientResponse]
readPrec :: ReadPrec CreateLunaClientResponse
$creadPrec :: ReadPrec CreateLunaClientResponse
readList :: ReadS [CreateLunaClientResponse]
$creadList :: ReadS [CreateLunaClientResponse]
readsPrec :: Int -> ReadS CreateLunaClientResponse
$creadsPrec :: Int -> ReadS CreateLunaClientResponse
Prelude.Read, Int -> CreateLunaClientResponse -> ShowS
[CreateLunaClientResponse] -> ShowS
CreateLunaClientResponse -> String
(Int -> CreateLunaClientResponse -> ShowS)
-> (CreateLunaClientResponse -> String)
-> ([CreateLunaClientResponse] -> ShowS)
-> Show CreateLunaClientResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLunaClientResponse] -> ShowS
$cshowList :: [CreateLunaClientResponse] -> ShowS
show :: CreateLunaClientResponse -> String
$cshow :: CreateLunaClientResponse -> String
showsPrec :: Int -> CreateLunaClientResponse -> ShowS
$cshowsPrec :: Int -> CreateLunaClientResponse -> ShowS
Prelude.Show, (forall x.
CreateLunaClientResponse -> Rep CreateLunaClientResponse x)
-> (forall x.
Rep CreateLunaClientResponse x -> CreateLunaClientResponse)
-> Generic CreateLunaClientResponse
forall x.
Rep CreateLunaClientResponse x -> CreateLunaClientResponse
forall x.
CreateLunaClientResponse -> Rep CreateLunaClientResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateLunaClientResponse x -> CreateLunaClientResponse
$cfrom :: forall x.
CreateLunaClientResponse -> Rep CreateLunaClientResponse x
Prelude.Generic)
newCreateLunaClientResponse ::
Prelude.Int ->
CreateLunaClientResponse
newCreateLunaClientResponse :: Int -> CreateLunaClientResponse
newCreateLunaClientResponse Int
pHttpStatus_ =
CreateLunaClientResponse' :: Maybe Text -> Int -> CreateLunaClientResponse
CreateLunaClientResponse'
{ $sel:clientArn:CreateLunaClientResponse' :: Maybe Text
clientArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateLunaClientResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createLunaClientResponse_clientArn :: Lens.Lens' CreateLunaClientResponse (Prelude.Maybe Prelude.Text)
createLunaClientResponse_clientArn :: (Maybe Text -> f (Maybe Text))
-> CreateLunaClientResponse -> f CreateLunaClientResponse
createLunaClientResponse_clientArn = (CreateLunaClientResponse -> Maybe Text)
-> (CreateLunaClientResponse
-> Maybe Text -> CreateLunaClientResponse)
-> Lens
CreateLunaClientResponse
CreateLunaClientResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLunaClientResponse' {Maybe Text
clientArn :: Maybe Text
$sel:clientArn:CreateLunaClientResponse' :: CreateLunaClientResponse -> Maybe Text
clientArn} -> Maybe Text
clientArn) (\s :: CreateLunaClientResponse
s@CreateLunaClientResponse' {} Maybe Text
a -> CreateLunaClientResponse
s {$sel:clientArn:CreateLunaClientResponse' :: Maybe Text
clientArn = Maybe Text
a} :: CreateLunaClientResponse)
createLunaClientResponse_httpStatus :: Lens.Lens' CreateLunaClientResponse Prelude.Int
createLunaClientResponse_httpStatus :: (Int -> f Int)
-> CreateLunaClientResponse -> f CreateLunaClientResponse
createLunaClientResponse_httpStatus = (CreateLunaClientResponse -> Int)
-> (CreateLunaClientResponse -> Int -> CreateLunaClientResponse)
-> Lens CreateLunaClientResponse CreateLunaClientResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLunaClientResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateLunaClientResponse' :: CreateLunaClientResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateLunaClientResponse
s@CreateLunaClientResponse' {} Int
a -> CreateLunaClientResponse
s {$sel:httpStatus:CreateLunaClientResponse' :: Int
httpStatus = Int
a} :: CreateLunaClientResponse)
instance Prelude.NFData CreateLunaClientResponse