class State
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.IoTEvents.Alpha.State |
Go | github.com/aws/aws-cdk-go/awscdkioteventsalpha/v2#State |
Java | software.amazon.awscdk.services.iotevents.alpha.State |
Python | aws_cdk.aws_iotevents_alpha.State |
TypeScript (source) | @aws-cdk/aws-iotevents-alpha » State |
Defines a state of a detector.
Example
import * as iotevents from '@aws-cdk/aws-iotevents-alpha';
import * as actions from '@aws-cdk/aws-iotevents-actions-alpha';
declare const input: iotevents.IInput;
const state = new iotevents.State({
stateName: 'MyState',
onEnter: [{
eventName: 'test-event',
condition: iotevents.Expression.currentInput(input),
actions: [
new actions.SetTimerAction('MyTimer', {
duration: cdk.Duration.seconds(60),
}),
],
}],
});
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. |
To(targetState, options)
transitionpublic 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
.