Method: Aws::IoTEvents::Client#create_alarm_model
- Defined in:
- lib/aws-sdk-iotevents/client.rb
#create_alarm_model(params = {}) ⇒ Types::CreateAlarmModelResponse
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*.
[1]: docs.aws.amazon.com/iotevents/latest/developerguide/create-alarms.html
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
resp = client.create_alarm_model({
alarm_model_name: "AlarmModelName", # required
alarm_model_description: "AlarmModelDescription",
role_arn: "AmazonResourceName", # required
tags: [
{
key: "TagKey", # required
value: "TagValue", # required
},
],
key: "AttributeJsonPath",
severity: 1,
alarm_rule: { # required
simple_rule: {
input_property: "InputProperty", # required
comparison_operator: "GREATER", # required, accepts GREATER, GREATER_OR_EQUAL, LESS, LESS_OR_EQUAL, EQUAL, NOT_EQUAL
threshold: "Threshold", # required
},
},
alarm_notification: {
notification_actions: [
{
action: { # required
lambda_action: {
function_arn: "AmazonResourceName", # required
payload: {
content_expression: "ContentExpression", # required
type: "STRING", # required, accepts STRING, JSON
},
},
},
sms_configurations: [
{
sender_id: "SMSSenderId",
additional_message: "NotificationAdditionalMessage",
recipients: [ # required
{
sso_identity: {
identity_store_id: "IdentityStoreId", # required
user_id: "SSOReferenceId",
},
},
],
},
],
email_configurations: [
{
from: "FromEmail", # required
content: {
subject: "EmailSubject",
additional_message: "NotificationAdditionalMessage",
},
recipients: { # required
to: [
{
sso_identity: {
identity_store_id: "IdentityStoreId", # required
user_id: "SSOReferenceId",
},
},
],
},
},
],
},
],
},
alarm_event_actions: {
alarm_actions: [
{
sns: {
target_arn: "AmazonResourceName", # required
payload: {
content_expression: "ContentExpression", # required
type: "STRING", # required, accepts STRING, JSON
},
},
iot_topic_publish: {
mqtt_topic: "MQTTTopic", # required
payload: {
content_expression: "ContentExpression", # required
type: "STRING", # required, accepts STRING, JSON
},
},
lambda: {
function_arn: "AmazonResourceName", # required
payload: {
content_expression: "ContentExpression", # required
type: "STRING", # required, accepts STRING, JSON
},
},
iot_events: {
input_name: "InputName", # required
payload: {
content_expression: "ContentExpression", # required
type: "STRING", # required, accepts STRING, JSON
},
},
sqs: {
queue_url: "QueueUrl", # required
use_base_64: false,
payload: {
content_expression: "ContentExpression", # required
type: "STRING", # required, accepts STRING, JSON
},
},
firehose: {
delivery_stream_name: "DeliveryStreamName", # required
separator: "FirehoseSeparator",
payload: {
content_expression: "ContentExpression", # required
type: "STRING", # required, accepts STRING, JSON
},
},
dynamo_db: {
hash_key_type: "DynamoKeyType",
hash_key_field: "DynamoKeyField", # required
hash_key_value: "DynamoKeyValue", # required
range_key_type: "DynamoKeyType",
range_key_field: "DynamoKeyField",
range_key_value: "DynamoKeyValue",
operation: "DynamoOperation",
payload_field: "DynamoKeyField",
table_name: "DynamoTableName", # required
payload: {
content_expression: "ContentExpression", # required
type: "STRING", # required, accepts STRING, JSON
},
},
dynamo_d_bv_2: {
table_name: "DynamoTableName", # required
payload: {
content_expression: "ContentExpression", # required
type: "STRING", # required, accepts STRING, JSON
},
},
iot_site_wise: {
entry_id: "AssetPropertyEntryId",
asset_id: "AssetId",
property_id: "AssetPropertyId",
property_alias: "AssetPropertyAlias",
property_value: {
value: {
string_value: "AssetPropertyStringValue",
integer_value: "AssetPropertyIntegerValue",
double_value: "AssetPropertyDoubleValue",
boolean_value: "AssetPropertyBooleanValue",
},
timestamp: {
time_in_seconds: "AssetPropertyTimeInSeconds", # required
offset_in_nanos: "AssetPropertyOffsetInNanos",
},
quality: "AssetPropertyQuality",
},
},
},
],
},
alarm_capabilities: {
initialization_configuration: {
disabled_on_initialization: false, # required
},
acknowledge_flow: {
enabled: false, # required
},
},
})
Response structure
Response structure
resp.creation_time #=> Time
resp.alarm_model_arn #=> String
resp.alarm_model_version #=> String
resp.last_update_time #=> Time
resp.status #=> String, one of "ACTIVE", "ACTIVATING", "INACTIVE", "FAILED"
Parameters:
-
params
(Hash)
(defaults to: {})
—
({})
Options Hash (params):
-
:alarm_model_name
(required, String)
—
A unique name that helps you identify the alarm model. You can’t change this name after you create the alarm model.
-
:alarm_model_description
(String)
—
A description that tells you what the alarm model detects.
-
:role_arn
(required, String)
—
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*.
[1]: docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html
-
:tags
(Array<Types::Tag>)
—
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][1
-
in the *AWS IoT Events
Developer Guide*.
You can create up to 50 tags for one alarm model.
[1]: docs.aws.amazon.com/iotevents/latest/developerguide/tagging-iotevents.html
-
:key
(String)
—
An input attribute used as a key to create an alarm. AWS IoT Events routes [inputs] associated with this key to the alarm.
[1]: docs.aws.amazon.com/iotevents/latest/apireference/API_Input.html
-
:severity
(Integer)
—
A non-negative integer that reflects the severity level of the alarm.
-
:alarm_rule
(required, Types::AlarmRule)
—
Defines when your alarm is invoked.
-
:alarm_notification
(Types::AlarmNotification)
—
Contains information about one or more notification actions.
-
:alarm_event_actions
(Types::AlarmEventActions)
—
Contains information about one or more alarm actions.
-
:alarm_capabilities
(Types::AlarmCapabilities)
—
Contains the configuration information of alarm state changes.
Returns:
-
(Types::CreateAlarmModelResponse)
—
Returns a response object which responds to the following methods:
-
#creation_time => Time
-
#alarm_model_arn => String
-
#alarm_model_version => String
-
#last_update_time => Time
-
#status => String
-
720 721 722 723 |
# File 'lib/aws-sdk-iotevents/client.rb', line 720 def create_alarm_model(params = {}, options = {}) req = build_request(:create_alarm_model, params) req.send_request(options) end |