![JAR search and dependency download from the Maven repository](/logo.png)
io.cloudshiftdev.awscdk.services.lambda.eventsources.ManagedKafkaEventSource.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.services.kms.IKey
import io.cloudshiftdev.awscdk.services.lambda.IEventSourceDlq
import io.cloudshiftdev.awscdk.services.lambda.IFunction
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
/**
* Use a MSK cluster as a streaming source for AWS Lambda.
*
* Example:
*
* ```
* import io.cloudshiftdev.awscdk.services.secretsmanager.Secret;
* import io.cloudshiftdev.awscdk.services.lambda.eventsources.ManagedKafkaEventSource;
* Function myFunction;
* // Your MSK cluster arn
* String clusterArn =
* "arn:aws:kafka:us-east-1:0123456789019:cluster/SalesCluster/abcd1234-abcd-cafe-abab-9876543210ab-4";
* // The Kafka topic you want to subscribe to
* String topic = "some-cool-topic";
* // The secret that allows access to your MSK cluster
* // You still have to make sure that it is associated with your cluster as described in the
* documentation
* Secret secret = Secret.Builder.create(this,
* "Secret").secretName("AmazonMSK_KafkaSecret").build();
* myFunction.addEventSource(ManagedKafkaEventSource.Builder.create()
* .clusterArn(clusterArn)
* .topic(topic)
* .secret(secret)
* .batchSize(100) // default
* .startingPosition(StartingPosition.TRIM_HORIZON)
* .build());
* ```
*/
public open class ManagedKafkaEventSource(
cdkObject: software.amazon.awscdk.services.lambda.eventsources.ManagedKafkaEventSource,
) : StreamEventSource(cdkObject) {
public constructor(props: ManagedKafkaEventSourceProps) :
this(software.amazon.awscdk.services.lambda.eventsources.ManagedKafkaEventSource(props.let(ManagedKafkaEventSourceProps.Companion::unwrap))
)
public constructor(props: ManagedKafkaEventSourceProps.Builder.() -> Unit) :
this(ManagedKafkaEventSourceProps(props)
)
/**
* Called by `lambda.addEventSource` to allow the event source to bind to this function.
*
* @param target
*/
public override fun bind(target: IFunction) {
unwrap(this).bind(target.let(IFunction.Companion::unwrap))
}
/**
* The ARN for this EventSourceMapping.
*/
public open fun eventSourceMappingArn(): String = unwrap(this).getEventSourceMappingArn()
/**
* The identifier for this EventSourceMapping.
*/
public open fun eventSourceMappingId(): String = unwrap(this).getEventSourceMappingId()
/**
* A fluent builder for
* [io.cloudshiftdev.awscdk.services.lambda.eventsources.ManagedKafkaEventSource].
*/
@CdkDslMarker
public interface Builder {
/**
* 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`
*
*
* Default: 100
*
* @param batchSize The largest number of records that AWS Lambda will retrieve from your event
* source at the time of invoking your function.
*/
public fun batchSize(batchSize: Number)
/**
* An MSK cluster construct.
*
* @param clusterArn An MSK cluster construct.
*/
public fun clusterArn(clusterArn: String)
/**
* 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-/
* *:_+=.@-]*'.
*
* Default: - none
*
* [Documentation](https://docs.aws.amazon.com/lambda/latest/dg/with-msk.html#services-msk-consumer-group-id)
* @param consumerGroupId The identifier for the Kafka consumer group to join.
*/
public fun consumerGroupId(consumerGroupId: String)
/**
* If the stream event source mapping should be enabled.
*
* Default: true
*
* @param enabled If the stream event source mapping should be enabled.
*/
public fun enabled(enabled: Boolean)
/**
* Add Customer managed KMS key to encrypt Filter Criteria.
*
* Default: - none
*
* [Documentation](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk)
* @param filterEncryption Add Customer managed KMS key to encrypt Filter Criteria.
*/
public fun filterEncryption(filterEncryption: IKey)
/**
* Add filter criteria to Event Source.
*
* Default: - none
*
* [Documentation](https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventfiltering.html)
* @param filters Add filter criteria to Event Source.
*/
public fun filters(filters: List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy