createAlarmModel method
Creates an alarm model to monitor an AWS IoT Events input attribute. You can use the alarm to get notified when the value is outside a specified range. For more information, see Create an alarm model in the AWS IoT Events Developer Guide.
May throw InternalFailureException.
May throw InvalidRequestException.
May throw LimitExceededException.
May throw ResourceAlreadyExistsException.
May throw ResourceInUseException.
May throw ServiceUnavailableException.
May throw ThrottlingException.
Parameter alarmModelName :
A unique name that helps you identify the alarm model. You can't change
this name after you create 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 :
A description that tells you what the alarm model detects.
Parameter alarmNotification :
Contains information about one or more notification actions.
Parameter key :
An input attribute used as a key to create an alarm. AWS IoT Events routes
inputs
associated with this key to the alarm.
Parameter severity :
A non-negative integer that reflects the severity level of the alarm.
Parameter tags :
A list of key-value pairs that contain metadata for the alarm model. The
tags help you manage the alarm model. For more information, see Tagging
your AWS IoT Events resources in the AWS IoT Events Developer
Guide.
You can create up to 50 tags for one alarm model.
Implementation
Future<CreateAlarmModelResponse> createAlarmModel({
required String alarmModelName,
required AlarmRule alarmRule,
required String roleArn,
AlarmCapabilities? alarmCapabilities,
AlarmEventActions? alarmEventActions,
String? alarmModelDescription,
AlarmNotification? alarmNotification,
String? key,
int? severity,
List<Tag>? tags,
}) async {
_s.validateNumRange(
'severity',
severity,
0,
2147483647,
);
final $payload = <String, dynamic>{
'alarmModelName': alarmModelName,
'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 (key != null) 'key': key,
if (severity != null) 'severity': severity,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/alarm-models',
exceptionFnMap: _exceptionFns,
);
return CreateAlarmModelResponse.fromJson(response);
}