State
- class aws_cdk.aws_iotevents.State(*, state_name, on_enter=None, on_exit=None, on_input=None)
Bases:
object
(experimental) Defines a state of a detector.
- Stability:
experimental
- ExampleMetadata:
infused
Example:
# Example automatically generated from non-compiling source. May contain errors. import aws_cdk.aws_iotevents as iotevents import aws_cdk.aws_iotevents_actions as actions # input: iotevents.IInput state = iotevents.State( state_name="MyState", on_enter=[iotevents.Event( event_name="test-event", condition=iotevents.Expression.current_input(input), actions=[actions, [ actions.SetVariableAction("MyVariable", iotevents.Expression.input_attribute(input, "payload.temperature")) ] ] )] )
- Parameters:
state_name (
str
) – (experimental) The name of the state.on_enter (
Optional
[Sequence
[Union
[Event
,Dict
[str
,Any
]]]]) – (experimental) Specifies the events on enter. The conditions of the events will be evaluated when entering this state. If the condition of the event evaluates totrue
, the actions of the event will be executed. Default: - no events will trigger on entering this stateon_exit (
Optional
[Sequence
[Union
[Event
,Dict
[str
,Any
]]]]) – (experimental) Specifies the events on exit. The conditions of the events are evaluated when an exiting this state. If the condition evaluates totrue
, the actions of the event will be executed. Default: - no events will trigger on exiting this stateon_input (
Optional
[Sequence
[Union
[Event
,Dict
[str
,Any
]]]]) – (experimental) 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 totrue
, the actions of the event will be executed. Default: - no events will trigger on input in this state
- Stability:
experimental
Methods
- transition_to(target_state, *, when, event_name=None, executing=None)
(experimental) Add a transition event to the state.
The transition event will be triggered if condition is evaluated to
true
.- Parameters:
target_state (
State
) – the state that will be transit to when the event triggered.when (
Expression
) – (experimental) The condition that is used to determine to cause the state transition and the actions. When this was evaluated totrue
, the state transition and the actions are triggered.event_name (
Optional
[str
]) – (experimental) The name of the event. Default: string combining the names of the States as${originStateName}_to_${targetStateName}
executing (
Optional
[Sequence
[IAction
]]) – (experimental) The actions to be performed with the transition. Default: - no actions will be performed
- Stability:
experimental
- Return type:
None
Attributes
- state_name
(experimental) The name of the state.
- Stability:
experimental