listClusterNodes method

Future<ListClusterNodesResponse> listClusterNodes({
  1. required String clusterName,
  2. DateTime? creationTimeAfter,
  3. DateTime? creationTimeBefore,
  4. bool? includeNodeLogicalIds,
  5. String? instanceGroupNameContains,
  6. int? maxResults,
  7. String? nextToken,
  8. ClusterSortBy? sortBy,
  9. SortOrder? sortOrder,
})

Retrieves the list of instances (also called nodes interchangeably) in a SageMaker HyperPod cluster.

May throw ResourceNotFound.

Parameter clusterName : The string name or the Amazon Resource Name (ARN) of the SageMaker HyperPod cluster in which you want to retrieve the list of nodes.

Parameter creationTimeAfter : A filter that returns nodes in a SageMaker HyperPod cluster created after the specified time. 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 : 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 includeNodeLogicalIds : Specifies whether to include nodes that are still being provisioned in the response. When set to true, the response includes all nodes regardless of their provisioning status. When set to False (default), only nodes with assigned InstanceIds are returned.

Parameter instanceGroupNameContains : A filter that returns the instance groups whose name contain a specified string.

Parameter maxResults : The maximum number of nodes to return in the response.

Parameter nextToken : If the result of the previous ListClusterNodes request was truncated, the response includes a NextToken. To retrieve the next set of cluster nodes, use the token in the next request.

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.

Implementation

Future<ListClusterNodesResponse> listClusterNodes({
  required String clusterName,
  DateTime? creationTimeAfter,
  DateTime? creationTimeBefore,
  bool? includeNodeLogicalIds,
  String? instanceGroupNameContains,
  int? maxResults,
  String? nextToken,
  ClusterSortBy? sortBy,
  SortOrder? sortOrder,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.ListClusterNodes'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ClusterName': clusterName,
      if (creationTimeAfter != null)
        'CreationTimeAfter': unixTimestampToJson(creationTimeAfter),
      if (creationTimeBefore != null)
        'CreationTimeBefore': unixTimestampToJson(creationTimeBefore),
      if (includeNodeLogicalIds != null)
        'IncludeNodeLogicalIds': includeNodeLogicalIds,
      if (instanceGroupNameContains != null)
        'InstanceGroupNameContains': instanceGroupNameContains,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (sortBy != null) 'SortBy': sortBy.value,
      if (sortOrder != null) 'SortOrder': sortOrder.value,
    },
  );

  return ListClusterNodesResponse.fromJson(jsonResponse.body);
}