Interface DetectorModelProps

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

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:37.226Z") @Stability(Experimental) public interface DetectorModelProps extends software.amazon.jsii.JsiiSerializable
(experimental) Properties for defining an AWS IoT Events detector model.

Example:

 import software.amazon.awscdk.services.iotevents.*;
 import software.amazon.awscdk.services.iotevents.actions.*;
 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

    • getInitialState

      @Stability(Experimental) @NotNull State getInitialState()
      (experimental) The state that is entered at the creation of each detector.
    • getDescription

      @Stability(Experimental) @Nullable default String getDescription()
      (experimental) A brief description of the detector model.

      Default: none

    • getDetectorKey

      @Stability(Experimental) @Nullable default String getDetectorKey()
      (experimental) The value used to identify a detector instance.

      When a device or system sends input, a new detector instance with a unique key value is created. AWS IoT Events can continue to route input to its corresponding detector instance based on this identifying information.

      This parameter uses a JSON-path expression to select the attribute-value pair in the message payload that is used for identification. To route the message to the correct detector instance, the device must send a message payload that contains the same attribute-value.

      Default: - none (single detector instance will be created and all inputs will be routed to it)

    • getDetectorModelName

      @Stability(Experimental) @Nullable default String getDetectorModelName()
      (experimental) The name of the detector model.

      Default: - CloudFormation will generate a unique name of the detector model

    • getEvaluationMethod

      @Stability(Experimental) @Nullable default EventEvaluation getEvaluationMethod()
      (experimental) Information about the order in which events are evaluated and how actions are executed.

      When setting to SERIAL, variables are updated and event conditions are evaluated in the order that the events are defined. When setting to BATCH, variables within a state are updated and events within a state are performed only after all event conditions are evaluated.

      Default: EventEvaluation.BATCH

    • getRole

      @Stability(Experimental) @Nullable default IRole getRole()
      (experimental) The role that grants permission to AWS IoT Events to perform its operations.

      Default: - a role will be created with default permissions

    • builder

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