describeEcsClusters method

Future<DescribeEcsClustersResult> describeEcsClusters({
  1. List<String>? ecsClusterArns,
  2. int? maxResults,
  3. String? nextToken,
  4. String? stackId,
})

Describes Amazon ECS clusters that are registered with a stack. If you specify only a stack ID, you can use the MaxResults and NextToken parameters to paginate the response. However, AWS OpsWorks Stacks currently supports only one cluster per layer, so the result set has a maximum of one element.

Required Permissions: To use this action, an IAM user must have a Show, Deploy, or Manage permissions level for the stack or an attached policy that explicitly grants permission. For more information about user permissions, see Managing User Permissions.

This call accepts only one resource-identifying parameter.

May throw ValidationException. May throw ResourceNotFoundException.

Parameter ecsClusterArns : A list of ARNs, one for each cluster to be described.

Parameter maxResults : To receive a paginated response, use this parameter to specify the maximum number of results to be returned with a single call. If the number of available results exceeds this maximum, the response includes a NextToken value that you can assign to the NextToken request parameter to get the next set of results.

Parameter nextToken : If the previous paginated request did not return all of the remaining results, the response object'sNextToken parameter value is set to a token. To retrieve the next set of results, call DescribeEcsClusters again and assign that token to the request object's NextToken parameter. If there are no remaining results, the previous response object's NextToken parameter is set to null.

Parameter stackId : A stack ID. DescribeEcsClusters returns a description of the cluster that is registered with the stack.

Implementation

Future<DescribeEcsClustersResult> describeEcsClusters({
  List<String>? ecsClusterArns,
  int? maxResults,
  String? nextToken,
  String? stackId,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'OpsWorks_20130218.DescribeEcsClusters'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (ecsClusterArns != null) 'EcsClusterArns': ecsClusterArns,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (stackId != null) 'StackId': stackId,
    },
  );

  return DescribeEcsClustersResult.fromJson(jsonResponse.body);
}