{-# 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.GetRegistrationCode
(
GetRegistrationCode (..),
newGetRegistrationCode,
GetRegistrationCodeResponse (..),
newGetRegistrationCodeResponse,
getRegistrationCodeResponse_registrationCode,
getRegistrationCodeResponse_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 GetRegistrationCode = GetRegistrationCode'
{
}
deriving (GetRegistrationCode -> GetRegistrationCode -> Bool
(GetRegistrationCode -> GetRegistrationCode -> Bool)
-> (GetRegistrationCode -> GetRegistrationCode -> Bool)
-> Eq GetRegistrationCode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRegistrationCode -> GetRegistrationCode -> Bool
$c/= :: GetRegistrationCode -> GetRegistrationCode -> Bool
== :: GetRegistrationCode -> GetRegistrationCode -> Bool
$c== :: GetRegistrationCode -> GetRegistrationCode -> Bool
Prelude.Eq, ReadPrec [GetRegistrationCode]
ReadPrec GetRegistrationCode
Int -> ReadS GetRegistrationCode
ReadS [GetRegistrationCode]
(Int -> ReadS GetRegistrationCode)
-> ReadS [GetRegistrationCode]
-> ReadPrec GetRegistrationCode
-> ReadPrec [GetRegistrationCode]
-> Read GetRegistrationCode
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRegistrationCode]
$creadListPrec :: ReadPrec [GetRegistrationCode]
readPrec :: ReadPrec GetRegistrationCode
$creadPrec :: ReadPrec GetRegistrationCode
readList :: ReadS [GetRegistrationCode]
$creadList :: ReadS [GetRegistrationCode]
readsPrec :: Int -> ReadS GetRegistrationCode
$creadsPrec :: Int -> ReadS GetRegistrationCode
Prelude.Read, Int -> GetRegistrationCode -> ShowS
[GetRegistrationCode] -> ShowS
GetRegistrationCode -> String
(Int -> GetRegistrationCode -> ShowS)
-> (GetRegistrationCode -> String)
-> ([GetRegistrationCode] -> ShowS)
-> Show GetRegistrationCode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRegistrationCode] -> ShowS
$cshowList :: [GetRegistrationCode] -> ShowS
show :: GetRegistrationCode -> String
$cshow :: GetRegistrationCode -> String
showsPrec :: Int -> GetRegistrationCode -> ShowS
$cshowsPrec :: Int -> GetRegistrationCode -> ShowS
Prelude.Show, (forall x. GetRegistrationCode -> Rep GetRegistrationCode x)
-> (forall x. Rep GetRegistrationCode x -> GetRegistrationCode)
-> Generic GetRegistrationCode
forall x. Rep GetRegistrationCode x -> GetRegistrationCode
forall x. GetRegistrationCode -> Rep GetRegistrationCode x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRegistrationCode x -> GetRegistrationCode
$cfrom :: forall x. GetRegistrationCode -> Rep GetRegistrationCode x
Prelude.Generic)
newGetRegistrationCode ::
GetRegistrationCode
newGetRegistrationCode :: GetRegistrationCode
newGetRegistrationCode = GetRegistrationCode
GetRegistrationCode'
instance Core.AWSRequest GetRegistrationCode where
type
AWSResponse GetRegistrationCode =
GetRegistrationCodeResponse
request :: GetRegistrationCode -> Request GetRegistrationCode
request = Service -> GetRegistrationCode -> Request GetRegistrationCode
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetRegistrationCode
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetRegistrationCode)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetRegistrationCode))
-> Logger
-> Service
-> Proxy GetRegistrationCode
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetRegistrationCode)))
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 -> GetRegistrationCodeResponse
GetRegistrationCodeResponse'
(Maybe Text -> Int -> GetRegistrationCodeResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetRegistrationCodeResponse)
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
"registrationCode")
Either String (Int -> GetRegistrationCodeResponse)
-> Either String Int -> Either String GetRegistrationCodeResponse
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 GetRegistrationCode
instance Prelude.NFData GetRegistrationCode
instance Core.ToHeaders GetRegistrationCode where
toHeaders :: GetRegistrationCode -> ResponseHeaders
toHeaders = ResponseHeaders -> GetRegistrationCode -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetRegistrationCode where
toPath :: GetRegistrationCode -> ByteString
toPath = ByteString -> GetRegistrationCode -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/registrationcode"
instance Core.ToQuery GetRegistrationCode where
toQuery :: GetRegistrationCode -> QueryString
toQuery = QueryString -> GetRegistrationCode -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetRegistrationCodeResponse = GetRegistrationCodeResponse'
{
GetRegistrationCodeResponse -> Maybe Text
registrationCode :: Prelude.Maybe Prelude.Text,
GetRegistrationCodeResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetRegistrationCodeResponse -> GetRegistrationCodeResponse -> Bool
(GetRegistrationCodeResponse
-> GetRegistrationCodeResponse -> Bool)
-> (GetRegistrationCodeResponse
-> GetRegistrationCodeResponse -> Bool)
-> Eq GetRegistrationCodeResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRegistrationCodeResponse -> GetRegistrationCodeResponse -> Bool
$c/= :: GetRegistrationCodeResponse -> GetRegistrationCodeResponse -> Bool
== :: GetRegistrationCodeResponse -> GetRegistrationCodeResponse -> Bool
$c== :: GetRegistrationCodeResponse -> GetRegistrationCodeResponse -> Bool
Prelude.Eq, ReadPrec [GetRegistrationCodeResponse]
ReadPrec GetRegistrationCodeResponse
Int -> ReadS GetRegistrationCodeResponse
ReadS [GetRegistrationCodeResponse]
(Int -> ReadS GetRegistrationCodeResponse)
-> ReadS [GetRegistrationCodeResponse]
-> ReadPrec GetRegistrationCodeResponse
-> ReadPrec [GetRegistrationCodeResponse]
-> Read GetRegistrationCodeResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRegistrationCodeResponse]
$creadListPrec :: ReadPrec [GetRegistrationCodeResponse]
readPrec :: ReadPrec GetRegistrationCodeResponse
$creadPrec :: ReadPrec GetRegistrationCodeResponse
readList :: ReadS [GetRegistrationCodeResponse]
$creadList :: ReadS [GetRegistrationCodeResponse]
readsPrec :: Int -> ReadS GetRegistrationCodeResponse
$creadsPrec :: Int -> ReadS GetRegistrationCodeResponse
Prelude.Read, Int -> GetRegistrationCodeResponse -> ShowS
[GetRegistrationCodeResponse] -> ShowS
GetRegistrationCodeResponse -> String
(Int -> GetRegistrationCodeResponse -> ShowS)
-> (GetRegistrationCodeResponse -> String)
-> ([GetRegistrationCodeResponse] -> ShowS)
-> Show GetRegistrationCodeResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRegistrationCodeResponse] -> ShowS
$cshowList :: [GetRegistrationCodeResponse] -> ShowS
show :: GetRegistrationCodeResponse -> String
$cshow :: GetRegistrationCodeResponse -> String
showsPrec :: Int -> GetRegistrationCodeResponse -> ShowS
$cshowsPrec :: Int -> GetRegistrationCodeResponse -> ShowS
Prelude.Show, (forall x.
GetRegistrationCodeResponse -> Rep GetRegistrationCodeResponse x)
-> (forall x.
Rep GetRegistrationCodeResponse x -> GetRegistrationCodeResponse)
-> Generic GetRegistrationCodeResponse
forall x.
Rep GetRegistrationCodeResponse x -> GetRegistrationCodeResponse
forall x.
GetRegistrationCodeResponse -> Rep GetRegistrationCodeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetRegistrationCodeResponse x -> GetRegistrationCodeResponse
$cfrom :: forall x.
GetRegistrationCodeResponse -> Rep GetRegistrationCodeResponse x
Prelude.Generic)
newGetRegistrationCodeResponse ::
Prelude.Int ->
GetRegistrationCodeResponse
newGetRegistrationCodeResponse :: Int -> GetRegistrationCodeResponse
newGetRegistrationCodeResponse Int
pHttpStatus_ =
GetRegistrationCodeResponse' :: Maybe Text -> Int -> GetRegistrationCodeResponse
GetRegistrationCodeResponse'
{ $sel:registrationCode:GetRegistrationCodeResponse' :: Maybe Text
registrationCode =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetRegistrationCodeResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getRegistrationCodeResponse_registrationCode :: Lens.Lens' GetRegistrationCodeResponse (Prelude.Maybe Prelude.Text)
getRegistrationCodeResponse_registrationCode :: (Maybe Text -> f (Maybe Text))
-> GetRegistrationCodeResponse -> f GetRegistrationCodeResponse
getRegistrationCodeResponse_registrationCode = (GetRegistrationCodeResponse -> Maybe Text)
-> (GetRegistrationCodeResponse
-> Maybe Text -> GetRegistrationCodeResponse)
-> Lens
GetRegistrationCodeResponse
GetRegistrationCodeResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRegistrationCodeResponse' {Maybe Text
registrationCode :: Maybe Text
$sel:registrationCode:GetRegistrationCodeResponse' :: GetRegistrationCodeResponse -> Maybe Text
registrationCode} -> Maybe Text
registrationCode) (\s :: GetRegistrationCodeResponse
s@GetRegistrationCodeResponse' {} Maybe Text
a -> GetRegistrationCodeResponse
s {$sel:registrationCode:GetRegistrationCodeResponse' :: Maybe Text
registrationCode = Maybe Text
a} :: GetRegistrationCodeResponse)
getRegistrationCodeResponse_httpStatus :: Lens.Lens' GetRegistrationCodeResponse Prelude.Int
getRegistrationCodeResponse_httpStatus :: (Int -> f Int)
-> GetRegistrationCodeResponse -> f GetRegistrationCodeResponse
getRegistrationCodeResponse_httpStatus = (GetRegistrationCodeResponse -> Int)
-> (GetRegistrationCodeResponse
-> Int -> GetRegistrationCodeResponse)
-> Lens
GetRegistrationCodeResponse GetRegistrationCodeResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRegistrationCodeResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetRegistrationCodeResponse' :: GetRegistrationCodeResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetRegistrationCodeResponse
s@GetRegistrationCodeResponse' {} Int
a -> GetRegistrationCodeResponse
s {$sel:httpStatus:GetRegistrationCodeResponse' :: Int
httpStatus = Int
a} :: GetRegistrationCodeResponse)
instance Prelude.NFData GetRegistrationCodeResponse