{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.IoT.StartThingRegistrationTask
(
startThingRegistrationTask
, StartThingRegistrationTask
, strtTemplateBody
, strtInputFileBucket
, strtInputFileKey
, strtRoleARN
, startThingRegistrationTaskResponse
, StartThingRegistrationTaskResponse
, strtrsTaskId
, strtrsResponseStatus
) where
import Network.AWS.IoT.Types
import Network.AWS.IoT.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data StartThingRegistrationTask = StartThingRegistrationTask'
{ _strtTemplateBody :: !Text
, _strtInputFileBucket :: !Text
, _strtInputFileKey :: !Text
, _strtRoleARN :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
startThingRegistrationTask
:: Text
-> Text
-> Text
-> Text
-> StartThingRegistrationTask
startThingRegistrationTask pTemplateBody_ pInputFileBucket_ pInputFileKey_ pRoleARN_ =
StartThingRegistrationTask'
{ _strtTemplateBody = pTemplateBody_
, _strtInputFileBucket = pInputFileBucket_
, _strtInputFileKey = pInputFileKey_
, _strtRoleARN = pRoleARN_
}
strtTemplateBody :: Lens' StartThingRegistrationTask Text
strtTemplateBody = lens _strtTemplateBody (\ s a -> s{_strtTemplateBody = a})
strtInputFileBucket :: Lens' StartThingRegistrationTask Text
strtInputFileBucket = lens _strtInputFileBucket (\ s a -> s{_strtInputFileBucket = a})
strtInputFileKey :: Lens' StartThingRegistrationTask Text
strtInputFileKey = lens _strtInputFileKey (\ s a -> s{_strtInputFileKey = a})
strtRoleARN :: Lens' StartThingRegistrationTask Text
strtRoleARN = lens _strtRoleARN (\ s a -> s{_strtRoleARN = a})
instance AWSRequest StartThingRegistrationTask where
type Rs StartThingRegistrationTask =
StartThingRegistrationTaskResponse
request = postJSON ioT
response
= receiveJSON
(\ s h x ->
StartThingRegistrationTaskResponse' <$>
(x .?> "taskId") <*> (pure (fromEnum s)))
instance Hashable StartThingRegistrationTask where
instance NFData StartThingRegistrationTask where
instance ToHeaders StartThingRegistrationTask where
toHeaders = const mempty
instance ToJSON StartThingRegistrationTask where
toJSON StartThingRegistrationTask'{..}
= object
(catMaybes
[Just ("templateBody" .= _strtTemplateBody),
Just ("inputFileBucket" .= _strtInputFileBucket),
Just ("inputFileKey" .= _strtInputFileKey),
Just ("roleArn" .= _strtRoleARN)])
instance ToPath StartThingRegistrationTask where
toPath = const "/thing-registration-tasks"
instance ToQuery StartThingRegistrationTask where
toQuery = const mempty
data StartThingRegistrationTaskResponse = StartThingRegistrationTaskResponse'
{ _strtrsTaskId :: !(Maybe Text)
, _strtrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
startThingRegistrationTaskResponse
:: Int
-> StartThingRegistrationTaskResponse
startThingRegistrationTaskResponse pResponseStatus_ =
StartThingRegistrationTaskResponse'
{_strtrsTaskId = Nothing, _strtrsResponseStatus = pResponseStatus_}
strtrsTaskId :: Lens' StartThingRegistrationTaskResponse (Maybe Text)
strtrsTaskId = lens _strtrsTaskId (\ s a -> s{_strtrsTaskId = a})
strtrsResponseStatus :: Lens' StartThingRegistrationTaskResponse Int
strtrsResponseStatus = lens _strtrsResponseStatus (\ s a -> s{_strtrsResponseStatus = a})
instance NFData StartThingRegistrationTaskResponse
where