{-# 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.Batch.CancelJob
(
cancelJob
, CancelJob
, cjJobId
, cjReason
, cancelJobResponse
, CancelJobResponse
, cjrsResponseStatus
) where
import Network.AWS.Batch.Types
import Network.AWS.Batch.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CancelJob = CancelJob'
{ _cjJobId :: !Text
, _cjReason :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
cancelJob
:: Text
-> Text
-> CancelJob
cancelJob pJobId_ pReason_ =
CancelJob' {_cjJobId = pJobId_, _cjReason = pReason_}
cjJobId :: Lens' CancelJob Text
cjJobId = lens _cjJobId (\ s a -> s{_cjJobId = a})
cjReason :: Lens' CancelJob Text
cjReason = lens _cjReason (\ s a -> s{_cjReason = a})
instance AWSRequest CancelJob where
type Rs CancelJob = CancelJobResponse
request = postJSON batch
response
= receiveEmpty
(\ s h x ->
CancelJobResponse' <$> (pure (fromEnum s)))
instance Hashable CancelJob where
instance NFData CancelJob where
instance ToHeaders CancelJob where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CancelJob where
toJSON CancelJob'{..}
= object
(catMaybes
[Just ("jobId" .= _cjJobId),
Just ("reason" .= _cjReason)])
instance ToPath CancelJob where
toPath = const "/v1/canceljob"
instance ToQuery CancelJob where
toQuery = const mempty
newtype CancelJobResponse = CancelJobResponse'
{ _cjrsResponseStatus :: Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
cancelJobResponse
:: Int
-> CancelJobResponse
cancelJobResponse pResponseStatus_ =
CancelJobResponse' {_cjrsResponseStatus = pResponseStatus_}
cjrsResponseStatus :: Lens' CancelJobResponse Int
cjrsResponseStatus = lens _cjrsResponseStatus (\ s a -> s{_cjrsResponseStatus = a})
instance NFData CancelJobResponse where