describeContainerInstances method

Future<DescribeContainerInstancesResponse> describeContainerInstances({
  1. required List<String> containerInstances,
  2. String? cluster,
  3. List<ContainerInstanceField>? include,
})

Describes one or more container instances. Returns metadata about each container instance requested.

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

Parameter containerInstances : A list of up to 100 container instance IDs or full Amazon Resource Name (ARN) entries.

Parameter cluster : The short name or full Amazon Resource Name (ARN) of the cluster that hosts the container instances to describe. If you do not specify a cluster, the default cluster is assumed. This parameter is required if the container instance or container instances 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 container instance. If TAGS is specified, the tags are included in the response. If CONTAINER_INSTANCE_HEALTH is specified, the container instance health is included in the response. If this field is omitted, tags and container instance health status aren't included in the response.

Implementation

Future<DescribeContainerInstancesResponse> describeContainerInstances({
  required List<String> containerInstances,
  String? cluster,
  List<ContainerInstanceField>? include,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target':
        'AmazonEC2ContainerServiceV20141113.DescribeContainerInstances'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'containerInstances': containerInstances,
      if (cluster != null) 'cluster': cluster,
      if (include != null) 'include': include.map((e) => e.value).toList(),
    },
  );

  return DescribeContainerInstancesResponse.fromJson(jsonResponse.body);
}