{-# 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.TerminateJob
(
terminateJob
, TerminateJob
, tjJobId
, tjReason
, terminateJobResponse
, TerminateJobResponse
, tjrsResponseStatus
) 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 TerminateJob = TerminateJob'
{ _tjJobId :: !Text
, _tjReason :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
terminateJob
:: Text
-> Text
-> TerminateJob
terminateJob pJobId_ pReason_ =
TerminateJob' {_tjJobId = pJobId_, _tjReason = pReason_}
tjJobId :: Lens' TerminateJob Text
tjJobId = lens _tjJobId (\ s a -> s{_tjJobId = a})
tjReason :: Lens' TerminateJob Text
tjReason = lens _tjReason (\ s a -> s{_tjReason = a})
instance AWSRequest TerminateJob where
type Rs TerminateJob = TerminateJobResponse
request = postJSON batch
response
= receiveEmpty
(\ s h x ->
TerminateJobResponse' <$> (pure (fromEnum s)))
instance Hashable TerminateJob where
instance NFData TerminateJob where
instance ToHeaders TerminateJob where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON TerminateJob where
toJSON TerminateJob'{..}
= object
(catMaybes
[Just ("jobId" .= _tjJobId),
Just ("reason" .= _tjReason)])
instance ToPath TerminateJob where
toPath = const "/v1/terminatejob"
instance ToQuery TerminateJob where
toQuery = const mempty
newtype TerminateJobResponse = TerminateJobResponse'
{ _tjrsResponseStatus :: Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
terminateJobResponse
:: Int
-> TerminateJobResponse
terminateJobResponse pResponseStatus_ =
TerminateJobResponse' {_tjrsResponseStatus = pResponseStatus_}
tjrsResponseStatus :: Lens' TerminateJobResponse Int
tjrsResponseStatus = lens _tjrsResponseStatus (\ s a -> s{_tjrsResponseStatus = a})
instance NFData TerminateJobResponse where