listMonitoringAlertHistory method

Future<ListMonitoringAlertHistoryResponse> listMonitoringAlertHistory({
  1. DateTime? creationTimeAfter,
  2. DateTime? creationTimeBefore,
  3. int? maxResults,
  4. String? monitoringAlertName,
  5. String? monitoringScheduleName,
  6. String? nextToken,
  7. MonitoringAlertHistorySortKey? sortBy,
  8. SortOrder? sortOrder,
  9. MonitoringAlertStatus? statusEquals,
})

Gets a list of past alerts in a model monitoring schedule.

May throw ResourceNotFound.

Parameter creationTimeAfter : A filter that returns only alerts created on or after the specified time.

Parameter creationTimeBefore : A filter that returns only alerts created on or before the specified time.

Parameter maxResults : The maximum number of results to display. The default is 100.

Parameter monitoringAlertName : The name of a monitoring alert.

Parameter monitoringScheduleName : The name of a monitoring schedule.

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

Parameter sortBy : The field used to sort results. The default is CreationTime.

Parameter sortOrder : The sort order, whether Ascending or Descending, of the alert history. The default is Descending.

Parameter statusEquals : A filter that retrieves only alerts with a specific status.

Implementation

Future<ListMonitoringAlertHistoryResponse> listMonitoringAlertHistory({
  DateTime? creationTimeAfter,
  DateTime? creationTimeBefore,
  int? maxResults,
  String? monitoringAlertName,
  String? monitoringScheduleName,
  String? nextToken,
  MonitoringAlertHistorySortKey? sortBy,
  SortOrder? sortOrder,
  MonitoringAlertStatus? statusEquals,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.ListMonitoringAlertHistory'
  };
  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 (monitoringAlertName != null)
        'MonitoringAlertName': monitoringAlertName,
      if (monitoringScheduleName != null)
        'MonitoringScheduleName': monitoringScheduleName,
      if (nextToken != null) 'NextToken': nextToken,
      if (sortBy != null) 'SortBy': sortBy.value,
      if (sortOrder != null) 'SortOrder': sortOrder.value,
      if (statusEquals != null) 'StatusEquals': statusEquals.value,
    },
  );

  return ListMonitoringAlertHistoryResponse.fromJson(jsonResponse.body);
}