module Network.AWS.ECS.StopTask
(
stopTask
, StopTask
, stCluster
, stTask
, stopTaskResponse
, StopTaskResponse
, srsTask
, srsStatus
) where
import Network.AWS.ECS.Types
import Network.AWS.ECS.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data StopTask = StopTask'
{ _stCluster :: !(Maybe Text)
, _stTask :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
stopTask
:: Text
-> StopTask
stopTask pTask_ =
StopTask'
{ _stCluster = Nothing
, _stTask = pTask_
}
stCluster :: Lens' StopTask (Maybe Text)
stCluster = lens _stCluster (\ s a -> s{_stCluster = 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 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,
Just ("task" .= _stTask)])
instance ToPath StopTask where
toPath = const "/"
instance ToQuery StopTask where
toQuery = const mempty
data StopTaskResponse = StopTaskResponse'
{ _srsTask :: !(Maybe Task)
, _srsStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
stopTaskResponse
:: Int
-> StopTaskResponse
stopTaskResponse pStatus_ =
StopTaskResponse'
{ _srsTask = Nothing
, _srsStatus = pStatus_
}
srsTask :: Lens' StopTaskResponse (Maybe Task)
srsTask = lens _srsTask (\ s a -> s{_srsTask = a});
srsStatus :: Lens' StopTaskResponse Int
srsStatus = lens _srsStatus (\ s a -> s{_srsStatus = a});