listAlarmMuteRules method

Future<ListAlarmMuteRulesOutput> listAlarmMuteRules({
  1. String? alarmName,
  2. int? maxRecords,
  3. String? nextToken,
  4. List<AlarmMuteRuleStatus>? statuses,
})

Lists alarm mute rules in your Amazon Web Services account and region.

You can filter the results by alarm name to find all mute rules targeting a specific alarm, or by status to find rules that are scheduled, active, or expired.

This operation supports pagination for accounts with many mute rules. Use the MaxRecords and NextToken parameters to retrieve results in multiple calls.

Permissions

To list mute rules, you need the cloudwatch:ListAlarmMuteRules permission.

May throw InvalidNextToken. May throw ResourceNotFoundException.

Parameter alarmName : Filter results to show only mute rules that target the specified alarm name.

Parameter maxRecords : The maximum number of mute rules to return in one call. The default is 50.

Parameter nextToken : The token returned from a previous call to indicate where to continue retrieving results.

Parameter statuses : Filter results to show only mute rules with the specified statuses. Valid values are SCHEDULED, ACTIVE, or EXPIRED.

Implementation

Future<ListAlarmMuteRulesOutput> listAlarmMuteRules({
  String? alarmName,
  int? maxRecords,
  String? nextToken,
  List<AlarmMuteRuleStatus>? statuses,
}) async {
  _s.validateNumRange(
    'maxRecords',
    maxRecords,
    1,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'GraniteServiceVersion20100801.ListAlarmMuteRules'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (alarmName != null) 'AlarmName': alarmName,
      if (maxRecords != null) 'MaxRecords': maxRecords,
      if (nextToken != null) 'NextToken': nextToken,
      if (statuses != null) 'Statuses': statuses.map((e) => e.value).toList(),
    },
  );

  return ListAlarmMuteRulesOutput.fromJson(jsonResponse.body);
}