{-# 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.CreateProvisioningClaim
(
CreateProvisioningClaim (..),
newCreateProvisioningClaim,
createProvisioningClaim_templateName,
CreateProvisioningClaimResponse (..),
newCreateProvisioningClaimResponse,
createProvisioningClaimResponse_keyPair,
createProvisioningClaimResponse_certificatePem,
createProvisioningClaimResponse_certificateId,
createProvisioningClaimResponse_expiration,
createProvisioningClaimResponse_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 CreateProvisioningClaim = CreateProvisioningClaim'
{
CreateProvisioningClaim -> Text
templateName :: Prelude.Text
}
deriving (CreateProvisioningClaim -> CreateProvisioningClaim -> Bool
(CreateProvisioningClaim -> CreateProvisioningClaim -> Bool)
-> (CreateProvisioningClaim -> CreateProvisioningClaim -> Bool)
-> Eq CreateProvisioningClaim
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateProvisioningClaim -> CreateProvisioningClaim -> Bool
$c/= :: CreateProvisioningClaim -> CreateProvisioningClaim -> Bool
== :: CreateProvisioningClaim -> CreateProvisioningClaim -> Bool
$c== :: CreateProvisioningClaim -> CreateProvisioningClaim -> Bool
Prelude.Eq, ReadPrec [CreateProvisioningClaim]
ReadPrec CreateProvisioningClaim
Int -> ReadS CreateProvisioningClaim
ReadS [CreateProvisioningClaim]
(Int -> ReadS CreateProvisioningClaim)
-> ReadS [CreateProvisioningClaim]
-> ReadPrec CreateProvisioningClaim
-> ReadPrec [CreateProvisioningClaim]
-> Read CreateProvisioningClaim
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateProvisioningClaim]
$creadListPrec :: ReadPrec [CreateProvisioningClaim]
readPrec :: ReadPrec CreateProvisioningClaim
$creadPrec :: ReadPrec CreateProvisioningClaim
readList :: ReadS [CreateProvisioningClaim]
$creadList :: ReadS [CreateProvisioningClaim]
readsPrec :: Int -> ReadS CreateProvisioningClaim
$creadsPrec :: Int -> ReadS CreateProvisioningClaim
Prelude.Read, Int -> CreateProvisioningClaim -> ShowS
[CreateProvisioningClaim] -> ShowS
CreateProvisioningClaim -> String
(Int -> CreateProvisioningClaim -> ShowS)
-> (CreateProvisioningClaim -> String)
-> ([CreateProvisioningClaim] -> ShowS)
-> Show CreateProvisioningClaim
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateProvisioningClaim] -> ShowS
$cshowList :: [CreateProvisioningClaim] -> ShowS
show :: CreateProvisioningClaim -> String
$cshow :: CreateProvisioningClaim -> String
showsPrec :: Int -> CreateProvisioningClaim -> ShowS
$cshowsPrec :: Int -> CreateProvisioningClaim -> ShowS
Prelude.Show, (forall x.
CreateProvisioningClaim -> Rep CreateProvisioningClaim x)
-> (forall x.
Rep CreateProvisioningClaim x -> CreateProvisioningClaim)
-> Generic CreateProvisioningClaim
forall x. Rep CreateProvisioningClaim x -> CreateProvisioningClaim
forall x. CreateProvisioningClaim -> Rep CreateProvisioningClaim x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateProvisioningClaim x -> CreateProvisioningClaim
$cfrom :: forall x. CreateProvisioningClaim -> Rep CreateProvisioningClaim x
Prelude.Generic)
newCreateProvisioningClaim ::
Prelude.Text ->
CreateProvisioningClaim
newCreateProvisioningClaim :: Text -> CreateProvisioningClaim
newCreateProvisioningClaim Text
pTemplateName_ =
CreateProvisioningClaim' :: Text -> CreateProvisioningClaim
CreateProvisioningClaim'
{ $sel:templateName:CreateProvisioningClaim' :: Text
templateName =
Text
pTemplateName_
}
createProvisioningClaim_templateName :: Lens.Lens' CreateProvisioningClaim Prelude.Text
createProvisioningClaim_templateName :: (Text -> f Text)
-> CreateProvisioningClaim -> f CreateProvisioningClaim
createProvisioningClaim_templateName = (CreateProvisioningClaim -> Text)
-> (CreateProvisioningClaim -> Text -> CreateProvisioningClaim)
-> Lens CreateProvisioningClaim CreateProvisioningClaim Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProvisioningClaim' {Text
templateName :: Text
$sel:templateName:CreateProvisioningClaim' :: CreateProvisioningClaim -> Text
templateName} -> Text
templateName) (\s :: CreateProvisioningClaim
s@CreateProvisioningClaim' {} Text
a -> CreateProvisioningClaim
s {$sel:templateName:CreateProvisioningClaim' :: Text
templateName = Text
a} :: CreateProvisioningClaim)
instance Core.AWSRequest CreateProvisioningClaim where
type
AWSResponse CreateProvisioningClaim =
CreateProvisioningClaimResponse
request :: CreateProvisioningClaim -> Request CreateProvisioningClaim
request = Service
-> CreateProvisioningClaim -> Request CreateProvisioningClaim
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateProvisioningClaim
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateProvisioningClaim)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateProvisioningClaim))
-> Logger
-> Service
-> Proxy CreateProvisioningClaim
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateProvisioningClaim)))
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 POSIX
-> Int
-> CreateProvisioningClaimResponse
CreateProvisioningClaimResponse'
(Maybe KeyPair
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Int
-> CreateProvisioningClaimResponse)
-> Either String (Maybe KeyPair)
-> Either
String
(Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Int
-> CreateProvisioningClaimResponse)
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 POSIX
-> Int
-> CreateProvisioningClaimResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe Text
-> Maybe POSIX -> Int -> CreateProvisioningClaimResponse)
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 POSIX -> Int -> CreateProvisioningClaimResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe POSIX -> Int -> CreateProvisioningClaimResponse)
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 (Maybe POSIX -> Int -> CreateProvisioningClaimResponse)
-> Either String (Maybe POSIX)
-> Either String (Int -> CreateProvisioningClaimResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"expiration")
Either String (Int -> CreateProvisioningClaimResponse)
-> Either String Int
-> Either String CreateProvisioningClaimResponse
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 CreateProvisioningClaim
instance Prelude.NFData CreateProvisioningClaim
instance Core.ToHeaders CreateProvisioningClaim where
toHeaders :: CreateProvisioningClaim -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateProvisioningClaim -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON CreateProvisioningClaim where
toJSON :: CreateProvisioningClaim -> Value
toJSON = Value -> CreateProvisioningClaim -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)
instance Core.ToPath CreateProvisioningClaim where
toPath :: CreateProvisioningClaim -> ByteString
toPath CreateProvisioningClaim' {Text
templateName :: Text
$sel:templateName:CreateProvisioningClaim' :: CreateProvisioningClaim -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/provisioning-templates/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
templateName,
ByteString
"/provisioning-claim"
]
instance Core.ToQuery CreateProvisioningClaim where
toQuery :: CreateProvisioningClaim -> QueryString
toQuery = QueryString -> CreateProvisioningClaim -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateProvisioningClaimResponse = CreateProvisioningClaimResponse'
{
CreateProvisioningClaimResponse -> Maybe KeyPair
keyPair :: Prelude.Maybe KeyPair,
CreateProvisioningClaimResponse -> Maybe Text
certificatePem :: Prelude.Maybe Prelude.Text,
CreateProvisioningClaimResponse -> Maybe Text
certificateId :: Prelude.Maybe Prelude.Text,
CreateProvisioningClaimResponse -> Maybe POSIX
expiration :: Prelude.Maybe Core.POSIX,
CreateProvisioningClaimResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateProvisioningClaimResponse
-> CreateProvisioningClaimResponse -> Bool
(CreateProvisioningClaimResponse
-> CreateProvisioningClaimResponse -> Bool)
-> (CreateProvisioningClaimResponse
-> CreateProvisioningClaimResponse -> Bool)
-> Eq CreateProvisioningClaimResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateProvisioningClaimResponse
-> CreateProvisioningClaimResponse -> Bool
$c/= :: CreateProvisioningClaimResponse
-> CreateProvisioningClaimResponse -> Bool
== :: CreateProvisioningClaimResponse
-> CreateProvisioningClaimResponse -> Bool
$c== :: CreateProvisioningClaimResponse
-> CreateProvisioningClaimResponse -> Bool
Prelude.Eq, Int -> CreateProvisioningClaimResponse -> ShowS
[CreateProvisioningClaimResponse] -> ShowS
CreateProvisioningClaimResponse -> String
(Int -> CreateProvisioningClaimResponse -> ShowS)
-> (CreateProvisioningClaimResponse -> String)
-> ([CreateProvisioningClaimResponse] -> ShowS)
-> Show CreateProvisioningClaimResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateProvisioningClaimResponse] -> ShowS
$cshowList :: [CreateProvisioningClaimResponse] -> ShowS
show :: CreateProvisioningClaimResponse -> String
$cshow :: CreateProvisioningClaimResponse -> String
showsPrec :: Int -> CreateProvisioningClaimResponse -> ShowS
$cshowsPrec :: Int -> CreateProvisioningClaimResponse -> ShowS
Prelude.Show, (forall x.
CreateProvisioningClaimResponse
-> Rep CreateProvisioningClaimResponse x)
-> (forall x.
Rep CreateProvisioningClaimResponse x
-> CreateProvisioningClaimResponse)
-> Generic CreateProvisioningClaimResponse
forall x.
Rep CreateProvisioningClaimResponse x
-> CreateProvisioningClaimResponse
forall x.
CreateProvisioningClaimResponse
-> Rep CreateProvisioningClaimResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateProvisioningClaimResponse x
-> CreateProvisioningClaimResponse
$cfrom :: forall x.
CreateProvisioningClaimResponse
-> Rep CreateProvisioningClaimResponse x
Prelude.Generic)
newCreateProvisioningClaimResponse ::
Prelude.Int ->
CreateProvisioningClaimResponse
newCreateProvisioningClaimResponse :: Int -> CreateProvisioningClaimResponse
newCreateProvisioningClaimResponse Int
pHttpStatus_ =
CreateProvisioningClaimResponse' :: Maybe KeyPair
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Int
-> CreateProvisioningClaimResponse
CreateProvisioningClaimResponse'
{ $sel:keyPair:CreateProvisioningClaimResponse' :: Maybe KeyPair
keyPair =
Maybe KeyPair
forall a. Maybe a
Prelude.Nothing,
$sel:certificatePem:CreateProvisioningClaimResponse' :: Maybe Text
certificatePem = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:certificateId:CreateProvisioningClaimResponse' :: Maybe Text
certificateId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:expiration:CreateProvisioningClaimResponse' :: Maybe POSIX
expiration = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateProvisioningClaimResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createProvisioningClaimResponse_keyPair :: Lens.Lens' CreateProvisioningClaimResponse (Prelude.Maybe KeyPair)
createProvisioningClaimResponse_keyPair :: (Maybe KeyPair -> f (Maybe KeyPair))
-> CreateProvisioningClaimResponse
-> f CreateProvisioningClaimResponse
createProvisioningClaimResponse_keyPair = (CreateProvisioningClaimResponse -> Maybe KeyPair)
-> (CreateProvisioningClaimResponse
-> Maybe KeyPair -> CreateProvisioningClaimResponse)
-> Lens
CreateProvisioningClaimResponse
CreateProvisioningClaimResponse
(Maybe KeyPair)
(Maybe KeyPair)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProvisioningClaimResponse' {Maybe KeyPair
keyPair :: Maybe KeyPair
$sel:keyPair:CreateProvisioningClaimResponse' :: CreateProvisioningClaimResponse -> Maybe KeyPair
keyPair} -> Maybe KeyPair
keyPair) (\s :: CreateProvisioningClaimResponse
s@CreateProvisioningClaimResponse' {} Maybe KeyPair
a -> CreateProvisioningClaimResponse
s {$sel:keyPair:CreateProvisioningClaimResponse' :: Maybe KeyPair
keyPair = Maybe KeyPair
a} :: CreateProvisioningClaimResponse)
createProvisioningClaimResponse_certificatePem :: Lens.Lens' CreateProvisioningClaimResponse (Prelude.Maybe Prelude.Text)
createProvisioningClaimResponse_certificatePem :: (Maybe Text -> f (Maybe Text))
-> CreateProvisioningClaimResponse
-> f CreateProvisioningClaimResponse
createProvisioningClaimResponse_certificatePem = (CreateProvisioningClaimResponse -> Maybe Text)
-> (CreateProvisioningClaimResponse
-> Maybe Text -> CreateProvisioningClaimResponse)
-> Lens
CreateProvisioningClaimResponse
CreateProvisioningClaimResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProvisioningClaimResponse' {Maybe Text
certificatePem :: Maybe Text
$sel:certificatePem:CreateProvisioningClaimResponse' :: CreateProvisioningClaimResponse -> Maybe Text
certificatePem} -> Maybe Text
certificatePem) (\s :: CreateProvisioningClaimResponse
s@CreateProvisioningClaimResponse' {} Maybe Text
a -> CreateProvisioningClaimResponse
s {$sel:certificatePem:CreateProvisioningClaimResponse' :: Maybe Text
certificatePem = Maybe Text
a} :: CreateProvisioningClaimResponse)
createProvisioningClaimResponse_certificateId :: Lens.Lens' CreateProvisioningClaimResponse (Prelude.Maybe Prelude.Text)
createProvisioningClaimResponse_certificateId :: (Maybe Text -> f (Maybe Text))
-> CreateProvisioningClaimResponse
-> f CreateProvisioningClaimResponse
createProvisioningClaimResponse_certificateId = (CreateProvisioningClaimResponse -> Maybe Text)
-> (CreateProvisioningClaimResponse
-> Maybe Text -> CreateProvisioningClaimResponse)
-> Lens
CreateProvisioningClaimResponse
CreateProvisioningClaimResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProvisioningClaimResponse' {Maybe Text
certificateId :: Maybe Text
$sel:certificateId:CreateProvisioningClaimResponse' :: CreateProvisioningClaimResponse -> Maybe Text
certificateId} -> Maybe Text
certificateId) (\s :: CreateProvisioningClaimResponse
s@CreateProvisioningClaimResponse' {} Maybe Text
a -> CreateProvisioningClaimResponse
s {$sel:certificateId:CreateProvisioningClaimResponse' :: Maybe Text
certificateId = Maybe Text
a} :: CreateProvisioningClaimResponse)
createProvisioningClaimResponse_expiration :: Lens.Lens' CreateProvisioningClaimResponse (Prelude.Maybe Prelude.UTCTime)
createProvisioningClaimResponse_expiration :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateProvisioningClaimResponse
-> f CreateProvisioningClaimResponse
createProvisioningClaimResponse_expiration = (CreateProvisioningClaimResponse -> Maybe POSIX)
-> (CreateProvisioningClaimResponse
-> Maybe POSIX -> CreateProvisioningClaimResponse)
-> Lens
CreateProvisioningClaimResponse
CreateProvisioningClaimResponse
(Maybe POSIX)
(Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProvisioningClaimResponse' {Maybe POSIX
expiration :: Maybe POSIX
$sel:expiration:CreateProvisioningClaimResponse' :: CreateProvisioningClaimResponse -> Maybe POSIX
expiration} -> Maybe POSIX
expiration) (\s :: CreateProvisioningClaimResponse
s@CreateProvisioningClaimResponse' {} Maybe POSIX
a -> CreateProvisioningClaimResponse
s {$sel:expiration:CreateProvisioningClaimResponse' :: Maybe POSIX
expiration = Maybe POSIX
a} :: CreateProvisioningClaimResponse) ((Maybe POSIX -> f (Maybe POSIX))
-> CreateProvisioningClaimResponse
-> f CreateProvisioningClaimResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateProvisioningClaimResponse
-> f CreateProvisioningClaimResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
createProvisioningClaimResponse_httpStatus :: Lens.Lens' CreateProvisioningClaimResponse Prelude.Int
createProvisioningClaimResponse_httpStatus :: (Int -> f Int)
-> CreateProvisioningClaimResponse
-> f CreateProvisioningClaimResponse
createProvisioningClaimResponse_httpStatus = (CreateProvisioningClaimResponse -> Int)
-> (CreateProvisioningClaimResponse
-> Int -> CreateProvisioningClaimResponse)
-> Lens
CreateProvisioningClaimResponse
CreateProvisioningClaimResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProvisioningClaimResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateProvisioningClaimResponse' :: CreateProvisioningClaimResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateProvisioningClaimResponse
s@CreateProvisioningClaimResponse' {} Int
a -> CreateProvisioningClaimResponse
s {$sel:httpStatus:CreateProvisioningClaimResponse' :: Int
httpStatus = Int
a} :: CreateProvisioningClaimResponse)
instance
Prelude.NFData
CreateProvisioningClaimResponse