software.amazon.awscdk.services.iot.actions.alpha.IotEventsPutMessageActionProps Maven / Gradle / Ivy
Show all versions of iot-actions-alpha Show documentation
package software.amazon.awscdk.services.iot.actions.alpha;
/**
* (experimental) Configuration properties of an action for the IoT Events.
*
* 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.102.0 (build e354887)", date = "2024-09-06T01:36:38.338Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.iot.actions.alpha.$Module.class, fqn = "@aws-cdk/aws-iot-actions-alpha.IotEventsPutMessageActionProps")
@software.amazon.jsii.Jsii.Proxy(IotEventsPutMessageActionProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface IotEventsPutMessageActionProps extends software.amazon.jsii.JsiiSerializable, software.amazon.awscdk.services.iot.actions.alpha.CommonActionProps {
/**
* (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
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Boolean getBatchMode() {
return null;
}
/**
* (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
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getMessageId() {
return null;
}
/**
* @return a {@link Builder} of {@link IotEventsPutMessageActionProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link IotEventsPutMessageActionProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.Boolean batchMode;
java.lang.String messageId;
software.amazon.awscdk.services.iam.IRole role;
/**
* Sets the value of {@link IotEventsPutMessageActionProps#getBatchMode}
* @param batchMode 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.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder batchMode(java.lang.Boolean batchMode) {
this.batchMode = batchMode;
return this;
}
/**
* Sets the value of {@link IotEventsPutMessageActionProps#getMessageId}
* @param messageId 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.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder messageId(java.lang.String messageId) {
this.messageId = messageId;
return this;
}
/**
* Sets the value of {@link IotEventsPutMessageActionProps#getRole}
* @param role The IAM role that allows access to AWS service.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder role(software.amazon.awscdk.services.iam.IRole role) {
this.role = role;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link IotEventsPutMessageActionProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public IotEventsPutMessageActionProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link IotEventsPutMessageActionProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements IotEventsPutMessageActionProps {
private final java.lang.Boolean batchMode;
private final java.lang.String messageId;
private final software.amazon.awscdk.services.iam.IRole role;
/**
* Constructor that initializes the object based on values retrieved from the JsiiObject.
* @param objRef Reference to the JSII managed object.
*/
protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
this.batchMode = software.amazon.jsii.Kernel.get(this, "batchMode", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
this.messageId = software.amazon.jsii.Kernel.get(this, "messageId", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.role = software.amazon.jsii.Kernel.get(this, "role", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.iam.IRole.class));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
protected Jsii$Proxy(final Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.batchMode = builder.batchMode;
this.messageId = builder.messageId;
this.role = builder.role;
}
@Override
public final java.lang.Boolean getBatchMode() {
return this.batchMode;
}
@Override
public final java.lang.String getMessageId() {
return this.messageId;
}
@Override
public final software.amazon.awscdk.services.iam.IRole getRole() {
return this.role;
}
@Override
@software.amazon.jsii.Internal
public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() {
final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE;
final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
if (this.getBatchMode() != null) {
data.set("batchMode", om.valueToTree(this.getBatchMode()));
}
if (this.getMessageId() != null) {
data.set("messageId", om.valueToTree(this.getMessageId()));
}
if (this.getRole() != null) {
data.set("role", om.valueToTree(this.getRole()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@aws-cdk/aws-iot-actions-alpha.IotEventsPutMessageActionProps"));
struct.set("data", data);
final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
obj.set("$jsii.struct", struct);
return obj;
}
@Override
public final boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
IotEventsPutMessageActionProps.Jsii$Proxy that = (IotEventsPutMessageActionProps.Jsii$Proxy) o;
if (this.batchMode != null ? !this.batchMode.equals(that.batchMode) : that.batchMode != null) return false;
if (this.messageId != null ? !this.messageId.equals(that.messageId) : that.messageId != null) return false;
return this.role != null ? this.role.equals(that.role) : that.role == null;
}
@Override
public final int hashCode() {
int result = this.batchMode != null ? this.batchMode.hashCode() : 0;
result = 31 * result + (this.messageId != null ? this.messageId.hashCode() : 0);
result = 31 * result + (this.role != null ? this.role.hashCode() : 0);
return result;
}
}
}