software.amazon.awscdk.services.iotevents.actions.alpha.LambdaInvokeAction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of iotevents-actions-alpha Show documentation
Show all versions of iotevents-actions-alpha Show documentation
Receipt Detector Model actions for AWS IoT Events
package software.amazon.awscdk.services.iotevents.actions.alpha;
/**
* (experimental) The action to write the data to an AWS Lambda function.
*
* 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();
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.91.0 (build 1b1f239)", date = "2023-11-16T22:34:13.239Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.iotevents.actions.alpha.$Module.class, fqn = "@aws-cdk/aws-iotevents-actions-alpha.LambdaInvokeAction")
public class LambdaInvokeAction extends software.amazon.jsii.JsiiObject implements software.amazon.awscdk.services.iotevents.alpha.IAction {
protected LambdaInvokeAction(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected LambdaInvokeAction(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param func the AWS Lambda function to be invoked by this action. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public LambdaInvokeAction(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.lambda.IFunction func) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(func, "func is required") });
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy