listServiceDeployments method

Future<ListServiceDeploymentsResponse> listServiceDeployments({
  1. required String service,
  2. String? cluster,
  3. CreatedAt? createdAt,
  4. int? maxResults,
  5. String? nextToken,
  6. List<ServiceDeploymentStatus>? status,
})

This operation lists all the service deployments that meet the specified filter criteria.

A service deployment happens when you release a software update for the service. You route traffic from the running service revisions to the new service revison and control the number of running tasks.

This API returns the values that you use for the request parameters in DescribeServiceRevisions.

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

Parameter service : The ARN or name of the service

Parameter cluster : The cluster that hosts the service. This can either be the cluster name or ARN. Starting April 15, 2023, Amazon Web Services will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. If you don't specify a cluster, default is used.

Parameter createdAt : An optional filter you can use to narrow the results by the service creation date. If you do not specify a value, the result includes all services created before the current time. The format is yyyy-MM-dd HH:mm:ss.SSSSSS.

Parameter maxResults : The maximum number of service deployment results that ListServiceDeployments returned in paginated output. When this parameter is used, ListServiceDeployments only returns maxResults results in a single page along with a nextToken response element. The remaining results of the initial request can be seen by sending another ListServiceDeployments request with the returned nextToken value. This value can be between 1 and 100. If this parameter isn't used, then ListServiceDeployments returns up to 20 results and a nextToken value if applicable.

Parameter nextToken : The nextToken value returned from a ListServiceDeployments request indicating that more results are available to fulfill the request and further calls are needed. If you provided maxResults, it's possible the number of results is fewer than maxResults.

Parameter status : An optional filter you can use to narrow the results. If you do not specify a status, then all status values are included in the result.

Implementation

Future<ListServiceDeploymentsResponse> listServiceDeployments({
  required String service,
  String? cluster,
  CreatedAt? createdAt,
  int? maxResults,
  String? nextToken,
  List<ServiceDeploymentStatus>? status,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target':
        'AmazonEC2ContainerServiceV20141113.ListServiceDeployments'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'service': service,
      if (cluster != null) 'cluster': cluster,
      if (createdAt != null) 'createdAt': createdAt,
      if (maxResults != null) 'maxResults': maxResults,
      if (nextToken != null) 'nextToken': nextToken,
      if (status != null) 'status': status.map((e) => e.value).toList(),
    },
  );

  return ListServiceDeploymentsResponse.fromJson(jsonResponse.body);
}