constructor()

in infra/stack/iot/thing-monitor-stack.ts [14:38]


    constructor(appContext: AppContext, stackConfig: any) {
        super(appContext, stackConfig);

        this.enableThingEventMessage();

        const table = new ddb.Table(this, 'ThingMonitor', {
            tableName: `${this.projectPrefix}-ThingMonitor`,
            partitionKey: {
                name: 'thingName',
                type: ddb.AttributeType.STRING
            },
            sortKey: {
                name: 'timestamp',
                type: ddb.AttributeType.NUMBER
            }
        });

        const ruleList: any[] = [
            { name: 'thing_created', topic: 'created' },
            { name: 'thing_updated', topic: 'updated' },
            { name: 'thing_deleted', topic: 'deleted' },
        ];

        ruleList.forEach((rule) => { this.createIotRule(rule.name, rule.topic, table) });
    }