{-# 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.StartThingRegistrationTask
(
StartThingRegistrationTask (..),
newStartThingRegistrationTask,
startThingRegistrationTask_templateBody,
startThingRegistrationTask_inputFileBucket,
startThingRegistrationTask_inputFileKey,
startThingRegistrationTask_roleArn,
StartThingRegistrationTaskResponse (..),
newStartThingRegistrationTaskResponse,
startThingRegistrationTaskResponse_taskId,
startThingRegistrationTaskResponse_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 StartThingRegistrationTask = StartThingRegistrationTask'
{
StartThingRegistrationTask -> Text
templateBody :: Prelude.Text,
StartThingRegistrationTask -> Text
inputFileBucket :: Prelude.Text,
StartThingRegistrationTask -> Text
inputFileKey :: Prelude.Text,
StartThingRegistrationTask -> Text
roleArn :: Prelude.Text
}
deriving (StartThingRegistrationTask -> StartThingRegistrationTask -> Bool
(StartThingRegistrationTask -> StartThingRegistrationTask -> Bool)
-> (StartThingRegistrationTask
-> StartThingRegistrationTask -> Bool)
-> Eq StartThingRegistrationTask
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartThingRegistrationTask -> StartThingRegistrationTask -> Bool
$c/= :: StartThingRegistrationTask -> StartThingRegistrationTask -> Bool
== :: StartThingRegistrationTask -> StartThingRegistrationTask -> Bool
$c== :: StartThingRegistrationTask -> StartThingRegistrationTask -> Bool
Prelude.Eq, ReadPrec [StartThingRegistrationTask]
ReadPrec StartThingRegistrationTask
Int -> ReadS StartThingRegistrationTask
ReadS [StartThingRegistrationTask]
(Int -> ReadS StartThingRegistrationTask)
-> ReadS [StartThingRegistrationTask]
-> ReadPrec StartThingRegistrationTask
-> ReadPrec [StartThingRegistrationTask]
-> Read StartThingRegistrationTask
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartThingRegistrationTask]
$creadListPrec :: ReadPrec [StartThingRegistrationTask]
readPrec :: ReadPrec StartThingRegistrationTask
$creadPrec :: ReadPrec StartThingRegistrationTask
readList :: ReadS [StartThingRegistrationTask]
$creadList :: ReadS [StartThingRegistrationTask]
readsPrec :: Int -> ReadS StartThingRegistrationTask
$creadsPrec :: Int -> ReadS StartThingRegistrationTask
Prelude.Read, Int -> StartThingRegistrationTask -> ShowS
[StartThingRegistrationTask] -> ShowS
StartThingRegistrationTask -> String
(Int -> StartThingRegistrationTask -> ShowS)
-> (StartThingRegistrationTask -> String)
-> ([StartThingRegistrationTask] -> ShowS)
-> Show StartThingRegistrationTask
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartThingRegistrationTask] -> ShowS
$cshowList :: [StartThingRegistrationTask] -> ShowS
show :: StartThingRegistrationTask -> String
$cshow :: StartThingRegistrationTask -> String
showsPrec :: Int -> StartThingRegistrationTask -> ShowS
$cshowsPrec :: Int -> StartThingRegistrationTask -> ShowS
Prelude.Show, (forall x.
StartThingRegistrationTask -> Rep StartThingRegistrationTask x)
-> (forall x.
Rep StartThingRegistrationTask x -> StartThingRegistrationTask)
-> Generic StartThingRegistrationTask
forall x.
Rep StartThingRegistrationTask x -> StartThingRegistrationTask
forall x.
StartThingRegistrationTask -> Rep StartThingRegistrationTask x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartThingRegistrationTask x -> StartThingRegistrationTask
$cfrom :: forall x.
StartThingRegistrationTask -> Rep StartThingRegistrationTask x
Prelude.Generic)
newStartThingRegistrationTask ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
StartThingRegistrationTask
newStartThingRegistrationTask :: Text -> Text -> Text -> Text -> StartThingRegistrationTask
newStartThingRegistrationTask
Text
pTemplateBody_
Text
pInputFileBucket_
Text
pInputFileKey_
Text
pRoleArn_ =
StartThingRegistrationTask' :: Text -> Text -> Text -> Text -> StartThingRegistrationTask
StartThingRegistrationTask'
{ $sel:templateBody:StartThingRegistrationTask' :: Text
templateBody =
Text
pTemplateBody_,
$sel:inputFileBucket:StartThingRegistrationTask' :: Text
inputFileBucket = Text
pInputFileBucket_,
$sel:inputFileKey:StartThingRegistrationTask' :: Text
inputFileKey = Text
pInputFileKey_,
$sel:roleArn:StartThingRegistrationTask' :: Text
roleArn = Text
pRoleArn_
}
startThingRegistrationTask_templateBody :: Lens.Lens' StartThingRegistrationTask Prelude.Text
startThingRegistrationTask_templateBody :: (Text -> f Text)
-> StartThingRegistrationTask -> f StartThingRegistrationTask
startThingRegistrationTask_templateBody = (StartThingRegistrationTask -> Text)
-> (StartThingRegistrationTask
-> Text -> StartThingRegistrationTask)
-> Lens
StartThingRegistrationTask StartThingRegistrationTask Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartThingRegistrationTask' {Text
templateBody :: Text
$sel:templateBody:StartThingRegistrationTask' :: StartThingRegistrationTask -> Text
templateBody} -> Text
templateBody) (\s :: StartThingRegistrationTask
s@StartThingRegistrationTask' {} Text
a -> StartThingRegistrationTask
s {$sel:templateBody:StartThingRegistrationTask' :: Text
templateBody = Text
a} :: StartThingRegistrationTask)
startThingRegistrationTask_inputFileBucket :: Lens.Lens' StartThingRegistrationTask Prelude.Text
startThingRegistrationTask_inputFileBucket :: (Text -> f Text)
-> StartThingRegistrationTask -> f StartThingRegistrationTask
startThingRegistrationTask_inputFileBucket = (StartThingRegistrationTask -> Text)
-> (StartThingRegistrationTask
-> Text -> StartThingRegistrationTask)
-> Lens
StartThingRegistrationTask StartThingRegistrationTask Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartThingRegistrationTask' {Text
inputFileBucket :: Text
$sel:inputFileBucket:StartThingRegistrationTask' :: StartThingRegistrationTask -> Text
inputFileBucket} -> Text
inputFileBucket) (\s :: StartThingRegistrationTask
s@StartThingRegistrationTask' {} Text
a -> StartThingRegistrationTask
s {$sel:inputFileBucket:StartThingRegistrationTask' :: Text
inputFileBucket = Text
a} :: StartThingRegistrationTask)
startThingRegistrationTask_inputFileKey :: Lens.Lens' StartThingRegistrationTask Prelude.Text
startThingRegistrationTask_inputFileKey :: (Text -> f Text)
-> StartThingRegistrationTask -> f StartThingRegistrationTask
startThingRegistrationTask_inputFileKey = (StartThingRegistrationTask -> Text)
-> (StartThingRegistrationTask
-> Text -> StartThingRegistrationTask)
-> Lens
StartThingRegistrationTask StartThingRegistrationTask Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartThingRegistrationTask' {Text
inputFileKey :: Text
$sel:inputFileKey:StartThingRegistrationTask' :: StartThingRegistrationTask -> Text
inputFileKey} -> Text
inputFileKey) (\s :: StartThingRegistrationTask
s@StartThingRegistrationTask' {} Text
a -> StartThingRegistrationTask
s {$sel:inputFileKey:StartThingRegistrationTask' :: Text
inputFileKey = Text
a} :: StartThingRegistrationTask)
startThingRegistrationTask_roleArn :: Lens.Lens' StartThingRegistrationTask Prelude.Text
startThingRegistrationTask_roleArn :: (Text -> f Text)
-> StartThingRegistrationTask -> f StartThingRegistrationTask
startThingRegistrationTask_roleArn = (StartThingRegistrationTask -> Text)
-> (StartThingRegistrationTask
-> Text -> StartThingRegistrationTask)
-> Lens
StartThingRegistrationTask StartThingRegistrationTask Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartThingRegistrationTask' {Text
roleArn :: Text
$sel:roleArn:StartThingRegistrationTask' :: StartThingRegistrationTask -> Text
roleArn} -> Text
roleArn) (\s :: StartThingRegistrationTask
s@StartThingRegistrationTask' {} Text
a -> StartThingRegistrationTask
s {$sel:roleArn:StartThingRegistrationTask' :: Text
roleArn = Text
a} :: StartThingRegistrationTask)
instance Core.AWSRequest StartThingRegistrationTask where
type
AWSResponse StartThingRegistrationTask =
StartThingRegistrationTaskResponse
request :: StartThingRegistrationTask -> Request StartThingRegistrationTask
request = Service
-> StartThingRegistrationTask -> Request StartThingRegistrationTask
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StartThingRegistrationTask
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StartThingRegistrationTask)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StartThingRegistrationTask))
-> Logger
-> Service
-> Proxy StartThingRegistrationTask
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StartThingRegistrationTask)))
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 -> StartThingRegistrationTaskResponse
StartThingRegistrationTaskResponse'
(Maybe Text -> Int -> StartThingRegistrationTaskResponse)
-> Either String (Maybe Text)
-> Either String (Int -> StartThingRegistrationTaskResponse)
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
"taskId")
Either String (Int -> StartThingRegistrationTaskResponse)
-> Either String Int
-> Either String StartThingRegistrationTaskResponse
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 StartThingRegistrationTask
instance Prelude.NFData StartThingRegistrationTask
instance Core.ToHeaders StartThingRegistrationTask where
toHeaders :: StartThingRegistrationTask -> ResponseHeaders
toHeaders = ResponseHeaders -> StartThingRegistrationTask -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON StartThingRegistrationTask where
toJSON :: StartThingRegistrationTask -> Value
toJSON StartThingRegistrationTask' {Text
roleArn :: Text
inputFileKey :: Text
inputFileBucket :: Text
templateBody :: Text
$sel:roleArn:StartThingRegistrationTask' :: StartThingRegistrationTask -> Text
$sel:inputFileKey:StartThingRegistrationTask' :: StartThingRegistrationTask -> Text
$sel:inputFileBucket:StartThingRegistrationTask' :: StartThingRegistrationTask -> Text
$sel:templateBody:StartThingRegistrationTask' :: StartThingRegistrationTask -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ 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),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"inputFileBucket" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
inputFileBucket),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"inputFileKey" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
inputFileKey),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"roleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
roleArn)
]
)
instance Core.ToPath StartThingRegistrationTask where
toPath :: StartThingRegistrationTask -> ByteString
toPath = ByteString -> StartThingRegistrationTask -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/thing-registration-tasks"
instance Core.ToQuery StartThingRegistrationTask where
toQuery :: StartThingRegistrationTask -> QueryString
toQuery = QueryString -> StartThingRegistrationTask -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StartThingRegistrationTaskResponse = StartThingRegistrationTaskResponse'
{
StartThingRegistrationTaskResponse -> Maybe Text
taskId :: Prelude.Maybe Prelude.Text,
StartThingRegistrationTaskResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartThingRegistrationTaskResponse
-> StartThingRegistrationTaskResponse -> Bool
(StartThingRegistrationTaskResponse
-> StartThingRegistrationTaskResponse -> Bool)
-> (StartThingRegistrationTaskResponse
-> StartThingRegistrationTaskResponse -> Bool)
-> Eq StartThingRegistrationTaskResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartThingRegistrationTaskResponse
-> StartThingRegistrationTaskResponse -> Bool
$c/= :: StartThingRegistrationTaskResponse
-> StartThingRegistrationTaskResponse -> Bool
== :: StartThingRegistrationTaskResponse
-> StartThingRegistrationTaskResponse -> Bool
$c== :: StartThingRegistrationTaskResponse
-> StartThingRegistrationTaskResponse -> Bool
Prelude.Eq, ReadPrec [StartThingRegistrationTaskResponse]
ReadPrec StartThingRegistrationTaskResponse
Int -> ReadS StartThingRegistrationTaskResponse
ReadS [StartThingRegistrationTaskResponse]
(Int -> ReadS StartThingRegistrationTaskResponse)
-> ReadS [StartThingRegistrationTaskResponse]
-> ReadPrec StartThingRegistrationTaskResponse
-> ReadPrec [StartThingRegistrationTaskResponse]
-> Read StartThingRegistrationTaskResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartThingRegistrationTaskResponse]
$creadListPrec :: ReadPrec [StartThingRegistrationTaskResponse]
readPrec :: ReadPrec StartThingRegistrationTaskResponse
$creadPrec :: ReadPrec StartThingRegistrationTaskResponse
readList :: ReadS [StartThingRegistrationTaskResponse]
$creadList :: ReadS [StartThingRegistrationTaskResponse]
readsPrec :: Int -> ReadS StartThingRegistrationTaskResponse
$creadsPrec :: Int -> ReadS StartThingRegistrationTaskResponse
Prelude.Read, Int -> StartThingRegistrationTaskResponse -> ShowS
[StartThingRegistrationTaskResponse] -> ShowS
StartThingRegistrationTaskResponse -> String
(Int -> StartThingRegistrationTaskResponse -> ShowS)
-> (StartThingRegistrationTaskResponse -> String)
-> ([StartThingRegistrationTaskResponse] -> ShowS)
-> Show StartThingRegistrationTaskResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartThingRegistrationTaskResponse] -> ShowS
$cshowList :: [StartThingRegistrationTaskResponse] -> ShowS
show :: StartThingRegistrationTaskResponse -> String
$cshow :: StartThingRegistrationTaskResponse -> String
showsPrec :: Int -> StartThingRegistrationTaskResponse -> ShowS
$cshowsPrec :: Int -> StartThingRegistrationTaskResponse -> ShowS
Prelude.Show, (forall x.
StartThingRegistrationTaskResponse
-> Rep StartThingRegistrationTaskResponse x)
-> (forall x.
Rep StartThingRegistrationTaskResponse x
-> StartThingRegistrationTaskResponse)
-> Generic StartThingRegistrationTaskResponse
forall x.
Rep StartThingRegistrationTaskResponse x
-> StartThingRegistrationTaskResponse
forall x.
StartThingRegistrationTaskResponse
-> Rep StartThingRegistrationTaskResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartThingRegistrationTaskResponse x
-> StartThingRegistrationTaskResponse
$cfrom :: forall x.
StartThingRegistrationTaskResponse
-> Rep StartThingRegistrationTaskResponse x
Prelude.Generic)
newStartThingRegistrationTaskResponse ::
Prelude.Int ->
StartThingRegistrationTaskResponse
newStartThingRegistrationTaskResponse :: Int -> StartThingRegistrationTaskResponse
newStartThingRegistrationTaskResponse Int
pHttpStatus_ =
StartThingRegistrationTaskResponse' :: Maybe Text -> Int -> StartThingRegistrationTaskResponse
StartThingRegistrationTaskResponse'
{ $sel:taskId:StartThingRegistrationTaskResponse' :: Maybe Text
taskId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StartThingRegistrationTaskResponse' :: Int
httpStatus = Int
pHttpStatus_
}
startThingRegistrationTaskResponse_taskId :: Lens.Lens' StartThingRegistrationTaskResponse (Prelude.Maybe Prelude.Text)
startThingRegistrationTaskResponse_taskId :: (Maybe Text -> f (Maybe Text))
-> StartThingRegistrationTaskResponse
-> f StartThingRegistrationTaskResponse
startThingRegistrationTaskResponse_taskId = (StartThingRegistrationTaskResponse -> Maybe Text)
-> (StartThingRegistrationTaskResponse
-> Maybe Text -> StartThingRegistrationTaskResponse)
-> Lens
StartThingRegistrationTaskResponse
StartThingRegistrationTaskResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartThingRegistrationTaskResponse' {Maybe Text
taskId :: Maybe Text
$sel:taskId:StartThingRegistrationTaskResponse' :: StartThingRegistrationTaskResponse -> Maybe Text
taskId} -> Maybe Text
taskId) (\s :: StartThingRegistrationTaskResponse
s@StartThingRegistrationTaskResponse' {} Maybe Text
a -> StartThingRegistrationTaskResponse
s {$sel:taskId:StartThingRegistrationTaskResponse' :: Maybe Text
taskId = Maybe Text
a} :: StartThingRegistrationTaskResponse)
startThingRegistrationTaskResponse_httpStatus :: Lens.Lens' StartThingRegistrationTaskResponse Prelude.Int
startThingRegistrationTaskResponse_httpStatus :: (Int -> f Int)
-> StartThingRegistrationTaskResponse
-> f StartThingRegistrationTaskResponse
startThingRegistrationTaskResponse_httpStatus = (StartThingRegistrationTaskResponse -> Int)
-> (StartThingRegistrationTaskResponse
-> Int -> StartThingRegistrationTaskResponse)
-> Lens
StartThingRegistrationTaskResponse
StartThingRegistrationTaskResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartThingRegistrationTaskResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartThingRegistrationTaskResponse' :: StartThingRegistrationTaskResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartThingRegistrationTaskResponse
s@StartThingRegistrationTaskResponse' {} Int
a -> StartThingRegistrationTaskResponse
s {$sel:httpStatus:StartThingRegistrationTaskResponse' :: Int
httpStatus = Int
a} :: StartThingRegistrationTaskResponse)
instance
Prelude.NFData
StartThingRegistrationTaskResponse