listServices method

Future<ListServicesResponse> listServices({
  1. String? cluster,
  2. LaunchType? launchType,
  3. int? maxResults,
  4. String? nextToken,
  5. SchedulingStrategy? schedulingStrategy,
})

Lists the services that are running in a specified cluster.

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

Parameter cluster : The short name or full Amazon Resource Name (ARN) of the cluster that hosts the services to list. If you do not specify a cluster, the default cluster is assumed.

Parameter launchType : The launch type for the services to list.

Parameter maxResults : The maximum number of service results returned by ListServices in paginated output. When this parameter is used, ListServices 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 ListServices request with the returned nextToken value. This value can be between 1 and 100. If this parameter is not used, then ListServices returns up to 10 results and a nextToken value if applicable.

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

Parameter schedulingStrategy : The scheduling strategy for services to list.

Implementation

Future<ListServicesResponse> listServices({
  String? cluster,
  LaunchType? launchType,
  int? maxResults,
  String? nextToken,
  SchedulingStrategy? schedulingStrategy,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonEC2ContainerServiceV20141113.ListServices'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (cluster != null) 'cluster': cluster,
      if (launchType != null) 'launchType': launchType.toValue(),
      if (maxResults != null) 'maxResults': maxResults,
      if (nextToken != null) 'nextToken': nextToken,
      if (schedulingStrategy != null)
        'schedulingStrategy': schedulingStrategy.toValue(),
    },
  );

  return ListServicesResponse.fromJson(jsonResponse.body);
}