{-# 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.DescribeTasks
(
describeTasks
, DescribeTasks
, dtCluster
, dtTasks
, describeTasksResponse
, DescribeTasksResponse
, dtrsFailures
, dtrsTasks
, dtrsResponseStatus
) 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 DescribeTasks = DescribeTasks'
{ _dtCluster :: !(Maybe Text)
, _dtTasks :: ![Text]
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeTasks
:: DescribeTasks
describeTasks =
DescribeTasks'
{ _dtCluster = Nothing
, _dtTasks = mempty
}
dtCluster :: Lens' DescribeTasks (Maybe Text)
dtCluster = lens _dtCluster (\ s a -> s{_dtCluster = a});
dtTasks :: Lens' DescribeTasks [Text]
dtTasks = lens _dtTasks (\ s a -> s{_dtTasks = a}) . _Coerce;
instance AWSRequest DescribeTasks where
type Rs DescribeTasks = DescribeTasksResponse
request = postJSON ecs
response
= receiveJSON
(\ s h x ->
DescribeTasksResponse' <$>
(x .?> "failures" .!@ mempty) <*>
(x .?> "tasks" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable DescribeTasks
instance NFData DescribeTasks
instance ToHeaders DescribeTasks where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonEC2ContainerServiceV20141113.DescribeTasks"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON DescribeTasks where
toJSON DescribeTasks'{..}
= object
(catMaybes
[("cluster" .=) <$> _dtCluster,
Just ("tasks" .= _dtTasks)])
instance ToPath DescribeTasks where
toPath = const "/"
instance ToQuery DescribeTasks where
toQuery = const mempty
data DescribeTasksResponse = DescribeTasksResponse'
{ _dtrsFailures :: !(Maybe [Failure])
, _dtrsTasks :: !(Maybe [Task])
, _dtrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeTasksResponse
:: Int
-> DescribeTasksResponse
describeTasksResponse pResponseStatus_ =
DescribeTasksResponse'
{ _dtrsFailures = Nothing
, _dtrsTasks = Nothing
, _dtrsResponseStatus = pResponseStatus_
}
dtrsFailures :: Lens' DescribeTasksResponse [Failure]
dtrsFailures = lens _dtrsFailures (\ s a -> s{_dtrsFailures = a}) . _Default . _Coerce;
dtrsTasks :: Lens' DescribeTasksResponse [Task]
dtrsTasks = lens _dtrsTasks (\ s a -> s{_dtrsTasks = a}) . _Default . _Coerce;
dtrsResponseStatus :: Lens' DescribeTasksResponse Int
dtrsResponseStatus = lens _dtrsResponseStatus (\ s a -> s{_dtrsResponseStatus = a});
instance NFData DescribeTasksResponse