software.amazon.awscdk.services.iot.actions.alpha.LambdaFunctionAction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of iot-actions-alpha Show documentation
Show all versions of iot-actions-alpha Show documentation
Receipt rule actions for AWS IoT
package software.amazon.awscdk.services.iot.actions.alpha;
/**
* (experimental) The action to invoke an AWS Lambda function, passing in an MQTT message.
*
* Example:
*
*
* Function func = Function.Builder.create(this, "MyFunction")
* .runtime(Runtime.NODEJS_LATEST)
* .handler("index.handler")
* .code(Code.fromInline("\n exports.handler = (event) => {\n console.log(\"It is test for lambda action of AWS IoT Rule.\", event);\n };"))
* .build();
* TopicRule.Builder.create(this, "TopicRule")
* .sql(IotSql.fromStringAsVer20160323("SELECT topic(2) as device_id, timestamp() as timestamp, temperature FROM 'device/+/data'"))
* .actions(List.of(new LambdaFunctionAction(func)))
* .build();
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.102.0 (build e354887)", date = "2024-09-06T01:36:38.341Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.iot.actions.alpha.$Module.class, fqn = "@aws-cdk/aws-iot-actions-alpha.LambdaFunctionAction")
public class LambdaFunctionAction extends software.amazon.jsii.JsiiObject implements software.amazon.awscdk.services.iot.alpha.IAction {
protected LambdaFunctionAction(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected LambdaFunctionAction(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param func The lambda function to be invoked by this action. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public LambdaFunctionAction(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") });
}
}