{-# 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.IoT.CreateKeysAndCertificate
(
CreateKeysAndCertificate (..),
newCreateKeysAndCertificate,
createKeysAndCertificate_setAsActive,
CreateKeysAndCertificateResponse (..),
newCreateKeysAndCertificateResponse,
createKeysAndCertificateResponse_keyPair,
createKeysAndCertificateResponse_certificatePem,
createKeysAndCertificateResponse_certificateArn,
createKeysAndCertificateResponse_certificateId,
createKeysAndCertificateResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IoT.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 CreateKeysAndCertificate = CreateKeysAndCertificate'
{
CreateKeysAndCertificate -> Maybe Bool
setAsActive :: Prelude.Maybe Prelude.Bool
}
deriving (CreateKeysAndCertificate -> CreateKeysAndCertificate -> Bool
(CreateKeysAndCertificate -> CreateKeysAndCertificate -> Bool)
-> (CreateKeysAndCertificate -> CreateKeysAndCertificate -> Bool)
-> Eq CreateKeysAndCertificate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateKeysAndCertificate -> CreateKeysAndCertificate -> Bool
$c/= :: CreateKeysAndCertificate -> CreateKeysAndCertificate -> Bool
== :: CreateKeysAndCertificate -> CreateKeysAndCertificate -> Bool
$c== :: CreateKeysAndCertificate -> CreateKeysAndCertificate -> Bool
Prelude.Eq, ReadPrec [CreateKeysAndCertificate]
ReadPrec CreateKeysAndCertificate
Int -> ReadS CreateKeysAndCertificate
ReadS [CreateKeysAndCertificate]
(Int -> ReadS CreateKeysAndCertificate)
-> ReadS [CreateKeysAndCertificate]
-> ReadPrec CreateKeysAndCertificate
-> ReadPrec [CreateKeysAndCertificate]
-> Read CreateKeysAndCertificate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateKeysAndCertificate]
$creadListPrec :: ReadPrec [CreateKeysAndCertificate]
readPrec :: ReadPrec CreateKeysAndCertificate
$creadPrec :: ReadPrec CreateKeysAndCertificate
readList :: ReadS [CreateKeysAndCertificate]
$creadList :: ReadS [CreateKeysAndCertificate]
readsPrec :: Int -> ReadS CreateKeysAndCertificate
$creadsPrec :: Int -> ReadS CreateKeysAndCertificate
Prelude.Read, Int -> CreateKeysAndCertificate -> ShowS
[CreateKeysAndCertificate] -> ShowS
CreateKeysAndCertificate -> String
(Int -> CreateKeysAndCertificate -> ShowS)
-> (CreateKeysAndCertificate -> String)
-> ([CreateKeysAndCertificate] -> ShowS)
-> Show CreateKeysAndCertificate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateKeysAndCertificate] -> ShowS
$cshowList :: [CreateKeysAndCertificate] -> ShowS
show :: CreateKeysAndCertificate -> String
$cshow :: CreateKeysAndCertificate -> String
showsPrec :: Int -> CreateKeysAndCertificate -> ShowS
$cshowsPrec :: Int -> CreateKeysAndCertificate -> ShowS
Prelude.Show, (forall x.
CreateKeysAndCertificate -> Rep CreateKeysAndCertificate x)
-> (forall x.
Rep CreateKeysAndCertificate x -> CreateKeysAndCertificate)
-> Generic CreateKeysAndCertificate
forall x.
Rep CreateKeysAndCertificate x -> CreateKeysAndCertificate
forall x.
CreateKeysAndCertificate -> Rep CreateKeysAndCertificate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateKeysAndCertificate x -> CreateKeysAndCertificate
$cfrom :: forall x.
CreateKeysAndCertificate -> Rep CreateKeysAndCertificate x
Prelude.Generic)
newCreateKeysAndCertificate ::
CreateKeysAndCertificate
newCreateKeysAndCertificate :: CreateKeysAndCertificate
newCreateKeysAndCertificate =
CreateKeysAndCertificate' :: Maybe Bool -> CreateKeysAndCertificate
CreateKeysAndCertificate'
{ $sel:setAsActive:CreateKeysAndCertificate' :: Maybe Bool
setAsActive =
Maybe Bool
forall a. Maybe a
Prelude.Nothing
}
createKeysAndCertificate_setAsActive :: Lens.Lens' CreateKeysAndCertificate (Prelude.Maybe Prelude.Bool)
createKeysAndCertificate_setAsActive :: (Maybe Bool -> f (Maybe Bool))
-> CreateKeysAndCertificate -> f CreateKeysAndCertificate
createKeysAndCertificate_setAsActive = (CreateKeysAndCertificate -> Maybe Bool)
-> (CreateKeysAndCertificate
-> Maybe Bool -> CreateKeysAndCertificate)
-> Lens
CreateKeysAndCertificate
CreateKeysAndCertificate
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateKeysAndCertificate' {Maybe Bool
setAsActive :: Maybe Bool
$sel:setAsActive:CreateKeysAndCertificate' :: CreateKeysAndCertificate -> Maybe Bool
setAsActive} -> Maybe Bool
setAsActive) (\s :: CreateKeysAndCertificate
s@CreateKeysAndCertificate' {} Maybe Bool
a -> CreateKeysAndCertificate
s {$sel:setAsActive:CreateKeysAndCertificate' :: Maybe Bool
setAsActive = Maybe Bool
a} :: CreateKeysAndCertificate)
instance Core.AWSRequest CreateKeysAndCertificate where
type
AWSResponse CreateKeysAndCertificate =
CreateKeysAndCertificateResponse
request :: CreateKeysAndCertificate -> Request CreateKeysAndCertificate
request = Service
-> CreateKeysAndCertificate -> Request CreateKeysAndCertificate
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateKeysAndCertificate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateKeysAndCertificate)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateKeysAndCertificate))
-> Logger
-> Service
-> Proxy CreateKeysAndCertificate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateKeysAndCertificate)))
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 KeyPair
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> CreateKeysAndCertificateResponse
CreateKeysAndCertificateResponse'
(Maybe KeyPair
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> CreateKeysAndCertificateResponse)
-> Either String (Maybe KeyPair)
-> Either
String
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> CreateKeysAndCertificateResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe KeyPair)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"keyPair")
Either
String
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> CreateKeysAndCertificateResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe Text
-> Maybe Text -> Int -> CreateKeysAndCertificateResponse)
forall (f :: * -> *) a b. Applicative f => 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
"certificatePem")
Either
String
(Maybe Text
-> Maybe Text -> Int -> CreateKeysAndCertificateResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe Text -> Int -> CreateKeysAndCertificateResponse)
forall (f :: * -> *) a b. Applicative f => 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
"certificateArn")
Either
String (Maybe Text -> Int -> CreateKeysAndCertificateResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateKeysAndCertificateResponse)
forall (f :: * -> *) a b. Applicative f => 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
"certificateId")
Either String (Int -> CreateKeysAndCertificateResponse)
-> Either String Int
-> Either String CreateKeysAndCertificateResponse
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 CreateKeysAndCertificate
instance Prelude.NFData CreateKeysAndCertificate
instance Core.ToHeaders CreateKeysAndCertificate where
toHeaders :: CreateKeysAndCertificate -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateKeysAndCertificate -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON CreateKeysAndCertificate where
toJSON :: CreateKeysAndCertificate -> Value
toJSON = Value -> CreateKeysAndCertificate -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)
instance Core.ToPath CreateKeysAndCertificate where
toPath :: CreateKeysAndCertificate -> ByteString
toPath = ByteString -> CreateKeysAndCertificate -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/keys-and-certificate"
instance Core.ToQuery CreateKeysAndCertificate where
toQuery :: CreateKeysAndCertificate -> QueryString
toQuery CreateKeysAndCertificate' {Maybe Bool
setAsActive :: Maybe Bool
$sel:setAsActive:CreateKeysAndCertificate' :: CreateKeysAndCertificate -> Maybe Bool
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"setAsActive" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
setAsActive]
data CreateKeysAndCertificateResponse = CreateKeysAndCertificateResponse'
{
CreateKeysAndCertificateResponse -> Maybe KeyPair
keyPair :: Prelude.Maybe KeyPair,
CreateKeysAndCertificateResponse -> Maybe Text
certificatePem :: Prelude.Maybe Prelude.Text,
CreateKeysAndCertificateResponse -> Maybe Text
certificateArn :: Prelude.Maybe Prelude.Text,
CreateKeysAndCertificateResponse -> Maybe Text
certificateId :: Prelude.Maybe Prelude.Text,
CreateKeysAndCertificateResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateKeysAndCertificateResponse
-> CreateKeysAndCertificateResponse -> Bool
(CreateKeysAndCertificateResponse
-> CreateKeysAndCertificateResponse -> Bool)
-> (CreateKeysAndCertificateResponse
-> CreateKeysAndCertificateResponse -> Bool)
-> Eq CreateKeysAndCertificateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateKeysAndCertificateResponse
-> CreateKeysAndCertificateResponse -> Bool
$c/= :: CreateKeysAndCertificateResponse
-> CreateKeysAndCertificateResponse -> Bool
== :: CreateKeysAndCertificateResponse
-> CreateKeysAndCertificateResponse -> Bool
$c== :: CreateKeysAndCertificateResponse
-> CreateKeysAndCertificateResponse -> Bool
Prelude.Eq, Int -> CreateKeysAndCertificateResponse -> ShowS
[CreateKeysAndCertificateResponse] -> ShowS
CreateKeysAndCertificateResponse -> String
(Int -> CreateKeysAndCertificateResponse -> ShowS)
-> (CreateKeysAndCertificateResponse -> String)
-> ([CreateKeysAndCertificateResponse] -> ShowS)
-> Show CreateKeysAndCertificateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateKeysAndCertificateResponse] -> ShowS
$cshowList :: [CreateKeysAndCertificateResponse] -> ShowS
show :: CreateKeysAndCertificateResponse -> String
$cshow :: CreateKeysAndCertificateResponse -> String
showsPrec :: Int -> CreateKeysAndCertificateResponse -> ShowS
$cshowsPrec :: Int -> CreateKeysAndCertificateResponse -> ShowS
Prelude.Show, (forall x.
CreateKeysAndCertificateResponse
-> Rep CreateKeysAndCertificateResponse x)
-> (forall x.
Rep CreateKeysAndCertificateResponse x
-> CreateKeysAndCertificateResponse)
-> Generic CreateKeysAndCertificateResponse
forall x.
Rep CreateKeysAndCertificateResponse x
-> CreateKeysAndCertificateResponse
forall x.
CreateKeysAndCertificateResponse
-> Rep CreateKeysAndCertificateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateKeysAndCertificateResponse x
-> CreateKeysAndCertificateResponse
$cfrom :: forall x.
CreateKeysAndCertificateResponse
-> Rep CreateKeysAndCertificateResponse x
Prelude.Generic)
newCreateKeysAndCertificateResponse ::
Prelude.Int ->
CreateKeysAndCertificateResponse
newCreateKeysAndCertificateResponse :: Int -> CreateKeysAndCertificateResponse
newCreateKeysAndCertificateResponse Int
pHttpStatus_ =
CreateKeysAndCertificateResponse' :: Maybe KeyPair
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> CreateKeysAndCertificateResponse
CreateKeysAndCertificateResponse'
{ $sel:keyPair:CreateKeysAndCertificateResponse' :: Maybe KeyPair
keyPair =
Maybe KeyPair
forall a. Maybe a
Prelude.Nothing,
$sel:certificatePem:CreateKeysAndCertificateResponse' :: Maybe Text
certificatePem = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:certificateArn:CreateKeysAndCertificateResponse' :: Maybe Text
certificateArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:certificateId:CreateKeysAndCertificateResponse' :: Maybe Text
certificateId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateKeysAndCertificateResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createKeysAndCertificateResponse_keyPair :: Lens.Lens' CreateKeysAndCertificateResponse (Prelude.Maybe KeyPair)
createKeysAndCertificateResponse_keyPair :: (Maybe KeyPair -> f (Maybe KeyPair))
-> CreateKeysAndCertificateResponse
-> f CreateKeysAndCertificateResponse
createKeysAndCertificateResponse_keyPair = (CreateKeysAndCertificateResponse -> Maybe KeyPair)
-> (CreateKeysAndCertificateResponse
-> Maybe KeyPair -> CreateKeysAndCertificateResponse)
-> Lens
CreateKeysAndCertificateResponse
CreateKeysAndCertificateResponse
(Maybe KeyPair)
(Maybe KeyPair)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateKeysAndCertificateResponse' {Maybe KeyPair
keyPair :: Maybe KeyPair
$sel:keyPair:CreateKeysAndCertificateResponse' :: CreateKeysAndCertificateResponse -> Maybe KeyPair
keyPair} -> Maybe KeyPair
keyPair) (\s :: CreateKeysAndCertificateResponse
s@CreateKeysAndCertificateResponse' {} Maybe KeyPair
a -> CreateKeysAndCertificateResponse
s {$sel:keyPair:CreateKeysAndCertificateResponse' :: Maybe KeyPair
keyPair = Maybe KeyPair
a} :: CreateKeysAndCertificateResponse)
createKeysAndCertificateResponse_certificatePem :: Lens.Lens' CreateKeysAndCertificateResponse (Prelude.Maybe Prelude.Text)
createKeysAndCertificateResponse_certificatePem :: (Maybe Text -> f (Maybe Text))
-> CreateKeysAndCertificateResponse
-> f CreateKeysAndCertificateResponse
createKeysAndCertificateResponse_certificatePem = (CreateKeysAndCertificateResponse -> Maybe Text)
-> (CreateKeysAndCertificateResponse
-> Maybe Text -> CreateKeysAndCertificateResponse)
-> Lens
CreateKeysAndCertificateResponse
CreateKeysAndCertificateResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateKeysAndCertificateResponse' {Maybe Text
certificatePem :: Maybe Text
$sel:certificatePem:CreateKeysAndCertificateResponse' :: CreateKeysAndCertificateResponse -> Maybe Text
certificatePem} -> Maybe Text
certificatePem) (\s :: CreateKeysAndCertificateResponse
s@CreateKeysAndCertificateResponse' {} Maybe Text
a -> CreateKeysAndCertificateResponse
s {$sel:certificatePem:CreateKeysAndCertificateResponse' :: Maybe Text
certificatePem = Maybe Text
a} :: CreateKeysAndCertificateResponse)
createKeysAndCertificateResponse_certificateArn :: Lens.Lens' CreateKeysAndCertificateResponse (Prelude.Maybe Prelude.Text)
createKeysAndCertificateResponse_certificateArn :: (Maybe Text -> f (Maybe Text))
-> CreateKeysAndCertificateResponse
-> f CreateKeysAndCertificateResponse
createKeysAndCertificateResponse_certificateArn = (CreateKeysAndCertificateResponse -> Maybe Text)
-> (CreateKeysAndCertificateResponse
-> Maybe Text -> CreateKeysAndCertificateResponse)
-> Lens
CreateKeysAndCertificateResponse
CreateKeysAndCertificateResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateKeysAndCertificateResponse' {Maybe Text
certificateArn :: Maybe Text
$sel:certificateArn:CreateKeysAndCertificateResponse' :: CreateKeysAndCertificateResponse -> Maybe Text
certificateArn} -> Maybe Text
certificateArn) (\s :: CreateKeysAndCertificateResponse
s@CreateKeysAndCertificateResponse' {} Maybe Text
a -> CreateKeysAndCertificateResponse
s {$sel:certificateArn:CreateKeysAndCertificateResponse' :: Maybe Text
certificateArn = Maybe Text
a} :: CreateKeysAndCertificateResponse)
createKeysAndCertificateResponse_certificateId :: Lens.Lens' CreateKeysAndCertificateResponse (Prelude.Maybe Prelude.Text)
createKeysAndCertificateResponse_certificateId :: (Maybe Text -> f (Maybe Text))
-> CreateKeysAndCertificateResponse
-> f CreateKeysAndCertificateResponse
createKeysAndCertificateResponse_certificateId = (CreateKeysAndCertificateResponse -> Maybe Text)
-> (CreateKeysAndCertificateResponse
-> Maybe Text -> CreateKeysAndCertificateResponse)
-> Lens
CreateKeysAndCertificateResponse
CreateKeysAndCertificateResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateKeysAndCertificateResponse' {Maybe Text
certificateId :: Maybe Text
$sel:certificateId:CreateKeysAndCertificateResponse' :: CreateKeysAndCertificateResponse -> Maybe Text
certificateId} -> Maybe Text
certificateId) (\s :: CreateKeysAndCertificateResponse
s@CreateKeysAndCertificateResponse' {} Maybe Text
a -> CreateKeysAndCertificateResponse
s {$sel:certificateId:CreateKeysAndCertificateResponse' :: Maybe Text
certificateId = Maybe Text
a} :: CreateKeysAndCertificateResponse)
createKeysAndCertificateResponse_httpStatus :: Lens.Lens' CreateKeysAndCertificateResponse Prelude.Int
createKeysAndCertificateResponse_httpStatus :: (Int -> f Int)
-> CreateKeysAndCertificateResponse
-> f CreateKeysAndCertificateResponse
createKeysAndCertificateResponse_httpStatus = (CreateKeysAndCertificateResponse -> Int)
-> (CreateKeysAndCertificateResponse
-> Int -> CreateKeysAndCertificateResponse)
-> Lens
CreateKeysAndCertificateResponse
CreateKeysAndCertificateResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateKeysAndCertificateResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateKeysAndCertificateResponse' :: CreateKeysAndCertificateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateKeysAndCertificateResponse
s@CreateKeysAndCertificateResponse' {} Int
a -> CreateKeysAndCertificateResponse
s {$sel:httpStatus:CreateKeysAndCertificateResponse' :: Int
httpStatus = Int
a} :: CreateKeysAndCertificateResponse)
instance
Prelude.NFData
CreateKeysAndCertificateResponse