software.amazon.awscdk.services.kinesisfirehose.destinations.DestinationS3BackupProps Maven / Gradle / Ivy
package software.amazon.awscdk.services.kinesisfirehose.destinations;
/**
* (experimental) Properties for defining an S3 backup destination.
*
* S3 backup is available for all destinations, regardless of whether the final destination is S3 or not.
*
* Example:
*
*
* import path.*;
* import software.amazon.awscdk.services.kinesisfirehose.*;
* import software.amazon.awscdk.services.kms.*;
* import software.amazon.awscdk.services.lambda.nodejs.*;
* import software.amazon.awscdk.services.logs.*;
* import software.amazon.awscdk.services.s3.*;
* import software.amazon.awscdk.core.*;
* import software.amazon.awscdk.services.kinesisfirehose.destinations.*;
* App app = new App();
* Stack stack = new Stack(app, "aws-cdk-firehose-delivery-stream-s3-all-properties");
* Bucket bucket = Bucket.Builder.create(stack, "Bucket")
* .removalPolicy(RemovalPolicy.DESTROY)
* .autoDeleteObjects(true)
* .build();
* Bucket backupBucket = Bucket.Builder.create(stack, "BackupBucket")
* .removalPolicy(RemovalPolicy.DESTROY)
* .autoDeleteObjects(true)
* .build();
* LogGroup logGroup = LogGroup.Builder.create(stack, "LogGroup")
* .removalPolicy(RemovalPolicy.DESTROY)
* .build();
* NodejsFunction dataProcessorFunction = NodejsFunction.Builder.create(stack, "DataProcessorFunction")
* .entry(join(__dirname, "lambda-data-processor.js"))
* .timeout(Duration.minutes(1))
* .build();
* LambdaFunctionProcessor processor = LambdaFunctionProcessor.Builder.create(dataProcessorFunction)
* .bufferInterval(Duration.seconds(60))
* .bufferSize(Size.mebibytes(1))
* .retries(1)
* .build();
* Key key = Key.Builder.create(stack, "Key")
* .removalPolicy(RemovalPolicy.DESTROY)
* .build();
* Key backupKey = Key.Builder.create(stack, "BackupKey")
* .removalPolicy(RemovalPolicy.DESTROY)
* .build();
* DeliveryStream.Builder.create(stack, "Delivery Stream")
* .destinations(List.of(S3Bucket.Builder.create(bucket)
* .logging(true)
* .logGroup(logGroup)
* .processor(processor)
* .compression(Compression.GZIP)
* .dataOutputPrefix("regularPrefix")
* .errorOutputPrefix("errorPrefix")
* .bufferingInterval(Duration.seconds(60))
* .bufferingSize(Size.mebibytes(1))
* .encryptionKey(key)
* .s3Backup(DestinationS3BackupProps.builder()
* .mode(BackupMode.ALL)
* .bucket(backupBucket)
* .compression(Compression.ZIP)
* .dataOutputPrefix("backupPrefix")
* .errorOutputPrefix("backupErrorPrefix")
* .bufferingInterval(Duration.seconds(60))
* .bufferingSize(Size.mebibytes(1))
* .encryptionKey(backupKey)
* .build())
* .build()))
* .build();
* app.synth();
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.74.0 (build 6d08790)", date = "2023-05-31T18:44:13.556Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.kinesisfirehose.destinations.$Module.class, fqn = "@aws-cdk/aws-kinesisfirehose-destinations.DestinationS3BackupProps")
@software.amazon.jsii.Jsii.Proxy(DestinationS3BackupProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface DestinationS3BackupProps extends software.amazon.jsii.JsiiSerializable, software.amazon.awscdk.services.kinesisfirehose.destinations.CommonDestinationS3Props {
/**
* (experimental) The S3 bucket that will store data and failed records.
*
* Default: - If `mode` is set to `BackupMode.ALL` or `BackupMode.FAILED`, a bucket will be created for you.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.s3.IBucket getBucket() {
return null;
}
/**
* (experimental) If true, log errors when data transformation or data delivery fails.
*
* If logGroup
is provided, this will be implicitly set to true
.
*
* Default: true - errors are logged.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Boolean getLogging() {
return null;
}
/**
* (experimental) The CloudWatch log group where log streams will be created to hold error logs.
*
* Default: - if `logging` is set to `true`, a log group will be created for you.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.logs.ILogGroup getLogGroup() {
return null;
}
/**
* (experimental) Indicates the mode by which incoming records should be backed up to S3, if any.
*
* If bucket
is provided, this will be implicitly set to BackupMode.ALL
.
*
* Default: - If `bucket` is provided, the default will be `BackupMode.ALL`. Otherwise,
* source records are not backed up to S3.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.kinesisfirehose.destinations.BackupMode getMode() {
return null;
}
/**
* @return a {@link Builder} of {@link DestinationS3BackupProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link DestinationS3BackupProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
software.amazon.awscdk.services.s3.IBucket bucket;
java.lang.Boolean logging;
software.amazon.awscdk.services.logs.ILogGroup logGroup;
software.amazon.awscdk.services.kinesisfirehose.destinations.BackupMode mode;
software.amazon.awscdk.core.Duration bufferingInterval;
software.amazon.awscdk.core.Size bufferingSize;
software.amazon.awscdk.services.kinesisfirehose.destinations.Compression compression;
java.lang.String dataOutputPrefix;
software.amazon.awscdk.services.kms.IKey encryptionKey;
java.lang.String errorOutputPrefix;
/**
* Sets the value of {@link DestinationS3BackupProps#getBucket}
* @param bucket The S3 bucket that will store data and failed records.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder bucket(software.amazon.awscdk.services.s3.IBucket bucket) {
this.bucket = bucket;
return this;
}
/**
* Sets the value of {@link DestinationS3BackupProps#getLogging}
* @param logging If true, log errors when data transformation or data delivery fails.
* If logGroup
is provided, this will be implicitly set to true
.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder logging(java.lang.Boolean logging) {
this.logging = logging;
return this;
}
/**
* Sets the value of {@link DestinationS3BackupProps#getLogGroup}
* @param logGroup The CloudWatch log group where log streams will be created to hold error logs.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder logGroup(software.amazon.awscdk.services.logs.ILogGroup logGroup) {
this.logGroup = logGroup;
return this;
}
/**
* Sets the value of {@link DestinationS3BackupProps#getMode}
* @param mode Indicates the mode by which incoming records should be backed up to S3, if any.
* If bucket
is provided, this will be implicitly set to BackupMode.ALL
.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder mode(software.amazon.awscdk.services.kinesisfirehose.destinations.BackupMode mode) {
this.mode = mode;
return this;
}
/**
* Sets the value of {@link DestinationS3BackupProps#getBufferingInterval}
* @param bufferingInterval The length of time that Firehose buffers incoming data before delivering it to the S3 bucket.
* Minimum: Duration.seconds(60)
* Maximum: Duration.seconds(900)
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder bufferingInterval(software.amazon.awscdk.core.Duration bufferingInterval) {
this.bufferingInterval = bufferingInterval;
return this;
}
/**
* Sets the value of {@link DestinationS3BackupProps#getBufferingSize}
* @param bufferingSize The size of the buffer that Kinesis Data Firehose uses for incoming data before delivering it to the S3 bucket.
* Minimum: Size.mebibytes(1)
* Maximum: Size.mebibytes(128)
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder bufferingSize(software.amazon.awscdk.core.Size bufferingSize) {
this.bufferingSize = bufferingSize;
return this;
}
/**
* Sets the value of {@link DestinationS3BackupProps#getCompression}
* @param compression The type of compression that Kinesis Data Firehose uses to compress the data that it delivers to the Amazon S3 bucket.
* The compression formats SNAPPY or ZIP cannot be specified for Amazon Redshift
* destinations because they are not supported by the Amazon Redshift COPY operation
* that reads from the S3 bucket.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder compression(software.amazon.awscdk.services.kinesisfirehose.destinations.Compression compression) {
this.compression = compression;
return this;
}
/**
* Sets the value of {@link DestinationS3BackupProps#getDataOutputPrefix}
* @param dataOutputPrefix A prefix that Kinesis Data Firehose evaluates and adds to records before writing them to S3.
* This prefix appears immediately following the bucket name.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder dataOutputPrefix(java.lang.String dataOutputPrefix) {
this.dataOutputPrefix = dataOutputPrefix;
return this;
}
/**
* Sets the value of {@link DestinationS3BackupProps#getEncryptionKey}
* @param encryptionKey The AWS KMS key used to encrypt the data that it delivers to your Amazon S3 bucket.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder encryptionKey(software.amazon.awscdk.services.kms.IKey encryptionKey) {
this.encryptionKey = encryptionKey;
return this;
}
/**
* Sets the value of {@link DestinationS3BackupProps#getErrorOutputPrefix}
* @param errorOutputPrefix A prefix that Kinesis Data Firehose evaluates and adds to failed records before writing them to S3.
* This prefix appears immediately following the bucket name.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder errorOutputPrefix(java.lang.String errorOutputPrefix) {
this.errorOutputPrefix = errorOutputPrefix;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link DestinationS3BackupProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public DestinationS3BackupProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link DestinationS3BackupProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements DestinationS3BackupProps {
private final software.amazon.awscdk.services.s3.IBucket bucket;
private final java.lang.Boolean logging;
private final software.amazon.awscdk.services.logs.ILogGroup logGroup;
private final software.amazon.awscdk.services.kinesisfirehose.destinations.BackupMode mode;
private final software.amazon.awscdk.core.Duration bufferingInterval;
private final software.amazon.awscdk.core.Size bufferingSize;
private final software.amazon.awscdk.services.kinesisfirehose.destinations.Compression compression;
private final java.lang.String dataOutputPrefix;
private final software.amazon.awscdk.services.kms.IKey encryptionKey;
private final java.lang.String errorOutputPrefix;
/**
* 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.bucket = software.amazon.jsii.Kernel.get(this, "bucket", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.s3.IBucket.class));
this.logging = software.amazon.jsii.Kernel.get(this, "logging", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
this.logGroup = software.amazon.jsii.Kernel.get(this, "logGroup", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.logs.ILogGroup.class));
this.mode = software.amazon.jsii.Kernel.get(this, "mode", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.kinesisfirehose.destinations.BackupMode.class));
this.bufferingInterval = software.amazon.jsii.Kernel.get(this, "bufferingInterval", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.core.Duration.class));
this.bufferingSize = software.amazon.jsii.Kernel.get(this, "bufferingSize", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.core.Size.class));
this.compression = software.amazon.jsii.Kernel.get(this, "compression", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.kinesisfirehose.destinations.Compression.class));
this.dataOutputPrefix = software.amazon.jsii.Kernel.get(this, "dataOutputPrefix", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.encryptionKey = software.amazon.jsii.Kernel.get(this, "encryptionKey", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.kms.IKey.class));
this.errorOutputPrefix = software.amazon.jsii.Kernel.get(this, "errorOutputPrefix", software.amazon.jsii.NativeType.forClass(java.lang.String.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.bucket = builder.bucket;
this.logging = builder.logging;
this.logGroup = builder.logGroup;
this.mode = builder.mode;
this.bufferingInterval = builder.bufferingInterval;
this.bufferingSize = builder.bufferingSize;
this.compression = builder.compression;
this.dataOutputPrefix = builder.dataOutputPrefix;
this.encryptionKey = builder.encryptionKey;
this.errorOutputPrefix = builder.errorOutputPrefix;
}
@Override
public final software.amazon.awscdk.services.s3.IBucket getBucket() {
return this.bucket;
}
@Override
public final java.lang.Boolean getLogging() {
return this.logging;
}
@Override
public final software.amazon.awscdk.services.logs.ILogGroup getLogGroup() {
return this.logGroup;
}
@Override
public final software.amazon.awscdk.services.kinesisfirehose.destinations.BackupMode getMode() {
return this.mode;
}
@Override
public final software.amazon.awscdk.core.Duration getBufferingInterval() {
return this.bufferingInterval;
}
@Override
public final software.amazon.awscdk.core.Size getBufferingSize() {
return this.bufferingSize;
}
@Override
public final software.amazon.awscdk.services.kinesisfirehose.destinations.Compression getCompression() {
return this.compression;
}
@Override
public final java.lang.String getDataOutputPrefix() {
return this.dataOutputPrefix;
}
@Override
public final software.amazon.awscdk.services.kms.IKey getEncryptionKey() {
return this.encryptionKey;
}
@Override
public final java.lang.String getErrorOutputPrefix() {
return this.errorOutputPrefix;
}
@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.getBucket() != null) {
data.set("bucket", om.valueToTree(this.getBucket()));
}
if (this.getLogging() != null) {
data.set("logging", om.valueToTree(this.getLogging()));
}
if (this.getLogGroup() != null) {
data.set("logGroup", om.valueToTree(this.getLogGroup()));
}
if (this.getMode() != null) {
data.set("mode", om.valueToTree(this.getMode()));
}
if (this.getBufferingInterval() != null) {
data.set("bufferingInterval", om.valueToTree(this.getBufferingInterval()));
}
if (this.getBufferingSize() != null) {
data.set("bufferingSize", om.valueToTree(this.getBufferingSize()));
}
if (this.getCompression() != null) {
data.set("compression", om.valueToTree(this.getCompression()));
}
if (this.getDataOutputPrefix() != null) {
data.set("dataOutputPrefix", om.valueToTree(this.getDataOutputPrefix()));
}
if (this.getEncryptionKey() != null) {
data.set("encryptionKey", om.valueToTree(this.getEncryptionKey()));
}
if (this.getErrorOutputPrefix() != null) {
data.set("errorOutputPrefix", om.valueToTree(this.getErrorOutputPrefix()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@aws-cdk/aws-kinesisfirehose-destinations.DestinationS3BackupProps"));
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;
DestinationS3BackupProps.Jsii$Proxy that = (DestinationS3BackupProps.Jsii$Proxy) o;
if (this.bucket != null ? !this.bucket.equals(that.bucket) : that.bucket != null) return false;
if (this.logging != null ? !this.logging.equals(that.logging) : that.logging != null) return false;
if (this.logGroup != null ? !this.logGroup.equals(that.logGroup) : that.logGroup != null) return false;
if (this.mode != null ? !this.mode.equals(that.mode) : that.mode != null) return false;
if (this.bufferingInterval != null ? !this.bufferingInterval.equals(that.bufferingInterval) : that.bufferingInterval != null) return false;
if (this.bufferingSize != null ? !this.bufferingSize.equals(that.bufferingSize) : that.bufferingSize != null) return false;
if (this.compression != null ? !this.compression.equals(that.compression) : that.compression != null) return false;
if (this.dataOutputPrefix != null ? !this.dataOutputPrefix.equals(that.dataOutputPrefix) : that.dataOutputPrefix != null) return false;
if (this.encryptionKey != null ? !this.encryptionKey.equals(that.encryptionKey) : that.encryptionKey != null) return false;
return this.errorOutputPrefix != null ? this.errorOutputPrefix.equals(that.errorOutputPrefix) : that.errorOutputPrefix == null;
}
@Override
public final int hashCode() {
int result = this.bucket != null ? this.bucket.hashCode() : 0;
result = 31 * result + (this.logging != null ? this.logging.hashCode() : 0);
result = 31 * result + (this.logGroup != null ? this.logGroup.hashCode() : 0);
result = 31 * result + (this.mode != null ? this.mode.hashCode() : 0);
result = 31 * result + (this.bufferingInterval != null ? this.bufferingInterval.hashCode() : 0);
result = 31 * result + (this.bufferingSize != null ? this.bufferingSize.hashCode() : 0);
result = 31 * result + (this.compression != null ? this.compression.hashCode() : 0);
result = 31 * result + (this.dataOutputPrefix != null ? this.dataOutputPrefix.hashCode() : 0);
result = 31 * result + (this.encryptionKey != null ? this.encryptionKey.hashCode() : 0);
result = 31 * result + (this.errorOutputPrefix != null ? this.errorOutputPrefix.hashCode() : 0);
return result;
}
}
}