listClusters method

Future<ListClustersResponse> listClusters({
  1. DateTime? creationTimeAfter,
  2. DateTime? creationTimeBefore,
  3. int? maxResults,
  4. String? nameContains,
  5. String? nextToken,
  6. ClusterSortBy? sortBy,
  7. SortOrder? sortOrder,
  8. String? trainingPlanArn,
})

Retrieves the list of SageMaker HyperPod clusters.

Parameter creationTimeAfter : Set a start time for the time range during which you want to list SageMaker HyperPod clusters. Timestamps are formatted according to the ISO 8601 standard.

Acceptable formats include:

  • YYYY-MM-DDThh:mm:ss.sssTZD (UTC), for example, 2014-10-01T20:30:00.000Z
  • YYYY-MM-DDThh:mm:ss.sssTZD (with offset), for example, 2014-10-01T12:30:00.000-08:00
  • YYYY-MM-DD, for example, 2014-10-01
  • Unix time in seconds, for example, 1412195400. This is also referred to as Unix Epoch time and represents the number of seconds since midnight, January 1, 1970 UTC.
For more information about the timestamp format, see Timestamp in the Amazon Web Services Command Line Interface User Guide.

Parameter creationTimeBefore : Set an end time for the time range during which you want to list SageMaker HyperPod clusters. A filter that returns nodes in a SageMaker HyperPod cluster created before the specified time. The acceptable formats are the same as the timestamp formats for CreationTimeAfter. For more information about the timestamp format, see Timestamp in the Amazon Web Services Command Line Interface User Guide.

Parameter maxResults : Specifies the maximum number of clusters to evaluate for the operation (not necessarily the number of matching items). After SageMaker processes the number of clusters up to MaxResults, it stops the operation and returns the matching clusters up to that point. If all the matching clusters are desired, SageMaker will go through all the clusters until NextToken is empty.

Parameter nameContains : Set the maximum number of instances to print in the list.

Parameter nextToken : Set the next token to retrieve the list of SageMaker HyperPod clusters.

Parameter sortBy : The field by which to sort results. The default value is CREATION_TIME.

Parameter sortOrder : The sort order for results. The default value is Ascending.

Parameter trainingPlanArn : The Amazon Resource Name (ARN); of the training plan to filter clusters by. For more information about reserving GPU capacity for your SageMaker HyperPod clusters using Amazon SageMaker Training Plan, see CreateTrainingPlan .

Implementation

Future<ListClustersResponse> listClusters({
  DateTime? creationTimeAfter,
  DateTime? creationTimeBefore,
  int? maxResults,
  String? nameContains,
  String? nextToken,
  ClusterSortBy? sortBy,
  SortOrder? sortOrder,
  String? trainingPlanArn,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.ListClusters'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (creationTimeAfter != null)
        'CreationTimeAfter': unixTimestampToJson(creationTimeAfter),
      if (creationTimeBefore != null)
        'CreationTimeBefore': unixTimestampToJson(creationTimeBefore),
      if (maxResults != null) 'MaxResults': maxResults,
      if (nameContains != null) 'NameContains': nameContains,
      if (nextToken != null) 'NextToken': nextToken,
      if (sortBy != null) 'SortBy': sortBy.value,
      if (sortOrder != null) 'SortOrder': sortOrder.value,
      if (trainingPlanArn != null) 'TrainingPlanArn': trainingPlanArn,
    },
  );

  return ListClustersResponse.fromJson(jsonResponse.body);
}