module Network.AWS.ECS.DescribeTasks
(
describeTasks
, DescribeTasks
, dtCluster
, dtTasks
, describeTasksResponse
, DescribeTasksResponse
, dtrsFailures
, dtrsTasks
, dtrsStatus
) 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 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 Sv DescribeTasks = ECS
type Rs DescribeTasks = DescribeTasksResponse
request = postJSON
response
= receiveJSON
(\ s h x ->
DescribeTasksResponse' <$>
(x .?> "failures" .!@ mempty) <*>
(x .?> "tasks" .!@ mempty)
<*> (pure (fromEnum s)))
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
["cluster" .= _dtCluster, "tasks" .= _dtTasks]
instance ToPath DescribeTasks where
toPath = const "/"
instance ToQuery DescribeTasks where
toQuery = const mempty
data DescribeTasksResponse = DescribeTasksResponse'
{ _dtrsFailures :: !(Maybe [Failure])
, _dtrsTasks :: !(Maybe [Task])
, _dtrsStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeTasksResponse
:: Int
-> DescribeTasksResponse
describeTasksResponse pStatus_ =
DescribeTasksResponse'
{ _dtrsFailures = Nothing
, _dtrsTasks = Nothing
, _dtrsStatus = pStatus_
}
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;
dtrsStatus :: Lens' DescribeTasksResponse Int
dtrsStatus = lens _dtrsStatus (\ s a -> s{_dtrsStatus = a});