describeAlarmHistory method

Future<DescribeAlarmHistoryOutput> describeAlarmHistory({
  1. String? alarmName,
  2. List<AlarmType>? alarmTypes,
  3. DateTime? endDate,
  4. HistoryItemType? historyItemType,
  5. int? maxRecords,
  6. String? nextToken,
  7. ScanBy? scanBy,
  8. DateTime? startDate,
})

Retrieves the history for the specified alarm. You can filter the results by date range or item type. If an alarm name is not specified, the histories for either all metric alarms or all composite alarms are returned.

CloudWatch retains the history of an alarm even if you delete the alarm.

May throw InvalidNextToken.

Parameter alarmName : The name of the alarm.

Parameter alarmTypes : Use this parameter to specify whether you want the operation to return metric alarms or composite alarms. If you omit this parameter, only metric alarms are returned.

Parameter endDate : The ending date to retrieve alarm history.

Parameter historyItemType : The type of alarm histories to retrieve.

Parameter maxRecords : The maximum number of alarm history records to retrieve.

Parameter nextToken : The token returned by a previous call to indicate that there is more data available.

Parameter scanBy : Specified whether to return the newest or oldest alarm history first. Specify TimestampDescending to have the newest event history returned first, and specify TimestampAscending to have the oldest history returned first.

Parameter startDate : The starting date to retrieve alarm history.

Implementation

Future<DescribeAlarmHistoryOutput> describeAlarmHistory({
  String? alarmName,
  List<AlarmType>? alarmTypes,
  DateTime? endDate,
  HistoryItemType? historyItemType,
  int? maxRecords,
  String? nextToken,
  ScanBy? scanBy,
  DateTime? startDate,
}) async {
  _s.validateStringLength(
    'alarmName',
    alarmName,
    1,
    255,
  );
  _s.validateNumRange(
    'maxRecords',
    maxRecords,
    1,
    100,
  );
  final $request = <String, dynamic>{};
  alarmName?.also((arg) => $request['AlarmName'] = arg);
  alarmTypes?.also(
      (arg) => $request['AlarmTypes'] = arg.map((e) => e.toValue()).toList());
  endDate?.also((arg) => $request['EndDate'] = _s.iso8601ToJson(arg));
  historyItemType?.also((arg) => $request['HistoryItemType'] = arg.toValue());
  maxRecords?.also((arg) => $request['MaxRecords'] = arg);
  nextToken?.also((arg) => $request['NextToken'] = arg);
  scanBy?.also((arg) => $request['ScanBy'] = arg.toValue());
  startDate?.also((arg) => $request['StartDate'] = _s.iso8601ToJson(arg));
  final $result = await _protocol.send(
    $request,
    action: 'DescribeAlarmHistory',
    version: '2010-08-01',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['DescribeAlarmHistoryInput'],
    shapes: shapes,
    resultWrapper: 'DescribeAlarmHistoryResult',
  );
  return DescribeAlarmHistoryOutput.fromXml($result);
}