{-# 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.RegisterThing
(
RegisterThing (..),
newRegisterThing,
registerThing_parameters,
registerThing_templateBody,
RegisterThingResponse (..),
newRegisterThingResponse,
registerThingResponse_certificatePem,
registerThingResponse_resourceArns,
registerThingResponse_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 RegisterThing = RegisterThing'
{
RegisterThing -> Maybe (HashMap Text Text)
parameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
RegisterThing -> Text
templateBody :: Prelude.Text
}
deriving (RegisterThing -> RegisterThing -> Bool
(RegisterThing -> RegisterThing -> Bool)
-> (RegisterThing -> RegisterThing -> Bool) -> Eq RegisterThing
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterThing -> RegisterThing -> Bool
$c/= :: RegisterThing -> RegisterThing -> Bool
== :: RegisterThing -> RegisterThing -> Bool
$c== :: RegisterThing -> RegisterThing -> Bool
Prelude.Eq, ReadPrec [RegisterThing]
ReadPrec RegisterThing
Int -> ReadS RegisterThing
ReadS [RegisterThing]
(Int -> ReadS RegisterThing)
-> ReadS [RegisterThing]
-> ReadPrec RegisterThing
-> ReadPrec [RegisterThing]
-> Read RegisterThing
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterThing]
$creadListPrec :: ReadPrec [RegisterThing]
readPrec :: ReadPrec RegisterThing
$creadPrec :: ReadPrec RegisterThing
readList :: ReadS [RegisterThing]
$creadList :: ReadS [RegisterThing]
readsPrec :: Int -> ReadS RegisterThing
$creadsPrec :: Int -> ReadS RegisterThing
Prelude.Read, Int -> RegisterThing -> ShowS
[RegisterThing] -> ShowS
RegisterThing -> String
(Int -> RegisterThing -> ShowS)
-> (RegisterThing -> String)
-> ([RegisterThing] -> ShowS)
-> Show RegisterThing
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterThing] -> ShowS
$cshowList :: [RegisterThing] -> ShowS
show :: RegisterThing -> String
$cshow :: RegisterThing -> String
showsPrec :: Int -> RegisterThing -> ShowS
$cshowsPrec :: Int -> RegisterThing -> ShowS
Prelude.Show, (forall x. RegisterThing -> Rep RegisterThing x)
-> (forall x. Rep RegisterThing x -> RegisterThing)
-> Generic RegisterThing
forall x. Rep RegisterThing x -> RegisterThing
forall x. RegisterThing -> Rep RegisterThing x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RegisterThing x -> RegisterThing
$cfrom :: forall x. RegisterThing -> Rep RegisterThing x
Prelude.Generic)
newRegisterThing ::
Prelude.Text ->
RegisterThing
newRegisterThing :: Text -> RegisterThing
newRegisterThing Text
pTemplateBody_ =
RegisterThing' :: Maybe (HashMap Text Text) -> Text -> RegisterThing
RegisterThing'
{ $sel:parameters:RegisterThing' :: Maybe (HashMap Text Text)
parameters = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:templateBody:RegisterThing' :: Text
templateBody = Text
pTemplateBody_
}
registerThing_parameters :: Lens.Lens' RegisterThing (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
registerThing_parameters :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> RegisterThing -> f RegisterThing
registerThing_parameters = (RegisterThing -> Maybe (HashMap Text Text))
-> (RegisterThing -> Maybe (HashMap Text Text) -> RegisterThing)
-> Lens
RegisterThing
RegisterThing
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterThing' {Maybe (HashMap Text Text)
parameters :: Maybe (HashMap Text Text)
$sel:parameters:RegisterThing' :: RegisterThing -> Maybe (HashMap Text Text)
parameters} -> Maybe (HashMap Text Text)
parameters) (\s :: RegisterThing
s@RegisterThing' {} Maybe (HashMap Text Text)
a -> RegisterThing
s {$sel:parameters:RegisterThing' :: Maybe (HashMap Text Text)
parameters = Maybe (HashMap Text Text)
a} :: RegisterThing) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> RegisterThing -> f RegisterThing)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> RegisterThing
-> f RegisterThing
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
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
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
registerThing_templateBody :: Lens.Lens' RegisterThing Prelude.Text
registerThing_templateBody :: (Text -> f Text) -> RegisterThing -> f RegisterThing
registerThing_templateBody = (RegisterThing -> Text)
-> (RegisterThing -> Text -> RegisterThing)
-> Lens RegisterThing RegisterThing Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterThing' {Text
templateBody :: Text
$sel:templateBody:RegisterThing' :: RegisterThing -> Text
templateBody} -> Text
templateBody) (\s :: RegisterThing
s@RegisterThing' {} Text
a -> RegisterThing
s {$sel:templateBody:RegisterThing' :: Text
templateBody = Text
a} :: RegisterThing)
instance Core.AWSRequest RegisterThing where
type
AWSResponse RegisterThing =
RegisterThingResponse
request :: RegisterThing -> Request RegisterThing
request = Service -> RegisterThing -> Request RegisterThing
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RegisterThing
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RegisterThing)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse RegisterThing))
-> Logger
-> Service
-> Proxy RegisterThing
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RegisterThing)))
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 (HashMap Text Text) -> Int -> RegisterThingResponse
RegisterThingResponse'
(Maybe Text
-> Maybe (HashMap Text Text) -> Int -> RegisterThingResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe (HashMap Text Text) -> Int -> RegisterThingResponse)
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
"certificatePem")
Either
String (Maybe (HashMap Text Text) -> Int -> RegisterThingResponse)
-> Either String (Maybe (HashMap Text Text))
-> Either String (Int -> RegisterThingResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"resourceArns" Either String (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text)
-> Either String (Maybe (HashMap Text Text))
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> RegisterThingResponse)
-> Either String Int -> Either String RegisterThingResponse
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 RegisterThing
instance Prelude.NFData RegisterThing
instance Core.ToHeaders RegisterThing where
toHeaders :: RegisterThing -> ResponseHeaders
toHeaders = ResponseHeaders -> RegisterThing -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON RegisterThing where
toJSON :: RegisterThing -> Value
toJSON RegisterThing' {Maybe (HashMap Text Text)
Text
templateBody :: Text
parameters :: Maybe (HashMap Text Text)
$sel:templateBody:RegisterThing' :: RegisterThing -> Text
$sel:parameters:RegisterThing' :: RegisterThing -> Maybe (HashMap Text Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"parameters" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
parameters,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"templateBody" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
templateBody)
]
)
instance Core.ToPath RegisterThing where
toPath :: RegisterThing -> ByteString
toPath = ByteString -> RegisterThing -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/things"
instance Core.ToQuery RegisterThing where
toQuery :: RegisterThing -> QueryString
toQuery = QueryString -> RegisterThing -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data RegisterThingResponse = RegisterThingResponse'
{
RegisterThingResponse -> Maybe Text
certificatePem :: Prelude.Maybe Prelude.Text,
RegisterThingResponse -> Maybe (HashMap Text Text)
resourceArns :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
RegisterThingResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RegisterThingResponse -> RegisterThingResponse -> Bool
(RegisterThingResponse -> RegisterThingResponse -> Bool)
-> (RegisterThingResponse -> RegisterThingResponse -> Bool)
-> Eq RegisterThingResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterThingResponse -> RegisterThingResponse -> Bool
$c/= :: RegisterThingResponse -> RegisterThingResponse -> Bool
== :: RegisterThingResponse -> RegisterThingResponse -> Bool
$c== :: RegisterThingResponse -> RegisterThingResponse -> Bool
Prelude.Eq, ReadPrec [RegisterThingResponse]
ReadPrec RegisterThingResponse
Int -> ReadS RegisterThingResponse
ReadS [RegisterThingResponse]
(Int -> ReadS RegisterThingResponse)
-> ReadS [RegisterThingResponse]
-> ReadPrec RegisterThingResponse
-> ReadPrec [RegisterThingResponse]
-> Read RegisterThingResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterThingResponse]
$creadListPrec :: ReadPrec [RegisterThingResponse]
readPrec :: ReadPrec RegisterThingResponse
$creadPrec :: ReadPrec RegisterThingResponse
readList :: ReadS [RegisterThingResponse]
$creadList :: ReadS [RegisterThingResponse]
readsPrec :: Int -> ReadS RegisterThingResponse
$creadsPrec :: Int -> ReadS RegisterThingResponse
Prelude.Read, Int -> RegisterThingResponse -> ShowS
[RegisterThingResponse] -> ShowS
RegisterThingResponse -> String
(Int -> RegisterThingResponse -> ShowS)
-> (RegisterThingResponse -> String)
-> ([RegisterThingResponse] -> ShowS)
-> Show RegisterThingResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterThingResponse] -> ShowS
$cshowList :: [RegisterThingResponse] -> ShowS
show :: RegisterThingResponse -> String
$cshow :: RegisterThingResponse -> String
showsPrec :: Int -> RegisterThingResponse -> ShowS
$cshowsPrec :: Int -> RegisterThingResponse -> ShowS
Prelude.Show, (forall x. RegisterThingResponse -> Rep RegisterThingResponse x)
-> (forall x. Rep RegisterThingResponse x -> RegisterThingResponse)
-> Generic RegisterThingResponse
forall x. Rep RegisterThingResponse x -> RegisterThingResponse
forall x. RegisterThingResponse -> Rep RegisterThingResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RegisterThingResponse x -> RegisterThingResponse
$cfrom :: forall x. RegisterThingResponse -> Rep RegisterThingResponse x
Prelude.Generic)
newRegisterThingResponse ::
Prelude.Int ->
RegisterThingResponse
newRegisterThingResponse :: Int -> RegisterThingResponse
newRegisterThingResponse Int
pHttpStatus_ =
RegisterThingResponse' :: Maybe Text
-> Maybe (HashMap Text Text) -> Int -> RegisterThingResponse
RegisterThingResponse'
{ $sel:certificatePem:RegisterThingResponse' :: Maybe Text
certificatePem =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:resourceArns:RegisterThingResponse' :: Maybe (HashMap Text Text)
resourceArns = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:RegisterThingResponse' :: Int
httpStatus = Int
pHttpStatus_
}
registerThingResponse_certificatePem :: Lens.Lens' RegisterThingResponse (Prelude.Maybe Prelude.Text)
registerThingResponse_certificatePem :: (Maybe Text -> f (Maybe Text))
-> RegisterThingResponse -> f RegisterThingResponse
registerThingResponse_certificatePem = (RegisterThingResponse -> Maybe Text)
-> (RegisterThingResponse -> Maybe Text -> RegisterThingResponse)
-> Lens
RegisterThingResponse
RegisterThingResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterThingResponse' {Maybe Text
certificatePem :: Maybe Text
$sel:certificatePem:RegisterThingResponse' :: RegisterThingResponse -> Maybe Text
certificatePem} -> Maybe Text
certificatePem) (\s :: RegisterThingResponse
s@RegisterThingResponse' {} Maybe Text
a -> RegisterThingResponse
s {$sel:certificatePem:RegisterThingResponse' :: Maybe Text
certificatePem = Maybe Text
a} :: RegisterThingResponse)
registerThingResponse_resourceArns :: Lens.Lens' RegisterThingResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
registerThingResponse_resourceArns :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> RegisterThingResponse -> f RegisterThingResponse
registerThingResponse_resourceArns = (RegisterThingResponse -> Maybe (HashMap Text Text))
-> (RegisterThingResponse
-> Maybe (HashMap Text Text) -> RegisterThingResponse)
-> Lens
RegisterThingResponse
RegisterThingResponse
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterThingResponse' {Maybe (HashMap Text Text)
resourceArns :: Maybe (HashMap Text Text)
$sel:resourceArns:RegisterThingResponse' :: RegisterThingResponse -> Maybe (HashMap Text Text)
resourceArns} -> Maybe (HashMap Text Text)
resourceArns) (\s :: RegisterThingResponse
s@RegisterThingResponse' {} Maybe (HashMap Text Text)
a -> RegisterThingResponse
s {$sel:resourceArns:RegisterThingResponse' :: Maybe (HashMap Text Text)
resourceArns = Maybe (HashMap Text Text)
a} :: RegisterThingResponse) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> RegisterThingResponse -> f RegisterThingResponse)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> RegisterThingResponse
-> f RegisterThingResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
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
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
registerThingResponse_httpStatus :: Lens.Lens' RegisterThingResponse Prelude.Int
registerThingResponse_httpStatus :: (Int -> f Int) -> RegisterThingResponse -> f RegisterThingResponse
registerThingResponse_httpStatus = (RegisterThingResponse -> Int)
-> (RegisterThingResponse -> Int -> RegisterThingResponse)
-> Lens RegisterThingResponse RegisterThingResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterThingResponse' {Int
httpStatus :: Int
$sel:httpStatus:RegisterThingResponse' :: RegisterThingResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RegisterThingResponse
s@RegisterThingResponse' {} Int
a -> RegisterThingResponse
s {$sel:httpStatus:RegisterThingResponse' :: Int
httpStatus = Int
a} :: RegisterThingResponse)
instance Prelude.NFData RegisterThingResponse