class State
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.IoTEvents.State |
![]() | software.amazon.awscdk.services.iotevents.State |
![]() | aws_cdk.aws_iotevents.State |
![]() | @aws-cdk/aws-iotevents » State |
Defines 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'),
),
],
],
}],
});
Initializer
new State(props: StateProps)
Parameters
- props
State
Props
Properties
Name | Type | Description |
---|---|---|
state | string | The name of the state. |
stateName
Type:
string
The name of the state.
Methods
Name | Description |
---|---|
transition | Add a transition event to the state. |
transitionTo(targetState, options)
public transitionTo(targetState: State, options: TransitionOptions): void
Parameters
- targetState
State
— the state that will be transit to when the event triggered. - options
Transition
— transition options including the condition that causes the state transition.Options
Add a transition event to the state.
The transition event will be triggered if condition is evaluated to true
.