interface StateProps
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.IoTEvents.StateProps |
Java | software.amazon.awscdk.services.iotevents.StateProps |
Python | aws_cdk.aws_iotevents.StateProps |
TypeScript (source) | @aws-cdk/aws-iotevents » StateProps |
Properties for defining a state of a detector.
Example
import * as iotevents from '@aws-cdk/aws-iotevents';
import * as actions from '@aws-cdk/aws-iotevents-actions';
declare const input: iotevents.IInput;
const state = new iotevents.State({
stateName: 'MyState',
onEnter: [{
eventName: 'test-event',
condition: iotevents.Expression.currentInput(input),
actions: [
actions: [
new actions.SetVariableAction(
'MyVariable',
iotevents.Expression.inputAttribute(input, 'payload.temperature'),
),
],
],
}],
});
Properties
Name | Type | Description |
---|---|---|
state | string | The name of the state. |
on | Event [] | Specifies the events on enter. |
on | Event [] | Specifies the events on exit. |
on | Event [] | Specifies the events on input. |
stateName
Type:
string
The name of the state.
onEnter?
Type:
Event
[]
(optional, default: no events will trigger on entering this state)
Specifies the events on enter.
The conditions of the events will be evaluated when entering this state.
If the condition of the event evaluates to true
, the actions of the event will be executed.
onExit?
Type:
Event
[]
(optional, default: no events will trigger on exiting this state)
Specifies the events on exit.
The conditions of the events are evaluated when an exiting this state.
If the condition evaluates to true
, the actions of the event will be executed.
onInput?
Type:
Event
[]
(optional, default: no events will trigger on input in this state)
Specifies the events on input.
The conditions of the events will be evaluated when any input is received.
If the condition of the event evaluates to true
, the actions of the event will be executed.