software.amazon.awscdk.services.iot.actions.alpha.IotEventsPutMessageAction Maven / Gradle / Ivy
Show all versions of iot-actions-alpha Show documentation
package software.amazon.awscdk.services.iot.actions.alpha;
/**
* (experimental) The action to put the message from an MQTT message to the IoT Events input.
*
* Example:
*
*
* import software.amazon.awscdk.services.iotevents.alpha.*;
* import software.amazon.awscdk.services.iam.*;
* IRole role;
* Input input = Input.Builder.create(this, "MyInput")
* .attributeJsonPaths(List.of("payload.temperature", "payload.transactionId"))
* .build();
* TopicRule topicRule = TopicRule.Builder.create(this, "TopicRule")
* .sql(IotSql.fromStringAsVer20160323("SELECT * FROM 'device/+/data'"))
* .actions(List.of(
* IotEventsPutMessageAction.Builder.create(input)
* .batchMode(true) // optional property, default is 'false'
* .messageId("${payload.transactionId}") // optional property, default is a new UUID
* .role(role)
* .build()))
* .build();
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-10-04T00:39:42.241Z")
@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.IotEventsPutMessageAction")
public class IotEventsPutMessageAction extends software.amazon.jsii.JsiiObject implements software.amazon.awscdk.services.iot.alpha.IAction {
protected IotEventsPutMessageAction(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected IotEventsPutMessageAction(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param input The IoT Events input to put messages. This parameter is required.
* @param props Optional properties to not use default.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public IotEventsPutMessageAction(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.iotevents.alpha.IInput input, final @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.iot.actions.alpha.IotEventsPutMessageActionProps props) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(input, "input is required"), props });
}
/**
* @param input The IoT Events input to put messages. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public IotEventsPutMessageAction(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.iotevents.alpha.IInput input) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(input, "input is required") });
}
/**
* (experimental) A fluent builder for {@link software.amazon.awscdk.services.iot.actions.alpha.IotEventsPutMessageAction}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* @return a new instance of {@link Builder}.
* @param input The IoT Events input to put messages. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static Builder create(final software.amazon.awscdk.services.iotevents.alpha.IInput input) {
return new Builder(input);
}
private final software.amazon.awscdk.services.iotevents.alpha.IInput input;
private software.amazon.awscdk.services.iot.actions.alpha.IotEventsPutMessageActionProps.Builder props;
private Builder(final software.amazon.awscdk.services.iotevents.alpha.IInput input) {
this.input = input;
}
/**
* (experimental) The IAM role that allows access to AWS service.
*
* Default: a new role will be created
*
* @return {@code this}
* @param role The IAM role that allows access to AWS service. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder role(final software.amazon.awscdk.services.iam.IRole role) {
this.props().role(role);
return this;
}
/**
* (experimental) Whether to process the event actions as a batch.
*
* When batchMode is true, you can't specify a messageId.
*
* When batchMode is true and the rule SQL statement evaluates to an Array,
* each Array element is treated as a separate message when Events by calling BatchPutMessage.
* The resulting array can't have more than 10 messages.
*
* Default: false
*
* @return {@code this}
* @param batchMode Whether to process the event actions as a batch. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder batchMode(final java.lang.Boolean batchMode) {
this.props().batchMode(batchMode);
return this;
}
/**
* (experimental) The ID of the message.
*
* When batchMode is true, you can't specify a messageId--a new UUID value will be assigned.
* Assign a value to this property to ensure that only one input (message) with a given messageId will be processed by an AWS IoT Events detector.
*
* Default: - none -- a new UUID value will be assigned
*
* @return {@code this}
* @param messageId The ID of the message. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder messageId(final java.lang.String messageId) {
this.props().messageId(messageId);
return this;
}
/**
* @return a newly built instance of {@link software.amazon.awscdk.services.iot.actions.alpha.IotEventsPutMessageAction}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public software.amazon.awscdk.services.iot.actions.alpha.IotEventsPutMessageAction build() {
return new software.amazon.awscdk.services.iot.actions.alpha.IotEventsPutMessageAction(
this.input,
this.props != null ? this.props.build() : null
);
}
private software.amazon.awscdk.services.iot.actions.alpha.IotEventsPutMessageActionProps.Builder props() {
if (this.props == null) {
this.props = new software.amazon.awscdk.services.iot.actions.alpha.IotEventsPutMessageActionProps.Builder();
}
return this.props;
}
}
}