{-# 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.ECS.StopTask
(
stopTask
, StopTask
, stCluster
, stReason
, stTask
, stopTaskResponse
, StopTaskResponse
, srsTask
, srsResponseStatus
) where
import Network.AWS.ECS.Types
import Network.AWS.ECS.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data StopTask = StopTask'
{ _stCluster :: !(Maybe Text)
, _stReason :: !(Maybe Text)
, _stTask :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
stopTask
:: Text
-> StopTask
stopTask pTask_ =
StopTask'
{ _stCluster = Nothing
, _stReason = Nothing
, _stTask = pTask_
}
stCluster :: Lens' StopTask (Maybe Text)
stCluster = lens _stCluster (\ s a -> s{_stCluster = a});
stReason :: Lens' StopTask (Maybe Text)
stReason = lens _stReason (\ s a -> s{_stReason = a});
stTask :: Lens' StopTask Text
stTask = lens _stTask (\ s a -> s{_stTask = a});
instance AWSRequest StopTask where
type Rs StopTask = StopTaskResponse
request = postJSON ecs
response
= receiveJSON
(\ s h x ->
StopTaskResponse' <$>
(x .?> "task") <*> (pure (fromEnum s)))
instance Hashable StopTask
instance NFData StopTask
instance ToHeaders StopTask where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonEC2ContainerServiceV20141113.StopTask" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON StopTask where
toJSON StopTask'{..}
= object
(catMaybes
[("cluster" .=) <$> _stCluster,
("reason" .=) <$> _stReason,
Just ("task" .= _stTask)])
instance ToPath StopTask where
toPath = const "/"
instance ToQuery StopTask where
toQuery = const mempty
data StopTaskResponse = StopTaskResponse'
{ _srsTask :: !(Maybe Task)
, _srsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
stopTaskResponse
:: Int
-> StopTaskResponse
stopTaskResponse pResponseStatus_ =
StopTaskResponse'
{ _srsTask = Nothing
, _srsResponseStatus = pResponseStatus_
}
srsTask :: Lens' StopTaskResponse (Maybe Task)
srsTask = lens _srsTask (\ s a -> s{_srsTask = a});
srsResponseStatus :: Lens' StopTaskResponse Int
srsResponseStatus = lens _srsResponseStatus (\ s a -> s{_srsResponseStatus = a});
instance NFData StopTaskResponse