@Generated(value="jsii-pacmak/1.58.0 (build f8ba112)", date="2022-05-27T16:27:58.426Z") public class DetectorModel extends Resource implements IDetectorModel
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();
Modifier and Type | Class and Description |
---|---|
static class |
DetectorModel.Builder
(experimental) A fluent builder for
DetectorModel . |
IDetectorModel.Jsii$Default, IDetectorModel.Jsii$Proxy
Modifier | Constructor and Description |
---|---|
protected |
DetectorModel(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
DetectorModel(software.amazon.jsii.JsiiObjectRef objRef) |
|
DetectorModel(software.constructs.Construct scope,
java.lang.String id,
DetectorModelProps props) |
Modifier and Type | Method and Description |
---|---|
static IDetectorModel |
fromDetectorModelName(software.constructs.Construct scope,
java.lang.String id,
java.lang.String detectorModelName)
(experimental) Import an existing detector model.
|
java.lang.String |
getDetectorModelName()
(experimental) The name of the detector model.
|
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResource
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
applyRemovalPolicy, getEnv, getStack
getNode
protected DetectorModel(software.amazon.jsii.JsiiObjectRef objRef)
protected DetectorModel(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public DetectorModel(software.constructs.Construct scope, java.lang.String id, DetectorModelProps props)
scope
- This parameter is required.id
- This parameter is required.props
- This parameter is required.public static IDetectorModel fromDetectorModelName(software.constructs.Construct scope, java.lang.String id, java.lang.String detectorModelName)
scope
- This parameter is required.id
- This parameter is required.detectorModelName
- This parameter is required.public java.lang.String getDetectorModelName()
getDetectorModelName
in interface IDetectorModel