{-# 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.RegisterCertificateWithoutCA
(
RegisterCertificateWithoutCA (..),
newRegisterCertificateWithoutCA,
registerCertificateWithoutCA_status,
registerCertificateWithoutCA_certificatePem,
RegisterCertificateWithoutCAResponse (..),
newRegisterCertificateWithoutCAResponse,
registerCertificateWithoutCAResponse_certificateArn,
registerCertificateWithoutCAResponse_certificateId,
registerCertificateWithoutCAResponse_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 RegisterCertificateWithoutCA = RegisterCertificateWithoutCA'
{
RegisterCertificateWithoutCA -> Maybe CertificateStatus
status :: Prelude.Maybe CertificateStatus,
RegisterCertificateWithoutCA -> Text
certificatePem :: Prelude.Text
}
deriving (RegisterCertificateWithoutCA
-> RegisterCertificateWithoutCA -> Bool
(RegisterCertificateWithoutCA
-> RegisterCertificateWithoutCA -> Bool)
-> (RegisterCertificateWithoutCA
-> RegisterCertificateWithoutCA -> Bool)
-> Eq RegisterCertificateWithoutCA
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterCertificateWithoutCA
-> RegisterCertificateWithoutCA -> Bool
$c/= :: RegisterCertificateWithoutCA
-> RegisterCertificateWithoutCA -> Bool
== :: RegisterCertificateWithoutCA
-> RegisterCertificateWithoutCA -> Bool
$c== :: RegisterCertificateWithoutCA
-> RegisterCertificateWithoutCA -> Bool
Prelude.Eq, ReadPrec [RegisterCertificateWithoutCA]
ReadPrec RegisterCertificateWithoutCA
Int -> ReadS RegisterCertificateWithoutCA
ReadS [RegisterCertificateWithoutCA]
(Int -> ReadS RegisterCertificateWithoutCA)
-> ReadS [RegisterCertificateWithoutCA]
-> ReadPrec RegisterCertificateWithoutCA
-> ReadPrec [RegisterCertificateWithoutCA]
-> Read RegisterCertificateWithoutCA
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterCertificateWithoutCA]
$creadListPrec :: ReadPrec [RegisterCertificateWithoutCA]
readPrec :: ReadPrec RegisterCertificateWithoutCA
$creadPrec :: ReadPrec RegisterCertificateWithoutCA
readList :: ReadS [RegisterCertificateWithoutCA]
$creadList :: ReadS [RegisterCertificateWithoutCA]
readsPrec :: Int -> ReadS RegisterCertificateWithoutCA
$creadsPrec :: Int -> ReadS RegisterCertificateWithoutCA
Prelude.Read, Int -> RegisterCertificateWithoutCA -> ShowS
[RegisterCertificateWithoutCA] -> ShowS
RegisterCertificateWithoutCA -> String
(Int -> RegisterCertificateWithoutCA -> ShowS)
-> (RegisterCertificateWithoutCA -> String)
-> ([RegisterCertificateWithoutCA] -> ShowS)
-> Show RegisterCertificateWithoutCA
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterCertificateWithoutCA] -> ShowS
$cshowList :: [RegisterCertificateWithoutCA] -> ShowS
show :: RegisterCertificateWithoutCA -> String
$cshow :: RegisterCertificateWithoutCA -> String
showsPrec :: Int -> RegisterCertificateWithoutCA -> ShowS
$cshowsPrec :: Int -> RegisterCertificateWithoutCA -> ShowS
Prelude.Show, (forall x.
RegisterCertificateWithoutCA -> Rep RegisterCertificateWithoutCA x)
-> (forall x.
Rep RegisterCertificateWithoutCA x -> RegisterCertificateWithoutCA)
-> Generic RegisterCertificateWithoutCA
forall x.
Rep RegisterCertificateWithoutCA x -> RegisterCertificateWithoutCA
forall x.
RegisterCertificateWithoutCA -> Rep RegisterCertificateWithoutCA x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RegisterCertificateWithoutCA x -> RegisterCertificateWithoutCA
$cfrom :: forall x.
RegisterCertificateWithoutCA -> Rep RegisterCertificateWithoutCA x
Prelude.Generic)
newRegisterCertificateWithoutCA ::
Prelude.Text ->
RegisterCertificateWithoutCA
newRegisterCertificateWithoutCA :: Text -> RegisterCertificateWithoutCA
newRegisterCertificateWithoutCA Text
pCertificatePem_ =
RegisterCertificateWithoutCA' :: Maybe CertificateStatus -> Text -> RegisterCertificateWithoutCA
RegisterCertificateWithoutCA'
{ $sel:status:RegisterCertificateWithoutCA' :: Maybe CertificateStatus
status =
Maybe CertificateStatus
forall a. Maybe a
Prelude.Nothing,
$sel:certificatePem:RegisterCertificateWithoutCA' :: Text
certificatePem = Text
pCertificatePem_
}
registerCertificateWithoutCA_status :: Lens.Lens' RegisterCertificateWithoutCA (Prelude.Maybe CertificateStatus)
registerCertificateWithoutCA_status :: (Maybe CertificateStatus -> f (Maybe CertificateStatus))
-> RegisterCertificateWithoutCA -> f RegisterCertificateWithoutCA
registerCertificateWithoutCA_status = (RegisterCertificateWithoutCA -> Maybe CertificateStatus)
-> (RegisterCertificateWithoutCA
-> Maybe CertificateStatus -> RegisterCertificateWithoutCA)
-> Lens
RegisterCertificateWithoutCA
RegisterCertificateWithoutCA
(Maybe CertificateStatus)
(Maybe CertificateStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterCertificateWithoutCA' {Maybe CertificateStatus
status :: Maybe CertificateStatus
$sel:status:RegisterCertificateWithoutCA' :: RegisterCertificateWithoutCA -> Maybe CertificateStatus
status} -> Maybe CertificateStatus
status) (\s :: RegisterCertificateWithoutCA
s@RegisterCertificateWithoutCA' {} Maybe CertificateStatus
a -> RegisterCertificateWithoutCA
s {$sel:status:RegisterCertificateWithoutCA' :: Maybe CertificateStatus
status = Maybe CertificateStatus
a} :: RegisterCertificateWithoutCA)
registerCertificateWithoutCA_certificatePem :: Lens.Lens' RegisterCertificateWithoutCA Prelude.Text
registerCertificateWithoutCA_certificatePem :: (Text -> f Text)
-> RegisterCertificateWithoutCA -> f RegisterCertificateWithoutCA
registerCertificateWithoutCA_certificatePem = (RegisterCertificateWithoutCA -> Text)
-> (RegisterCertificateWithoutCA
-> Text -> RegisterCertificateWithoutCA)
-> Lens
RegisterCertificateWithoutCA RegisterCertificateWithoutCA Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterCertificateWithoutCA' {Text
certificatePem :: Text
$sel:certificatePem:RegisterCertificateWithoutCA' :: RegisterCertificateWithoutCA -> Text
certificatePem} -> Text
certificatePem) (\s :: RegisterCertificateWithoutCA
s@RegisterCertificateWithoutCA' {} Text
a -> RegisterCertificateWithoutCA
s {$sel:certificatePem:RegisterCertificateWithoutCA' :: Text
certificatePem = Text
a} :: RegisterCertificateWithoutCA)
instance Core.AWSRequest RegisterCertificateWithoutCA where
type
AWSResponse RegisterCertificateWithoutCA =
RegisterCertificateWithoutCAResponse
request :: RegisterCertificateWithoutCA
-> Request RegisterCertificateWithoutCA
request = Service
-> RegisterCertificateWithoutCA
-> Request RegisterCertificateWithoutCA
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RegisterCertificateWithoutCA
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RegisterCertificateWithoutCA)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse RegisterCertificateWithoutCA))
-> Logger
-> Service
-> Proxy RegisterCertificateWithoutCA
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RegisterCertificateWithoutCA)))
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
-> Maybe Text -> Int -> RegisterCertificateWithoutCAResponse
RegisterCertificateWithoutCAResponse'
(Maybe Text
-> Maybe Text -> Int -> RegisterCertificateWithoutCAResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe Text -> Int -> RegisterCertificateWithoutCAResponse)
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
"certificateArn")
Either
String (Maybe Text -> Int -> RegisterCertificateWithoutCAResponse)
-> Either String (Maybe Text)
-> Either String (Int -> RegisterCertificateWithoutCAResponse)
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 -> RegisterCertificateWithoutCAResponse)
-> Either String Int
-> Either String RegisterCertificateWithoutCAResponse
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
RegisterCertificateWithoutCA
instance Prelude.NFData RegisterCertificateWithoutCA
instance Core.ToHeaders RegisterCertificateWithoutCA where
toHeaders :: RegisterCertificateWithoutCA -> ResponseHeaders
toHeaders = ResponseHeaders -> RegisterCertificateWithoutCA -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON RegisterCertificateWithoutCA where
toJSON :: RegisterCertificateWithoutCA -> Value
toJSON RegisterCertificateWithoutCA' {Maybe CertificateStatus
Text
certificatePem :: Text
status :: Maybe CertificateStatus
$sel:certificatePem:RegisterCertificateWithoutCA' :: RegisterCertificateWithoutCA -> Text
$sel:status:RegisterCertificateWithoutCA' :: RegisterCertificateWithoutCA -> Maybe CertificateStatus
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"status" Text -> CertificateStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (CertificateStatus -> Pair)
-> Maybe CertificateStatus -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CertificateStatus
status,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"certificatePem" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
certificatePem)
]
)
instance Core.ToPath RegisterCertificateWithoutCA where
toPath :: RegisterCertificateWithoutCA -> ByteString
toPath = ByteString -> RegisterCertificateWithoutCA -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/certificate/register-no-ca"
instance Core.ToQuery RegisterCertificateWithoutCA where
toQuery :: RegisterCertificateWithoutCA -> QueryString
toQuery = QueryString -> RegisterCertificateWithoutCA -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data RegisterCertificateWithoutCAResponse = RegisterCertificateWithoutCAResponse'
{
RegisterCertificateWithoutCAResponse -> Maybe Text
certificateArn :: Prelude.Maybe Prelude.Text,
RegisterCertificateWithoutCAResponse -> Maybe Text
certificateId :: Prelude.Maybe Prelude.Text,
RegisterCertificateWithoutCAResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RegisterCertificateWithoutCAResponse
-> RegisterCertificateWithoutCAResponse -> Bool
(RegisterCertificateWithoutCAResponse
-> RegisterCertificateWithoutCAResponse -> Bool)
-> (RegisterCertificateWithoutCAResponse
-> RegisterCertificateWithoutCAResponse -> Bool)
-> Eq RegisterCertificateWithoutCAResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterCertificateWithoutCAResponse
-> RegisterCertificateWithoutCAResponse -> Bool
$c/= :: RegisterCertificateWithoutCAResponse
-> RegisterCertificateWithoutCAResponse -> Bool
== :: RegisterCertificateWithoutCAResponse
-> RegisterCertificateWithoutCAResponse -> Bool
$c== :: RegisterCertificateWithoutCAResponse
-> RegisterCertificateWithoutCAResponse -> Bool
Prelude.Eq, ReadPrec [RegisterCertificateWithoutCAResponse]
ReadPrec RegisterCertificateWithoutCAResponse
Int -> ReadS RegisterCertificateWithoutCAResponse
ReadS [RegisterCertificateWithoutCAResponse]
(Int -> ReadS RegisterCertificateWithoutCAResponse)
-> ReadS [RegisterCertificateWithoutCAResponse]
-> ReadPrec RegisterCertificateWithoutCAResponse
-> ReadPrec [RegisterCertificateWithoutCAResponse]
-> Read RegisterCertificateWithoutCAResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterCertificateWithoutCAResponse]
$creadListPrec :: ReadPrec [RegisterCertificateWithoutCAResponse]
readPrec :: ReadPrec RegisterCertificateWithoutCAResponse
$creadPrec :: ReadPrec RegisterCertificateWithoutCAResponse
readList :: ReadS [RegisterCertificateWithoutCAResponse]
$creadList :: ReadS [RegisterCertificateWithoutCAResponse]
readsPrec :: Int -> ReadS RegisterCertificateWithoutCAResponse
$creadsPrec :: Int -> ReadS RegisterCertificateWithoutCAResponse
Prelude.Read, Int -> RegisterCertificateWithoutCAResponse -> ShowS
[RegisterCertificateWithoutCAResponse] -> ShowS
RegisterCertificateWithoutCAResponse -> String
(Int -> RegisterCertificateWithoutCAResponse -> ShowS)
-> (RegisterCertificateWithoutCAResponse -> String)
-> ([RegisterCertificateWithoutCAResponse] -> ShowS)
-> Show RegisterCertificateWithoutCAResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterCertificateWithoutCAResponse] -> ShowS
$cshowList :: [RegisterCertificateWithoutCAResponse] -> ShowS
show :: RegisterCertificateWithoutCAResponse -> String
$cshow :: RegisterCertificateWithoutCAResponse -> String
showsPrec :: Int -> RegisterCertificateWithoutCAResponse -> ShowS
$cshowsPrec :: Int -> RegisterCertificateWithoutCAResponse -> ShowS
Prelude.Show, (forall x.
RegisterCertificateWithoutCAResponse
-> Rep RegisterCertificateWithoutCAResponse x)
-> (forall x.
Rep RegisterCertificateWithoutCAResponse x
-> RegisterCertificateWithoutCAResponse)
-> Generic RegisterCertificateWithoutCAResponse
forall x.
Rep RegisterCertificateWithoutCAResponse x
-> RegisterCertificateWithoutCAResponse
forall x.
RegisterCertificateWithoutCAResponse
-> Rep RegisterCertificateWithoutCAResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RegisterCertificateWithoutCAResponse x
-> RegisterCertificateWithoutCAResponse
$cfrom :: forall x.
RegisterCertificateWithoutCAResponse
-> Rep RegisterCertificateWithoutCAResponse x
Prelude.Generic)
newRegisterCertificateWithoutCAResponse ::
Prelude.Int ->
RegisterCertificateWithoutCAResponse
newRegisterCertificateWithoutCAResponse :: Int -> RegisterCertificateWithoutCAResponse
newRegisterCertificateWithoutCAResponse Int
pHttpStatus_ =
RegisterCertificateWithoutCAResponse' :: Maybe Text
-> Maybe Text -> Int -> RegisterCertificateWithoutCAResponse
RegisterCertificateWithoutCAResponse'
{ $sel:certificateArn:RegisterCertificateWithoutCAResponse' :: Maybe Text
certificateArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:certificateId:RegisterCertificateWithoutCAResponse' :: Maybe Text
certificateId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:RegisterCertificateWithoutCAResponse' :: Int
httpStatus = Int
pHttpStatus_
}
registerCertificateWithoutCAResponse_certificateArn :: Lens.Lens' RegisterCertificateWithoutCAResponse (Prelude.Maybe Prelude.Text)
registerCertificateWithoutCAResponse_certificateArn :: (Maybe Text -> f (Maybe Text))
-> RegisterCertificateWithoutCAResponse
-> f RegisterCertificateWithoutCAResponse
registerCertificateWithoutCAResponse_certificateArn = (RegisterCertificateWithoutCAResponse -> Maybe Text)
-> (RegisterCertificateWithoutCAResponse
-> Maybe Text -> RegisterCertificateWithoutCAResponse)
-> Lens
RegisterCertificateWithoutCAResponse
RegisterCertificateWithoutCAResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterCertificateWithoutCAResponse' {Maybe Text
certificateArn :: Maybe Text
$sel:certificateArn:RegisterCertificateWithoutCAResponse' :: RegisterCertificateWithoutCAResponse -> Maybe Text
certificateArn} -> Maybe Text
certificateArn) (\s :: RegisterCertificateWithoutCAResponse
s@RegisterCertificateWithoutCAResponse' {} Maybe Text
a -> RegisterCertificateWithoutCAResponse
s {$sel:certificateArn:RegisterCertificateWithoutCAResponse' :: Maybe Text
certificateArn = Maybe Text
a} :: RegisterCertificateWithoutCAResponse)
registerCertificateWithoutCAResponse_certificateId :: Lens.Lens' RegisterCertificateWithoutCAResponse (Prelude.Maybe Prelude.Text)
registerCertificateWithoutCAResponse_certificateId :: (Maybe Text -> f (Maybe Text))
-> RegisterCertificateWithoutCAResponse
-> f RegisterCertificateWithoutCAResponse
registerCertificateWithoutCAResponse_certificateId = (RegisterCertificateWithoutCAResponse -> Maybe Text)
-> (RegisterCertificateWithoutCAResponse
-> Maybe Text -> RegisterCertificateWithoutCAResponse)
-> Lens
RegisterCertificateWithoutCAResponse
RegisterCertificateWithoutCAResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterCertificateWithoutCAResponse' {Maybe Text
certificateId :: Maybe Text
$sel:certificateId:RegisterCertificateWithoutCAResponse' :: RegisterCertificateWithoutCAResponse -> Maybe Text
certificateId} -> Maybe Text
certificateId) (\s :: RegisterCertificateWithoutCAResponse
s@RegisterCertificateWithoutCAResponse' {} Maybe Text
a -> RegisterCertificateWithoutCAResponse
s {$sel:certificateId:RegisterCertificateWithoutCAResponse' :: Maybe Text
certificateId = Maybe Text
a} :: RegisterCertificateWithoutCAResponse)
registerCertificateWithoutCAResponse_httpStatus :: Lens.Lens' RegisterCertificateWithoutCAResponse Prelude.Int
registerCertificateWithoutCAResponse_httpStatus :: (Int -> f Int)
-> RegisterCertificateWithoutCAResponse
-> f RegisterCertificateWithoutCAResponse
registerCertificateWithoutCAResponse_httpStatus = (RegisterCertificateWithoutCAResponse -> Int)
-> (RegisterCertificateWithoutCAResponse
-> Int -> RegisterCertificateWithoutCAResponse)
-> Lens
RegisterCertificateWithoutCAResponse
RegisterCertificateWithoutCAResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterCertificateWithoutCAResponse' {Int
httpStatus :: Int
$sel:httpStatus:RegisterCertificateWithoutCAResponse' :: RegisterCertificateWithoutCAResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RegisterCertificateWithoutCAResponse
s@RegisterCertificateWithoutCAResponse' {} Int
a -> RegisterCertificateWithoutCAResponse
s {$sel:httpStatus:RegisterCertificateWithoutCAResponse' :: Int
httpStatus = Int
a} :: RegisterCertificateWithoutCAResponse)
instance
Prelude.NFData
RegisterCertificateWithoutCAResponse