software.amazon.awscdk.services.pipes.sources.alpha.KinesisSourceParameters Maven / Gradle / Ivy
Show all versions of pipes-sources-alpha Show documentation
package software.amazon.awscdk.services.pipes.sources.alpha;
/**
* (experimental) Parameters for the Kinesis source.
*
* Example:
*
*
* Stream sourceStream;
* Queue targetQueue;
* KinesisSource pipeSource = KinesisSource.Builder.create(sourceStream)
* .startingPosition(KinesisStartingPosition.LATEST)
* .build();
* Pipe pipe = Pipe.Builder.create(this, "Pipe")
* .source(pipeSource)
* .target(new SqsTarget(targetQueue))
* .build();
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.104.0 (build e79254c)", date = "2024-11-13T21:17:43.521Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.pipes.sources.alpha.$Module.class, fqn = "@aws-cdk/aws-pipes-sources-alpha.KinesisSourceParameters")
@software.amazon.jsii.Jsii.Proxy(KinesisSourceParameters.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface KinesisSourceParameters extends software.amazon.jsii.JsiiSerializable, software.amazon.awscdk.services.pipes.sources.alpha.StreamSourceParameters {
/**
* (experimental) The position in a stream from which to start reading.
*
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipesourcekinesisstreamparameters.html#cfn-pipes-pipe-pipesourcekinesisstreamparameters-startingposition
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull software.amazon.awscdk.services.pipes.sources.alpha.KinesisStartingPosition getStartingPosition();
/**
* (experimental) With StartingPosition set to AT_TIMESTAMP, the time from which to start reading, in ISO 8601 format.
*
* Default: - no starting position timestamp
*
* Example:
*
*
* new Date(Date.UTC(1969, 10, 20, 0, 0, 0));
*
*
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipesourcekinesisstreamparameters.html#cfn-pipes-pipe-pipesourcekinesisstreamparameters-startingpositiontimestamp
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.time.Instant getStartingPositionTimestamp() {
return null;
}
/**
* @return a {@link Builder} of {@link KinesisSourceParameters}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link KinesisSourceParameters}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
software.amazon.awscdk.services.pipes.sources.alpha.KinesisStartingPosition startingPosition;
java.time.Instant startingPositionTimestamp;
java.lang.Number batchSize;
java.lang.Object deadLetterTarget;
software.amazon.awscdk.Duration maximumBatchingWindow;
software.amazon.awscdk.Duration maximumRecordAge;
java.lang.Number maximumRetryAttempts;
software.amazon.awscdk.services.pipes.sources.alpha.OnPartialBatchItemFailure onPartialBatchItemFailure;
java.lang.Number parallelizationFactor;
/**
* Sets the value of {@link KinesisSourceParameters#getStartingPosition}
* @param startingPosition The position in a stream from which to start reading. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder startingPosition(software.amazon.awscdk.services.pipes.sources.alpha.KinesisStartingPosition startingPosition) {
this.startingPosition = startingPosition;
return this;
}
/**
* Sets the value of {@link KinesisSourceParameters#getStartingPositionTimestamp}
* @param startingPositionTimestamp With StartingPosition set to AT_TIMESTAMP, the time from which to start reading, in ISO 8601 format.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder startingPositionTimestamp(java.time.Instant startingPositionTimestamp) {
this.startingPositionTimestamp = startingPositionTimestamp;
return this;
}
/**
* Sets the value of {@link KinesisSourceParameters#getBatchSize}
* @param batchSize The maximum number of records to include in each batch.
* @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 KinesisSourceParameters#getDeadLetterTarget}
* @param deadLetterTarget Define the target to send dead-letter queue events to.
* The dead-letter queue stores any events that are not successfully delivered to a Pipes target after all retry attempts are exhausted.
* You can then resolve the issue that caused the failed invocations and replay the events at a later time.
* In some cases, such as when access is denied to a resource, events are sent directly to the dead-letter queue and are not retried.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder deadLetterTarget(software.amazon.awscdk.services.sqs.IQueue deadLetterTarget) {
this.deadLetterTarget = deadLetterTarget;
return this;
}
/**
* Sets the value of {@link KinesisSourceParameters#getDeadLetterTarget}
* @param deadLetterTarget Define the target to send dead-letter queue events to.
* The dead-letter queue stores any events that are not successfully delivered to a Pipes target after all retry attempts are exhausted.
* You can then resolve the issue that caused the failed invocations and replay the events at a later time.
* In some cases, such as when access is denied to a resource, events are sent directly to the dead-letter queue and are not retried.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder deadLetterTarget(software.amazon.awscdk.services.sns.ITopic deadLetterTarget) {
this.deadLetterTarget = deadLetterTarget;
return this;
}
/**
* Sets the value of {@link KinesisSourceParameters#getMaximumBatchingWindow}
* @param maximumBatchingWindow The maximum length of a time to wait for events.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder maximumBatchingWindow(software.amazon.awscdk.Duration maximumBatchingWindow) {
this.maximumBatchingWindow = maximumBatchingWindow;
return this;
}
/**
* Sets the value of {@link KinesisSourceParameters#getMaximumRecordAge}
* @param maximumRecordAge Discard records older than the specified age.
* The default value is -1, which sets the maximum age to infinite. When the value is set to infinite, EventBridge never discards old records.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder maximumRecordAge(software.amazon.awscdk.Duration maximumRecordAge) {
this.maximumRecordAge = maximumRecordAge;
return this;
}
/**
* Sets the value of {@link KinesisSourceParameters#getMaximumRetryAttempts}
* @param maximumRetryAttempts Discard records after the specified number of retries.
* The default value is -1, which sets the maximum number of retries to infinite. When MaximumRetryAttempts is infinite, EventBridge retries failed records until the record expires in the event source.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder maximumRetryAttempts(java.lang.Number maximumRetryAttempts) {
this.maximumRetryAttempts = maximumRetryAttempts;
return this;
}
/**
* Sets the value of {@link KinesisSourceParameters#getOnPartialBatchItemFailure}
* @param onPartialBatchItemFailure Define how to handle item process failures.
* {@link OnPartialBatchItemFailure.AUTOMATIC_BISECT} halves each batch and will retry each half until all the records are processed or there is one failed message left in the batch.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder onPartialBatchItemFailure(software.amazon.awscdk.services.pipes.sources.alpha.OnPartialBatchItemFailure onPartialBatchItemFailure) {
this.onPartialBatchItemFailure = onPartialBatchItemFailure;
return this;
}
/**
* Sets the value of {@link KinesisSourceParameters#getParallelizationFactor}
* @param parallelizationFactor The number of batches to process concurrently from each shard.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder parallelizationFactor(java.lang.Number parallelizationFactor) {
this.parallelizationFactor = parallelizationFactor;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link KinesisSourceParameters}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public KinesisSourceParameters build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link KinesisSourceParameters}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements KinesisSourceParameters {
private final software.amazon.awscdk.services.pipes.sources.alpha.KinesisStartingPosition startingPosition;
private final java.time.Instant startingPositionTimestamp;
private final java.lang.Number batchSize;
private final java.lang.Object deadLetterTarget;
private final software.amazon.awscdk.Duration maximumBatchingWindow;
private final software.amazon.awscdk.Duration maximumRecordAge;
private final java.lang.Number maximumRetryAttempts;
private final software.amazon.awscdk.services.pipes.sources.alpha.OnPartialBatchItemFailure onPartialBatchItemFailure;
private final java.lang.Number parallelizationFactor;
/**
* 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.startingPosition = software.amazon.jsii.Kernel.get(this, "startingPosition", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.pipes.sources.alpha.KinesisStartingPosition.class));
this.startingPositionTimestamp = software.amazon.jsii.Kernel.get(this, "startingPositionTimestamp", software.amazon.jsii.NativeType.forClass(java.time.Instant.class));
this.batchSize = software.amazon.jsii.Kernel.get(this, "batchSize", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.deadLetterTarget = software.amazon.jsii.Kernel.get(this, "deadLetterTarget", software.amazon.jsii.NativeType.forClass(java.lang.Object.class));
this.maximumBatchingWindow = software.amazon.jsii.Kernel.get(this, "maximumBatchingWindow", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.Duration.class));
this.maximumRecordAge = software.amazon.jsii.Kernel.get(this, "maximumRecordAge", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.Duration.class));
this.maximumRetryAttempts = software.amazon.jsii.Kernel.get(this, "maximumRetryAttempts", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.onPartialBatchItemFailure = software.amazon.jsii.Kernel.get(this, "onPartialBatchItemFailure", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.pipes.sources.alpha.OnPartialBatchItemFailure.class));
this.parallelizationFactor = software.amazon.jsii.Kernel.get(this, "parallelizationFactor", software.amazon.jsii.NativeType.forClass(java.lang.Number.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.startingPosition = java.util.Objects.requireNonNull(builder.startingPosition, "startingPosition is required");
this.startingPositionTimestamp = builder.startingPositionTimestamp;
this.batchSize = builder.batchSize;
this.deadLetterTarget = builder.deadLetterTarget;
this.maximumBatchingWindow = builder.maximumBatchingWindow;
this.maximumRecordAge = builder.maximumRecordAge;
this.maximumRetryAttempts = builder.maximumRetryAttempts;
this.onPartialBatchItemFailure = builder.onPartialBatchItemFailure;
this.parallelizationFactor = builder.parallelizationFactor;
}
@Override
public final software.amazon.awscdk.services.pipes.sources.alpha.KinesisStartingPosition getStartingPosition() {
return this.startingPosition;
}
@Override
public final java.time.Instant getStartingPositionTimestamp() {
return this.startingPositionTimestamp;
}
@Override
public final java.lang.Number getBatchSize() {
return this.batchSize;
}
@Override
public final java.lang.Object getDeadLetterTarget() {
return this.deadLetterTarget;
}
@Override
public final software.amazon.awscdk.Duration getMaximumBatchingWindow() {
return this.maximumBatchingWindow;
}
@Override
public final software.amazon.awscdk.Duration getMaximumRecordAge() {
return this.maximumRecordAge;
}
@Override
public final java.lang.Number getMaximumRetryAttempts() {
return this.maximumRetryAttempts;
}
@Override
public final software.amazon.awscdk.services.pipes.sources.alpha.OnPartialBatchItemFailure getOnPartialBatchItemFailure() {
return this.onPartialBatchItemFailure;
}
@Override
public final java.lang.Number getParallelizationFactor() {
return this.parallelizationFactor;
}
@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("startingPosition", om.valueToTree(this.getStartingPosition()));
if (this.getStartingPositionTimestamp() != null) {
data.set("startingPositionTimestamp", om.valueToTree(this.getStartingPositionTimestamp()));
}
if (this.getBatchSize() != null) {
data.set("batchSize", om.valueToTree(this.getBatchSize()));
}
if (this.getDeadLetterTarget() != null) {
data.set("deadLetterTarget", om.valueToTree(this.getDeadLetterTarget()));
}
if (this.getMaximumBatchingWindow() != null) {
data.set("maximumBatchingWindow", om.valueToTree(this.getMaximumBatchingWindow()));
}
if (this.getMaximumRecordAge() != null) {
data.set("maximumRecordAge", om.valueToTree(this.getMaximumRecordAge()));
}
if (this.getMaximumRetryAttempts() != null) {
data.set("maximumRetryAttempts", om.valueToTree(this.getMaximumRetryAttempts()));
}
if (this.getOnPartialBatchItemFailure() != null) {
data.set("onPartialBatchItemFailure", om.valueToTree(this.getOnPartialBatchItemFailure()));
}
if (this.getParallelizationFactor() != null) {
data.set("parallelizationFactor", om.valueToTree(this.getParallelizationFactor()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@aws-cdk/aws-pipes-sources-alpha.KinesisSourceParameters"));
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;
KinesisSourceParameters.Jsii$Proxy that = (KinesisSourceParameters.Jsii$Proxy) o;
if (!startingPosition.equals(that.startingPosition)) return false;
if (this.startingPositionTimestamp != null ? !this.startingPositionTimestamp.equals(that.startingPositionTimestamp) : that.startingPositionTimestamp != null) return false;
if (this.batchSize != null ? !this.batchSize.equals(that.batchSize) : that.batchSize != null) return false;
if (this.deadLetterTarget != null ? !this.deadLetterTarget.equals(that.deadLetterTarget) : that.deadLetterTarget != null) return false;
if (this.maximumBatchingWindow != null ? !this.maximumBatchingWindow.equals(that.maximumBatchingWindow) : that.maximumBatchingWindow != null) return false;
if (this.maximumRecordAge != null ? !this.maximumRecordAge.equals(that.maximumRecordAge) : that.maximumRecordAge != null) return false;
if (this.maximumRetryAttempts != null ? !this.maximumRetryAttempts.equals(that.maximumRetryAttempts) : that.maximumRetryAttempts != null) return false;
if (this.onPartialBatchItemFailure != null ? !this.onPartialBatchItemFailure.equals(that.onPartialBatchItemFailure) : that.onPartialBatchItemFailure != null) return false;
return this.parallelizationFactor != null ? this.parallelizationFactor.equals(that.parallelizationFactor) : that.parallelizationFactor == null;
}
@Override
public final int hashCode() {
int result = this.startingPosition.hashCode();
result = 31 * result + (this.startingPositionTimestamp != null ? this.startingPositionTimestamp.hashCode() : 0);
result = 31 * result + (this.batchSize != null ? this.batchSize.hashCode() : 0);
result = 31 * result + (this.deadLetterTarget != null ? this.deadLetterTarget.hashCode() : 0);
result = 31 * result + (this.maximumBatchingWindow != null ? this.maximumBatchingWindow.hashCode() : 0);
result = 31 * result + (this.maximumRecordAge != null ? this.maximumRecordAge.hashCode() : 0);
result = 31 * result + (this.maximumRetryAttempts != null ? this.maximumRetryAttempts.hashCode() : 0);
result = 31 * result + (this.onPartialBatchItemFailure != null ? this.onPartialBatchItemFailure.hashCode() : 0);
result = 31 * result + (this.parallelizationFactor != null ? this.parallelizationFactor.hashCode() : 0);
return result;
}
}
}