updateAlarmModel method

Future<UpdateAlarmModelResponse> updateAlarmModel({
  1. required String alarmModelName,
  2. required AlarmRule alarmRule,
  3. required String roleArn,
  4. AlarmCapabilities? alarmCapabilities,
  5. AlarmEventActions? alarmEventActions,
  6. String? alarmModelDescription,
  7. AlarmNotification? alarmNotification,
  8. int? severity,
})

Updates an alarm model. Any alarms that were created based on the previous version are deleted and then created again as new data arrives.

May throw InternalFailureException. May throw InvalidRequestException. May throw ResourceInUseException. May throw ResourceNotFoundException. May throw ServiceUnavailableException. May throw ThrottlingException.

Parameter alarmModelName : The name of the alarm model.

Parameter alarmRule : Defines when your alarm is invoked.

Parameter roleArn : The ARN of the IAM role that allows the alarm to perform actions and access AWS resources. For more information, see Amazon Resource Names (ARNs) in the AWS General Reference.

Parameter alarmCapabilities : Contains the configuration information of alarm state changes.

Parameter alarmEventActions : Contains information about one or more alarm actions.

Parameter alarmModelDescription : The description of the alarm model.

Parameter alarmNotification : Contains information about one or more notification actions.

Parameter severity : A non-negative integer that reflects the severity level of the alarm.

Implementation

Future<UpdateAlarmModelResponse> updateAlarmModel({
  required String alarmModelName,
  required AlarmRule alarmRule,
  required String roleArn,
  AlarmCapabilities? alarmCapabilities,
  AlarmEventActions? alarmEventActions,
  String? alarmModelDescription,
  AlarmNotification? alarmNotification,
  int? severity,
}) async {
  _s.validateNumRange(
    'severity',
    severity,
    0,
    2147483647,
  );
  final $payload = <String, dynamic>{
    'alarmRule': alarmRule,
    'roleArn': roleArn,
    if (alarmCapabilities != null) 'alarmCapabilities': alarmCapabilities,
    if (alarmEventActions != null) 'alarmEventActions': alarmEventActions,
    if (alarmModelDescription != null)
      'alarmModelDescription': alarmModelDescription,
    if (alarmNotification != null) 'alarmNotification': alarmNotification,
    if (severity != null) 'severity': severity,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/alarm-models/${Uri.encodeComponent(alarmModelName)}',
    exceptionFnMap: _exceptionFns,
  );
  return UpdateAlarmModelResponse.fromJson(response);
}