alarm_models
Creates, updates, deletes or gets an alarm_model resource or lists alarm_models in a region
Overview
| Name | alarm_models |
| Type | Resource |
| Description | Represents an alarm model to monitor an ITE 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 Developer Guide. |
| Id | awscc.iotevents.alarm_models |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
alarm_model_name | string | The name of the alarm model. |
alarm_model_description | string | The description of the alarm model. |
role_arn | 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 General Reference. |
key | string | An input attribute used as a key to create an alarm. ITE routes inputs associated with this key to the alarm. |
severity | integer | A non-negative integer that reflects the severity level of the alarm. |
alarm_rule | object | Defines when your alarm is invoked. |
alarm_event_actions | object | Contains information about one or more alarm actions. |
alarm_capabilities | object | Contains the configuration information of alarm state changes. |
tags | array | 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 resources in the Developer Guide.You can create up to 50 tags for one alarm model. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
alarm_model_name | string | The name of the alarm model. |
region | string | AWS region. |
For more information, see AWS::IoTEvents::AlarmModel.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | alarm_models | INSERT | RoleArn, AlarmRule, region |
delete_resource | alarm_models | DELETE | Identifier, region |
update_resource | alarm_models | UPDATE | Identifier, PatchDocument, region |
list_resources | alarm_models_list_only | SELECT | region |
get_resource | alarm_models | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual alarm_model.
SELECT
region,
alarm_model_name,
alarm_model_description,
role_arn,
key,
severity,
alarm_rule,
alarm_event_actions,
alarm_capabilities,
tags
FROM awscc.iotevents.alarm_models
WHERE
region = '{{ region }}' AND
Identifier = '{{ alarm_model_name }}';
Lists all alarm_models in a region.
SELECT
region,
alarm_model_name
FROM awscc.iotevents.alarm_models_list_only
WHERE
region = '{{ region }}';
INSERT example
Use the following StackQL query and manifest file to create a new alarm_model resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.iotevents.alarm_models (
RoleArn,
AlarmRule,
region
)
SELECT
'{{ role_arn }}',
'{{ alarm_rule }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ create */
INSERT INTO awscc.iotevents.alarm_models (
AlarmModelName,
AlarmModelDescription,
RoleArn,
Key,
Severity,
AlarmRule,
AlarmEventActions,
AlarmCapabilities,
Tags,
region
)
SELECT
'{{ alarm_model_name }}',
'{{ alarm_model_description }}',
'{{ role_arn }}',
'{{ key }}',
'{{ severity }}',
'{{ alarm_rule }}',
'{{ alarm_event_actions }}',
'{{ alarm_capabilities }}',
'{{ tags }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: alarm_model
props:
- name: alarm_model_name
value: '{{ alarm_model_name }}'
- name: alarm_model_description
value: '{{ alarm_model_description }}'
- name: role_arn
value: '{{ role_arn }}'
- name: key
value: '{{ key }}'
- name: severity
value: '{{ severity }}'
- name: alarm_rule
value:
simple_rule:
input_property: '{{ input_property }}'
comparison_operator: '{{ comparison_operator }}'
threshold: '{{ threshold }}'
- name: alarm_event_actions
value:
alarm_actions:
- dynamo_db:
hash_key_field: '{{ hash_key_field }}'
hash_key_type: '{{ hash_key_type }}'
hash_key_value: '{{ hash_key_value }}'
operation: '{{ operation }}'
payload:
content_expression: '{{ content_expression }}'
type: '{{ type }}'
payload_field: '{{ payload_field }}'
range_key_field: '{{ range_key_field }}'
range_key_type: '{{ range_key_type }}'
range_key_value: '{{ range_key_value }}'
table_name: '{{ table_name }}'
dynamo_dbv2:
payload: null
table_name: '{{ table_name }}'
firehose:
delivery_stream_name: '{{ delivery_stream_name }}'
payload: null
separator: '{{ separator }}'
iot_events:
input_name: '{{ input_name }}'
payload: null
iot_site_wise:
asset_id: '{{ asset_id }}'
entry_id: '{{ entry_id }}'
property_alias: '{{ property_alias }}'
property_id: '{{ property_id }}'
property_value:
quality: '{{ quality }}'
timestamp:
offset_in_nanos: '{{ offset_in_nanos }}'
time_in_seconds: '{{ time_in_seconds }}'
value:
boolean_value: '{{ boolean_value }}'
double_value: '{{ double_value }}'
integer_value: '{{ integer_value }}'
string_value: '{{ string_value }}'
iot_topic_publish:
mqtt_topic: '{{ mqtt_topic }}'
payload: null
lambda:
function_arn: '{{ function_arn }}'
payload: null
sns:
payload: null
target_arn: '{{ target_arn }}'
sqs:
payload: null
queue_url: '{{ queue_url }}'
use_base64: '{{ use_base64 }}'
- name: alarm_capabilities
value:
initialization_configuration:
disabled_on_initialization: '{{ disabled_on_initialization }}'
acknowledge_flow:
enabled: '{{ enabled }}'
- name: tags
value:
- key: '{{ key }}'
value: '{{ value }}'
UPDATE example
Use the following StackQL query and manifest file to update a alarm_model resource, using stack-deploy.
/*+ update */
UPDATE awscc.iotevents.alarm_models
SET PatchDocument = string('{{ {
"AlarmModelDescription": alarm_model_description,
"RoleArn": role_arn,
"Severity": severity,
"AlarmRule": alarm_rule,
"AlarmEventActions": alarm_event_actions,
"AlarmCapabilities": alarm_capabilities,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ alarm_model_name }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
DELETE example
/*+ delete */
DELETE FROM awscc.iotevents.alarm_models
WHERE
Identifier = '{{ alarm_model_name }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
Additional Parameters
Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:
| Parameter | Description |
|---|---|
ClientToken | A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.A client token is valid for 36 hours once used. After that, a resource request with the same client token is treated as a new request. If you do not specify a client token, one is generated for inclusion in the request. |
RoleArn | The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.If you do not specify a role, a temporary session is created using your AWS user credentials. |
TypeVersionId | For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used. |
Permissions
To operate on the alarm_models resource, the following permissions are required:
- Create
- Read
- Update
- Delete
- List
iotevents:CreateAlarmModel,
iotevents:UpdateInputRouting,
iotevents:DescribeAlarmModel,
iotevents:ListTagsForResource,
iotevents:TagResource,
iam:PassRole
iotevents:DescribeAlarmModel,
iotevents:ListTagsForResource
iotevents:UpdateAlarmModel,
iotevents:UpdateInputRouting,
iotevents:DescribeAlarmModel,
iotevents:ListTagsForResource,
iotevents:UntagResource,
iotevents:TagResource,
iam:PassRole
iotevents:DeleteAlarmModel,
iotevents:DescribeAlarmModel
iotevents:ListAlarmModels