![JAR search and dependency download from the Maven repository](/logo.png)
io.cloudshiftdev.awscdk.services.lambda.eventsources.SelfManagedKafkaEventSourceProps.kt Maven / Gradle / Ivy
@file:Suppress("RedundantVisibilityModifier","RedundantUnitReturnType","RemoveRedundantQualifierName","unused","UnusedImport","ClassName","REDUNDANT_PROJECTION","DEPRECATION")
package io.cloudshiftdev.awscdk.services.lambda.eventsources
import io.cloudshiftdev.awscdk.Duration
import io.cloudshiftdev.awscdk.common.CdkDslMarker
import io.cloudshiftdev.awscdk.common.CdkObject
import io.cloudshiftdev.awscdk.common.CdkObjectWrappers
import io.cloudshiftdev.awscdk.services.ec2.ISecurityGroup
import io.cloudshiftdev.awscdk.services.ec2.IVpc
import io.cloudshiftdev.awscdk.services.ec2.SubnetSelection
import io.cloudshiftdev.awscdk.services.kms.IKey
import io.cloudshiftdev.awscdk.services.lambda.IEventSourceDlq
import io.cloudshiftdev.awscdk.services.lambda.StartingPosition
import io.cloudshiftdev.awscdk.services.secretsmanager.ISecret
import kotlin.Any
import kotlin.Boolean
import kotlin.Number
import kotlin.String
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import kotlin.jvm.JvmName
/**
* Properties for a self managed Kafka cluster event source.
*
* If your Kafka cluster is only reachable via VPC make sure to configure it.
*
* Example:
*
* ```
* import io.cloudshiftdev.awscdk.services.secretsmanager.Secret;
* import io.cloudshiftdev.awscdk.services.lambda.eventsources.SelfManagedKafkaEventSource;
* // The secret that allows access to your self hosted Kafka cluster
* Secret secret;
* Function myFunction;
* // The list of Kafka brokers
* String[] bootstrapServers = List.of("kafka-broker:9092");
* // The Kafka topic you want to subscribe to
* String topic = "some-cool-topic";
* // (Optional) The consumer group id to use when connecting to the Kafka broker. If omitted the
* UUID of the event source mapping will be used.
* String consumerGroupId = "my-consumer-group-id";
* myFunction.addEventSource(SelfManagedKafkaEventSource.Builder.create()
* .bootstrapServers(bootstrapServers)
* .topic(topic)
* .consumerGroupId(consumerGroupId)
* .secret(secret)
* .batchSize(100) // default
* .startingPosition(StartingPosition.TRIM_HORIZON)
* .build());
* ```
*/
public interface SelfManagedKafkaEventSourceProps : KafkaEventSourceProps {
/**
* The authentication method for your Kafka cluster.
*
* Default: AuthenticationMethod.SASL_SCRAM_512_AUTH
*/
public fun authenticationMethod(): AuthenticationMethod? =
unwrap(this).getAuthenticationMethod()?.let(AuthenticationMethod::wrap)
/**
* The list of host and port pairs that are the addresses of the Kafka brokers in a "bootstrap"
* Kafka cluster that a Kafka client connects to initially to bootstrap itself.
*
* They are in the format `abc.xyz.com:xxxx`.
*/
public fun bootstrapServers(): List
/**
* The secret with the root CA certificate used by your Kafka brokers for TLS encryption This
* field is required if your Kafka brokers use certificates signed by a private CA.
*
* Default: - none
*/
public fun rootCACertificate(): ISecret? = unwrap(this).getRootCACertificate()?.let(ISecret::wrap)
/**
* If your Kafka brokers are only reachable via VPC, provide the security group here.
*
* Default: - none, required if setting vpc
*/
public fun securityGroup(): ISecurityGroup? =
unwrap(this).getSecurityGroup()?.let(ISecurityGroup::wrap)
/**
* If your Kafka brokers are only reachable via VPC provide the VPC here.
*
* Default: none
*/
public fun vpc(): IVpc? = unwrap(this).getVpc()?.let(IVpc::wrap)
/**
* If your Kafka brokers are only reachable via VPC, provide the subnets selection here.
*
* Default: - none, required if setting vpc
*/
public fun vpcSubnets(): SubnetSelection? =
unwrap(this).getVpcSubnets()?.let(SubnetSelection::wrap)
/**
* A builder for [SelfManagedKafkaEventSourceProps]
*/
@CdkDslMarker
public interface Builder {
/**
* @param authenticationMethod The authentication method for your Kafka cluster.
*/
public fun authenticationMethod(authenticationMethod: AuthenticationMethod)
/**
* @param batchSize The largest number of records that AWS Lambda will retrieve from your event
* source at the time of invoking your function.
* Your function receives an
* event with all the retrieved records.
*
* Valid Range:
*
* * Minimum value of 1
* * Maximum value of:
*
* * 1000 for `DynamoEventSource`
* * 10000 for `KinesisEventSource`, `ManagedKafkaEventSource` and `SelfManagedKafkaEventSource`
*/
public fun batchSize(batchSize: Number)
/**
* @param bootstrapServers The list of host and port pairs that are the addresses of the Kafka
* brokers in a "bootstrap" Kafka cluster that a Kafka client connects to initially to bootstrap
* itself.
* They are in the format `abc.xyz.com:xxxx`.
*/
public fun bootstrapServers(bootstrapServers: List)
/**
* @param bootstrapServers The list of host and port pairs that are the addresses of the Kafka
* brokers in a "bootstrap" Kafka cluster that a Kafka client connects to initially to bootstrap
* itself.
* They are in the format `abc.xyz.com:xxxx`.
*/
public fun bootstrapServers(vararg bootstrapServers: String)
/**
* @param consumerGroupId The identifier for the Kafka consumer group to join.
* The consumer group ID must be unique among all your Kafka event sources. After creating a
* Kafka event source mapping with the consumer group ID specified, you cannot update this value.
* The value must have a lenght between 1 and 200 and full the pattern '[a-zA-Z0-9-/
* *:_+=.@-]*'.
*/
public fun consumerGroupId(consumerGroupId: String)
/**
* @param enabled If the stream event source mapping should be enabled.
*/
public fun enabled(enabled: Boolean)
/**
* @param filterEncryption Add Customer managed KMS key to encrypt Filter Criteria.
*/
public fun filterEncryption(filterEncryption: IKey)
/**
* @param filters Add filter criteria to Event Source.
*/
public fun filters(filters: List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy