interface TopicRuleProps
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.IoT.Alpha.TopicRuleProps |
Go | github.com/aws/aws-cdk-go/awscdkiotalpha/v2#TopicRuleProps |
Java | software.amazon.awscdk.services.iot.alpha.TopicRuleProps |
Python | aws_cdk.aws_iot_alpha.TopicRuleProps |
TypeScript (source) | @aws-cdk/aws-iot-alpha ยป TopicRuleProps |
Properties for defining an AWS IoT Rule.
Example
import * as sns from 'aws-cdk-lib/aws-sns';
const topic = new sns.Topic(this, 'MyTopic');
const topicRule = new iot.TopicRule(this, 'TopicRule', {
sql: iot.IotSql.fromStringAsVer20160323(
"SELECT topic(2) as device_id, year, month, day FROM 'device/+/data'",
),
actions: [
new actions.SnsTopicAction(topic, {
messageFormat: actions.SnsActionMessageFormat.JSON, // optional property, default is SnsActionMessageFormat.RAW
}),
],
});
Properties
Name | Type | Description |
---|---|---|
sql | Iot | A simplified SQL syntax to filter messages received on an MQTT topic and push the data elsewhere. |
actions? | IAction [] | The actions associated with the topic rule. |
description? | string | A textual description of the topic rule. |
enabled? | boolean | Specifies whether the rule is enabled. |
error | IAction | The action AWS IoT performs when it is unable to perform a rule's action. |
topic | string | The name of the topic rule. |
sql
Type:
Iot
A simplified SQL syntax to filter messages received on an MQTT topic and push the data elsewhere.
See also: https://docs.aws.amazon.com/iot/latest/developerguide/iot-sql-reference.html
actions?
Type:
IAction
[]
(optional, default: No actions will be perform)
The actions associated with the topic rule.
description?
Type:
string
(optional, default: None)
A textual description of the topic rule.
enabled?
Type:
boolean
(optional, default: true)
Specifies whether the rule is enabled.
errorAction?
Type:
IAction
(optional, default: no action will be performed)
The action AWS IoT performs when it is unable to perform a rule's action.
topicRuleName?
Type:
string
(optional, default: None)
The name of the topic rule.