Skip to content
v2.274.0

Experimental

@aws-cdk/aws-iot-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

IotSql Class ​

Defines AWS IoT SQL.

Example ​

ts
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
    }),
  ],
});

Initializer ​

ts
new IotSql()
python
IotSql()
java
new IotSql()
csharp
new IotSql()
go
NewIotSql()

Methods ​

bind(scope: Construct): IotSqlConfigdef bind(self, scope: Construct) -> IotSqlConfigpublic IotSqlConfig bind(Construct scope)public IotSqlConfig Bind(Construct scope)func Bind(Scope Construct) IotSqlConfig#
Returns the IoT SQL configuration.
fromStringAsVer20151008(sql: string): IotSql // chainable@staticmethod def from_string_as_ver20151008(sql: str) -> IotSqlpublic static IotSql fromStringAsVer20151008(String sql)public static IotSql FromStringAsVer20151008(string sql)func FromStringAsVer20151008(Sql *string) IotSqlstatic#
Uses the original SQL version built on 2015-10-08.
1 parameter · returns

Parameters

  • sqlsqlsqlsqlSql — The actual SQL-like syntax query.

Returns: Instance of IotSql

fromStringAsVer20160323(sql: string): IotSql // chainable@staticmethod def from_string_as_ver20160323(sql: str) -> IotSqlpublic static IotSql fromStringAsVer20160323(String sql)public static IotSql FromStringAsVer20160323(string sql)func FromStringAsVer20160323(Sql *string) IotSqlstatic#
Uses the SQL version built on 2016-03-23.
1 parameter · returns

Parameters

  • sqlsqlsqlsqlSql — The actual SQL-like syntax query.

Returns: Instance of IotSql

fromStringAsVerNewestUnstable(sql: string): IotSql // chainable@staticmethod def from_string_as_ver_newest_unstable(sql: str) -> IotSqlpublic static IotSql fromStringAsVerNewestUnstable(String sql)public static IotSql FromStringAsVerNewestUnstable(string sql)func FromStringAsVerNewestUnstable(Sql *string) IotSqlstatic#
Uses the most recent beta SQL version.

If you use this version, it might introduce breaking changes to your rules.

1 parameter · returns

Parameters

  • sqlsqlsqlsqlSql — The actual SQL-like syntax query.

Returns: Instance of IotSql