@aws-cdk_aws-iot-alpha.TopicRuleProps

interface TopicRuleProps ๐Ÿ”น

LanguageType name
.NETAmazon.CDK.AWS.IoT.Alpha.TopicRuleProps
Gogithub.com/aws/aws-cdk-go/awscdkiotalpha/v2#TopicRuleProps
Javasoftware.amazon.awscdk.services.iot.alpha.TopicRuleProps
Pythonaws_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

NameTypeDescription
sql๐Ÿ”นIotSqlA 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?๐Ÿ”นstringA textual description of the topic rule.
enabled?๐Ÿ”นbooleanSpecifies whether the rule is enabled.
errorAction?๐Ÿ”นIActionThe action AWS IoT performs when it is unable to perform a rule's action.
topicRuleName?๐Ÿ”นstringThe name of the topic rule.

sql๐Ÿ”น

Type: IotSql

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.