listClusterEvents method

Future<ListClusterEventsResponse> listClusterEvents({
  1. required String clusterName,
  2. DateTime? eventTimeAfter,
  3. DateTime? eventTimeBefore,
  4. String? instanceGroupName,
  5. int? maxResults,
  6. String? nextToken,
  7. String? nodeId,
  8. ClusterEventResourceType? resourceType,
  9. EventSortBy? sortBy,
  10. SortOrder? sortOrder,
})

Retrieves a list of event summaries for a specified HyperPod cluster. The operation supports filtering, sorting, and pagination of results. This functionality is only supported when the NodeProvisioningMode is set to Continuous.

May throw ResourceNotFound.

Parameter clusterName : The name or Amazon Resource Name (ARN) of the HyperPod cluster for which to list events.

Parameter eventTimeAfter : The start of the time range for filtering events. Only events that occurred after this time are included in the results.

Parameter eventTimeBefore : The end of the time range for filtering events. Only events that occurred before this time are included in the results.

Parameter instanceGroupName : The name of the instance group to filter events. If specified, only events related to this instance group are returned.

Parameter maxResults : The maximum number of events to return in the response. Valid range is 1 to 100.

Parameter nextToken : A token to retrieve the next set of results. This token is obtained from the output of a previous ListClusterEvents call.

Parameter nodeId : The EC2 instance ID to filter events. If specified, only events related to this instance are returned.

Parameter resourceType : The type of resource for which to filter events. Valid values are Cluster, InstanceGroup, or Instance.

Parameter sortBy : The field to use for sorting the event list. Currently, the only supported value is EventTime.

Parameter sortOrder : The order in which to sort the results. Valid values are Ascending or Descending (the default is Descending).

Implementation

Future<ListClusterEventsResponse> listClusterEvents({
  required String clusterName,
  DateTime? eventTimeAfter,
  DateTime? eventTimeBefore,
  String? instanceGroupName,
  int? maxResults,
  String? nextToken,
  String? nodeId,
  ClusterEventResourceType? resourceType,
  EventSortBy? 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.ListClusterEvents'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ClusterName': clusterName,
      if (eventTimeAfter != null)
        'EventTimeAfter': unixTimestampToJson(eventTimeAfter),
      if (eventTimeBefore != null)
        'EventTimeBefore': unixTimestampToJson(eventTimeBefore),
      if (instanceGroupName != null) 'InstanceGroupName': instanceGroupName,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (nodeId != null) 'NodeId': nodeId,
      if (resourceType != null) 'ResourceType': resourceType.value,
      if (sortBy != null) 'SortBy': sortBy.value,
      if (sortOrder != null) 'SortOrder': sortOrder.value,
    },
  );

  return ListClusterEventsResponse.fromJson(jsonResponse.body);
}