{-# 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.CancelJob
(
cancelJob
, CancelJob
, cComment
, cJobId
, cancelJobResponse
, CancelJobResponse
, crsJobId
, crsJobARN
, crsDescription
, crsResponseStatus
) 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 CancelJob = CancelJob'
{ _cComment :: !(Maybe Text)
, _cJobId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
cancelJob
:: Text
-> CancelJob
cancelJob pJobId_ = CancelJob' {_cComment = Nothing, _cJobId = pJobId_}
cComment :: Lens' CancelJob (Maybe Text)
cComment = lens _cComment (\ s a -> s{_cComment = a})
cJobId :: Lens' CancelJob Text
cJobId = lens _cJobId (\ s a -> s{_cJobId = a})
instance AWSRequest CancelJob where
type Rs CancelJob = CancelJobResponse
request = putJSON ioT
response
= receiveJSON
(\ s h x ->
CancelJobResponse' <$>
(x .?> "jobId") <*> (x .?> "jobArn") <*>
(x .?> "description")
<*> (pure (fromEnum s)))
instance Hashable CancelJob where
instance NFData CancelJob where
instance ToHeaders CancelJob where
toHeaders = const mempty
instance ToJSON CancelJob where
toJSON CancelJob'{..}
= object (catMaybes [("comment" .=) <$> _cComment])
instance ToPath CancelJob where
toPath CancelJob'{..}
= mconcat ["/jobs/", toBS _cJobId, "/cancel"]
instance ToQuery CancelJob where
toQuery = const mempty
data CancelJobResponse = CancelJobResponse'
{ _crsJobId :: !(Maybe Text)
, _crsJobARN :: !(Maybe Text)
, _crsDescription :: !(Maybe Text)
, _crsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
cancelJobResponse
:: Int
-> CancelJobResponse
cancelJobResponse pResponseStatus_ =
CancelJobResponse'
{ _crsJobId = Nothing
, _crsJobARN = Nothing
, _crsDescription = Nothing
, _crsResponseStatus = pResponseStatus_
}
crsJobId :: Lens' CancelJobResponse (Maybe Text)
crsJobId = lens _crsJobId (\ s a -> s{_crsJobId = a})
crsJobARN :: Lens' CancelJobResponse (Maybe Text)
crsJobARN = lens _crsJobARN (\ s a -> s{_crsJobARN = a})
crsDescription :: Lens' CancelJobResponse (Maybe Text)
crsDescription = lens _crsDescription (\ s a -> s{_crsDescription = a})
crsResponseStatus :: Lens' CancelJobResponse Int
crsResponseStatus = lens _crsResponseStatus (\ s a -> s{_crsResponseStatus = a})
instance NFData CancelJobResponse where