describeAlarms method

Future<DescribeAlarmsOutput> describeAlarms({
  1. String? actionPrefix,
  2. String? alarmNamePrefix,
  3. List<String>? alarmNames,
  4. List<AlarmType>? alarmTypes,
  5. String? childrenOfAlarmName,
  6. int? maxRecords,
  7. String? nextToken,
  8. String? parentsOfAlarmName,
  9. StateValue? stateValue,
})

Retrieves the specified alarms. You can filter the results by specifying a prefix for the alarm name, the alarm state, or a prefix for any action.

May throw InvalidNextToken.

Parameter actionPrefix : Use this parameter to filter the results of the operation to only those alarms that use a certain alarm action. For example, you could specify the ARN of an SNS topic to find all alarms that send notifications to that topic.

Parameter alarmNamePrefix : An alarm name prefix. If you specify this parameter, you receive information about all alarms that have names that start with this prefix.

If this parameter is specified, you cannot specify AlarmNames.

Parameter alarmNames : The names of the alarms to retrieve information about.

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 childrenOfAlarmName : If you use this parameter and specify the name of a composite alarm, the operation returns information about the "children" alarms of the alarm you specify. These are the metric alarms and composite alarms referenced in the AlarmRule field of the composite alarm that you specify in ChildrenOfAlarmName. Information about the composite alarm that you name in ChildrenOfAlarmName is not returned.

If you specify ChildrenOfAlarmName, you cannot specify any other parameters in the request except for MaxRecords and NextToken. If you do so, you receive a validation error.

Parameter maxRecords : The maximum number of alarm descriptions to retrieve.

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

Parameter parentsOfAlarmName : If you use this parameter and specify the name of a metric or composite alarm, the operation returns information about the "parent" alarms of the alarm you specify. These are the composite alarms that have AlarmRule parameters that reference the alarm named in ParentsOfAlarmName. Information about the alarm that you specify in ParentsOfAlarmName is not returned.

If you specify ParentsOfAlarmName, you cannot specify any other parameters in the request except for MaxRecords and NextToken. If you do so, you receive a validation error.

Parameter stateValue : Specify this parameter to receive information only about alarms that are currently in the state that you specify.

Implementation

Future<DescribeAlarmsOutput> describeAlarms({
  String? actionPrefix,
  String? alarmNamePrefix,
  List<String>? alarmNames,
  List<AlarmType>? alarmTypes,
  String? childrenOfAlarmName,
  int? maxRecords,
  String? nextToken,
  String? parentsOfAlarmName,
  StateValue? stateValue,
}) async {
  _s.validateStringLength(
    'actionPrefix',
    actionPrefix,
    1,
    1024,
  );
  _s.validateStringLength(
    'alarmNamePrefix',
    alarmNamePrefix,
    1,
    255,
  );
  _s.validateStringLength(
    'childrenOfAlarmName',
    childrenOfAlarmName,
    1,
    255,
  );
  _s.validateNumRange(
    'maxRecords',
    maxRecords,
    1,
    100,
  );
  _s.validateStringLength(
    'parentsOfAlarmName',
    parentsOfAlarmName,
    1,
    255,
  );
  final $request = <String, dynamic>{};
  actionPrefix?.also((arg) => $request['ActionPrefix'] = arg);
  alarmNamePrefix?.also((arg) => $request['AlarmNamePrefix'] = arg);
  alarmNames?.also((arg) => $request['AlarmNames'] = arg);
  alarmTypes?.also(
      (arg) => $request['AlarmTypes'] = arg.map((e) => e.toValue()).toList());
  childrenOfAlarmName?.also((arg) => $request['ChildrenOfAlarmName'] = arg);
  maxRecords?.also((arg) => $request['MaxRecords'] = arg);
  nextToken?.also((arg) => $request['NextToken'] = arg);
  parentsOfAlarmName?.also((arg) => $request['ParentsOfAlarmName'] = arg);
  stateValue?.also((arg) => $request['StateValue'] = arg.toValue());
  final $result = await _protocol.send(
    $request,
    action: 'DescribeAlarms',
    version: '2010-08-01',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['DescribeAlarmsInput'],
    shapes: shapes,
    resultWrapper: 'DescribeAlarmsResult',
  );
  return DescribeAlarmsOutput.fromXml($result);
}