describeClusters method

Future<DescribeClustersResponse> describeClusters({
  1. List<String>? clusters,
  2. List<ClusterField>? include,
})

Describes one or more of your clusters.

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

Parameter clusters : A list of up to 100 cluster names or full cluster Amazon Resource Name (ARN) entries. If you do not specify a cluster, the default cluster is assumed.

Parameter include : Whether to include additional information about your clusters in the response. If this field is omitted, the attachments, statistics, and tags are not included.

If ATTACHMENTS is specified, the attachments for the container instances or tasks within the cluster are included.

If SETTINGS is specified, the settings for the cluster are included.

If STATISTICS is specified, the following additional information, separated by launch type, is included:

  • runningEC2TasksCount
  • runningFargateTasksCount
  • pendingEC2TasksCount
  • pendingFargateTasksCount
  • activeEC2ServiceCount
  • activeFargateServiceCount
  • drainingEC2ServiceCount
  • drainingFargateServiceCount
If TAGS is specified, the metadata tags associated with the cluster are included.

Implementation

Future<DescribeClustersResponse> describeClusters({
  List<String>? clusters,
  List<ClusterField>? include,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonEC2ContainerServiceV20141113.DescribeClusters'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (clusters != null) 'clusters': clusters,
      if (include != null)
        'include': include.map((e) => e.toValue()).toList(),
    },
  );

  return DescribeClustersResponse.fromJson(jsonResponse.body);
}