Interface TransitionOptions

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
TransitionOptions.Jsii$Proxy

@Generated(value="jsii-pacmak/1.94.0 (build b380f01)", date="2024-02-23T02:06:41.879Z") @Stability(Experimental) public interface TransitionOptions extends software.amazon.jsii.JsiiSerializable
(experimental) Properties for options of state transition.

Example:

 import software.amazon.awscdk.services.iotevents.alpha.*;
 import software.amazon.awscdk.services.iotevents.actions.alpha.*;
 import software.amazon.awscdk.services.lambda.*;
 IFunction func;
 Input input = Input.Builder.create(this, "MyInput")
         .inputName("my_input") // optional
         .attributeJsonPaths(List.of("payload.deviceId", "payload.temperature"))
         .build();
 State warmState = State.Builder.create()
         .stateName("warm")
         .onEnter(List.of(Event.builder()
                 .eventName("test-enter-event")
                 .condition(Expression.currentInput(input))
                 .actions(List.of(new LambdaInvokeAction(func)))
                 .build()))
         .onInput(List.of(Event.builder() // optional
                 .eventName("test-input-event")
                 .actions(List.of(new LambdaInvokeAction(func))).build()))
         .onExit(List.of(Event.builder() // optional
                 .eventName("test-exit-event")
                 .actions(List.of(new LambdaInvokeAction(func))).build()))
         .build();
 State coldState = State.Builder.create()
         .stateName("cold")
         .build();
 // transit to coldState when temperature is less than 15
 warmState.transitionTo(coldState, TransitionOptions.builder()
         .eventName("to_coldState") // optional property, default by combining the names of the States
         .when(Expression.lt(Expression.inputAttribute(input, "payload.temperature"), Expression.fromString("15")))
         .executing(List.of(new LambdaInvokeAction(func)))
         .build());
 // transit to warmState when temperature is greater than or equal to 15
 coldState.transitionTo(warmState, TransitionOptions.builder()
         .when(Expression.gte(Expression.inputAttribute(input, "payload.temperature"), Expression.fromString("15")))
         .build());
 DetectorModel.Builder.create(this, "MyDetectorModel")
         .detectorModelName("test-detector-model") // optional
         .description("test-detector-model-description") // optional property, default is none
         .evaluationMethod(EventEvaluation.SERIAL) // optional property, default is iotevents.EventEvaluation.BATCH
         .detectorKey("payload.deviceId") // optional property, default is none and single detector instance will be created and all inputs will be routed to it
         .initialState(warmState)
         .build();
 
  • Method Details

    • getWhen

      @Stability(Experimental) @NotNull Expression getWhen()
      (experimental) The condition that is used to determine to cause the state transition and the actions.

      When this was evaluated to true, the state transition and the actions are triggered.

    • getEventName

      @Stability(Experimental) @Nullable default String getEventName()
      (experimental) The name of the event.

      Default: string combining the names of the States as `${originStateName}_to_${targetStateName}`

    • getExecuting

      @Stability(Experimental) @Nullable default List<IAction> getExecuting()
      (experimental) The actions to be performed with the transition.

      Default: - no actions will be performed

    • builder

      @Stability(Experimental) static TransitionOptions.Builder builder()
      Returns:
      a TransitionOptions.Builder of TransitionOptions