describeTasks method

Future<DescribeTasksResponse> describeTasks({
  1. required List<String> tasks,
  2. String? cluster,
  3. List<TaskField>? include,
})

Describes a specified task or tasks.

May throw ServerException. May throw ClientException. May throw InvalidParameterException. May throw ClusterNotFoundException.

Parameter tasks : A list of up to 100 task IDs or full ARN entries.

Parameter cluster : The short name or full Amazon Resource Name (ARN) of the cluster that hosts the task or tasks to describe. If you do not specify a cluster, the default cluster is assumed. This parameter is required if the task or tasks you are describing were launched in any cluster other than the default cluster.

Parameter include : Specifies whether you want to see the resource tags for the task. If TAGS is specified, the tags are included in the response. If this field is omitted, tags are not included in the response.

Implementation

Future<DescribeTasksResponse> describeTasks({
  required List<String> tasks,
  String? cluster,
  List<TaskField>? include,
}) async {
  ArgumentError.checkNotNull(tasks, 'tasks');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonEC2ContainerServiceV20141113.DescribeTasks'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'tasks': tasks,
      if (cluster != null) 'cluster': cluster,
      if (include != null)
        'include': include.map((e) => e.toValue()).toList(),
    },
  );

  return DescribeTasksResponse.fromJson(jsonResponse.body);
}