io.github.cdklabs.cdk.amazonmq.RabbitMqEventSourceProps Maven / Gradle / Ivy
package io.github.cdklabs.cdk.amazonmq;
/**
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.102.0 (build e354887)", date = "2024-08-08T22:30:31.813Z")
@software.amazon.jsii.Jsii(module = io.github.cdklabs.cdk.amazonmq.$Module.class, fqn = "@cdklabs/cdk-amazonmq.RabbitMqEventSourceProps")
@software.amazon.jsii.Jsii.Proxy(RabbitMqEventSourceProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface RabbitMqEventSourceProps extends software.amazon.jsii.JsiiSerializable, io.github.cdklabs.cdk.amazonmq.EventSourceProps {
/**
* (experimental) The RabbitMQ broker deployment to receive messages from.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull io.github.cdklabs.cdk.amazonmq.IRabbitMqBrokerDeployment getBroker();
/**
* (experimental) he name of the RabbitMQ virtual host from which a queue will be the source of messages.
*
* Default: - the default virtual host '/' will be used.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getVirtualHost() {
return null;
}
/**
* @return a {@link Builder} of {@link RabbitMqEventSourceProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link RabbitMqEventSourceProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
io.github.cdklabs.cdk.amazonmq.IRabbitMqBrokerDeployment broker;
java.lang.String virtualHost;
software.amazon.awscdk.services.secretsmanager.ISecret credentials;
java.lang.String queueName;
java.lang.Boolean addPermissions;
java.lang.Number batchSize;
java.lang.Boolean enabled;
software.amazon.awscdk.Duration maxBatchingWindow;
/**
* Sets the value of {@link RabbitMqEventSourceProps#getBroker}
* @param broker The RabbitMQ broker deployment to receive messages from. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder broker(io.github.cdklabs.cdk.amazonmq.IRabbitMqBrokerDeployment broker) {
this.broker = broker;
return this;
}
/**
* Sets the value of {@link RabbitMqEventSourceProps#getVirtualHost}
* @param virtualHost he name of the RabbitMQ virtual host from which a queue will be the source of messages.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder virtualHost(java.lang.String virtualHost) {
this.virtualHost = virtualHost;
return this;
}
/**
* Sets the value of {@link RabbitMqEventSourceProps#getCredentials}
* @param credentials A secret with credentials of the user to use when receiving messages. This parameter is required.
* The credentials in the secret have fields required:
*
*
* - username
* - password
*
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder credentials(software.amazon.awscdk.services.secretsmanager.ISecret credentials) {
this.credentials = credentials;
return this;
}
/**
* Sets the value of {@link RabbitMqEventSourceProps#getQueueName}
* @param queueName The name of the queue that the function will receive messages from. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder queueName(java.lang.String queueName) {
this.queueName = queueName;
return this;
}
/**
* Sets the value of {@link RabbitMqEventSourceProps#getAddPermissions}
* @param addPermissions If the default permissions should be added to the Lambda function's execution role.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder addPermissions(java.lang.Boolean addPermissions) {
this.addPermissions = addPermissions;
return this;
}
/**
* Sets the value of {@link RabbitMqEventSourceProps#getBatchSize}
* @param batchSize source at the time of invoking your function.
* Your function receives an
* The largest number of records that AWS Lambda will retrieve from your event
* event with all the retrieved records.
*
* Valid Range:
*
*
* - Minimum value of 1
* - Maximum value of: 10000
*
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder batchSize(java.lang.Number batchSize) {
this.batchSize = batchSize;
return this;
}
/**
* Sets the value of {@link RabbitMqEventSourceProps#getEnabled}
* @param enabled If the stream event source mapping should be enabled.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder enabled(java.lang.Boolean enabled) {
this.enabled = enabled;
return this;
}
/**
* Sets the value of {@link RabbitMqEventSourceProps#getMaxBatchingWindow}
* @param maxBatchingWindow The maximum amount of time to gather records before invoking the function.
* Maximum of Duration.minutes(5).
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder maxBatchingWindow(software.amazon.awscdk.Duration maxBatchingWindow) {
this.maxBatchingWindow = maxBatchingWindow;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link RabbitMqEventSourceProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public RabbitMqEventSourceProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link RabbitMqEventSourceProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements RabbitMqEventSourceProps {
private final io.github.cdklabs.cdk.amazonmq.IRabbitMqBrokerDeployment broker;
private final java.lang.String virtualHost;
private final software.amazon.awscdk.services.secretsmanager.ISecret credentials;
private final java.lang.String queueName;
private final java.lang.Boolean addPermissions;
private final java.lang.Number batchSize;
private final java.lang.Boolean enabled;
private final software.amazon.awscdk.Duration maxBatchingWindow;
/**
* 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.broker = software.amazon.jsii.Kernel.get(this, "broker", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.cdk.amazonmq.IRabbitMqBrokerDeployment.class));
this.virtualHost = software.amazon.jsii.Kernel.get(this, "virtualHost", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.credentials = software.amazon.jsii.Kernel.get(this, "credentials", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.secretsmanager.ISecret.class));
this.queueName = software.amazon.jsii.Kernel.get(this, "queueName", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.addPermissions = software.amazon.jsii.Kernel.get(this, "addPermissions", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
this.batchSize = software.amazon.jsii.Kernel.get(this, "batchSize", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.enabled = software.amazon.jsii.Kernel.get(this, "enabled", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
this.maxBatchingWindow = software.amazon.jsii.Kernel.get(this, "maxBatchingWindow", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.Duration.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.broker = java.util.Objects.requireNonNull(builder.broker, "broker is required");
this.virtualHost = builder.virtualHost;
this.credentials = java.util.Objects.requireNonNull(builder.credentials, "credentials is required");
this.queueName = java.util.Objects.requireNonNull(builder.queueName, "queueName is required");
this.addPermissions = builder.addPermissions;
this.batchSize = builder.batchSize;
this.enabled = builder.enabled;
this.maxBatchingWindow = builder.maxBatchingWindow;
}
@Override
public final io.github.cdklabs.cdk.amazonmq.IRabbitMqBrokerDeployment getBroker() {
return this.broker;
}
@Override
public final java.lang.String getVirtualHost() {
return this.virtualHost;
}
@Override
public final software.amazon.awscdk.services.secretsmanager.ISecret getCredentials() {
return this.credentials;
}
@Override
public final java.lang.String getQueueName() {
return this.queueName;
}
@Override
public final java.lang.Boolean getAddPermissions() {
return this.addPermissions;
}
@Override
public final java.lang.Number getBatchSize() {
return this.batchSize;
}
@Override
public final java.lang.Boolean getEnabled() {
return this.enabled;
}
@Override
public final software.amazon.awscdk.Duration getMaxBatchingWindow() {
return this.maxBatchingWindow;
}
@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();
data.set("broker", om.valueToTree(this.getBroker()));
if (this.getVirtualHost() != null) {
data.set("virtualHost", om.valueToTree(this.getVirtualHost()));
}
data.set("credentials", om.valueToTree(this.getCredentials()));
data.set("queueName", om.valueToTree(this.getQueueName()));
if (this.getAddPermissions() != null) {
data.set("addPermissions", om.valueToTree(this.getAddPermissions()));
}
if (this.getBatchSize() != null) {
data.set("batchSize", om.valueToTree(this.getBatchSize()));
}
if (this.getEnabled() != null) {
data.set("enabled", om.valueToTree(this.getEnabled()));
}
if (this.getMaxBatchingWindow() != null) {
data.set("maxBatchingWindow", om.valueToTree(this.getMaxBatchingWindow()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@cdklabs/cdk-amazonmq.RabbitMqEventSourceProps"));
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;
RabbitMqEventSourceProps.Jsii$Proxy that = (RabbitMqEventSourceProps.Jsii$Proxy) o;
if (!broker.equals(that.broker)) return false;
if (this.virtualHost != null ? !this.virtualHost.equals(that.virtualHost) : that.virtualHost != null) return false;
if (!credentials.equals(that.credentials)) return false;
if (!queueName.equals(that.queueName)) return false;
if (this.addPermissions != null ? !this.addPermissions.equals(that.addPermissions) : that.addPermissions != null) return false;
if (this.batchSize != null ? !this.batchSize.equals(that.batchSize) : that.batchSize != null) return false;
if (this.enabled != null ? !this.enabled.equals(that.enabled) : that.enabled != null) return false;
return this.maxBatchingWindow != null ? this.maxBatchingWindow.equals(that.maxBatchingWindow) : that.maxBatchingWindow == null;
}
@Override
public final int hashCode() {
int result = this.broker.hashCode();
result = 31 * result + (this.virtualHost != null ? this.virtualHost.hashCode() : 0);
result = 31 * result + (this.credentials.hashCode());
result = 31 * result + (this.queueName.hashCode());
result = 31 * result + (this.addPermissions != null ? this.addPermissions.hashCode() : 0);
result = 31 * result + (this.batchSize != null ? this.batchSize.hashCode() : 0);
result = 31 * result + (this.enabled != null ? this.enabled.hashCode() : 0);
result = 31 * result + (this.maxBatchingWindow != null ? this.maxBatchingWindow.hashCode() : 0);
return result;
}
}
}