diff --git a/allowed-breaking-changes.txt b/allowed-breaking-changes.txt index fa3498335f679..56b1145d61b39 100644 --- a/allowed-breaking-changes.txt +++ b/allowed-breaking-changes.txt @@ -93,3 +93,26 @@ incompatible-argument:@aws-cdk/aws-autoscaling-hooktargets.FunctionHook.bind incompatible-argument:@aws-cdk/aws-autoscaling-hooktargets.QueueHook.bind incompatible-argument:@aws-cdk/aws-autoscaling-hooktargets.TopicHook.bind incompatible-argument:@aws-cdk/aws-autoscaling.ILifecycleHookTarget.bind + +# removed properties from kafka eventsources as they are not supported +removed:@aws-cdk/aws-lambda-event-sources.KafkaEventSourceProps.bisectBatchOnError +removed:@aws-cdk/aws-lambda-event-sources.KafkaEventSourceProps.maxRecordAge +removed:@aws-cdk/aws-lambda-event-sources.KafkaEventSourceProps.parallelizationFactor +removed:@aws-cdk/aws-lambda-event-sources.KafkaEventSourceProps.reportBatchItemFailures +removed:@aws-cdk/aws-lambda-event-sources.KafkaEventSourceProps.retryAttempts +removed:@aws-cdk/aws-lambda-event-sources.KafkaEventSourceProps.tumblingWindow +removed:@aws-cdk/aws-lambda-event-sources.ManagedKafkaEventSourceProps.bisectBatchOnError +removed:@aws-cdk/aws-lambda-event-sources.ManagedKafkaEventSourceProps.maxRecordAge +removed:@aws-cdk/aws-lambda-event-sources.ManagedKafkaEventSourceProps.parallelizationFactor +removed:@aws-cdk/aws-lambda-event-sources.ManagedKafkaEventSourceProps.reportBatchItemFailures +removed:@aws-cdk/aws-lambda-event-sources.ManagedKafkaEventSourceProps.retryAttempts +removed:@aws-cdk/aws-lambda-event-sources.ManagedKafkaEventSourceProps.tumblingWindow +removed:@aws-cdk/aws-lambda-event-sources.SelfManagedKafkaEventSourceProps.bisectBatchOnError +removed:@aws-cdk/aws-lambda-event-sources.SelfManagedKafkaEventSourceProps.maxRecordAge +removed:@aws-cdk/aws-lambda-event-sources.SelfManagedKafkaEventSourceProps.parallelizationFactor +removed:@aws-cdk/aws-lambda-event-sources.SelfManagedKafkaEventSourceProps.reportBatchItemFailures +removed:@aws-cdk/aws-lambda-event-sources.SelfManagedKafkaEventSourceProps.retryAttempts +removed:@aws-cdk/aws-lambda-event-sources.SelfManagedKafkaEventSourceProps.tumblingWindow +base-types:@aws-cdk/aws-lambda-event-sources.KafkaEventSourceProps +base-types:@aws-cdk/aws-lambda-event-sources.ManagedKafkaEventSourceProps +base-types:@aws-cdk/aws-lambda-event-sources.SelfManagedKafkaEventSourceProps \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda-event-sources/lib/kafka.ts b/packages/@aws-cdk/aws-lambda-event-sources/lib/kafka.ts index e31fac89100cb..1918ec2756c84 100644 --- a/packages/@aws-cdk/aws-lambda-event-sources/lib/kafka.ts +++ b/packages/@aws-cdk/aws-lambda-event-sources/lib/kafka.ts @@ -4,7 +4,7 @@ import * as iam from '@aws-cdk/aws-iam'; import * as lambda from '@aws-cdk/aws-lambda'; import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; import { Stack, Names } from '@aws-cdk/core'; -import { StreamEventSource, StreamEventSourceProps } from './stream'; +import { StreamEventSource, BaseStreamEventSourceProps } from './stream'; // keep this import separate from other imports to reduce chance for merge conflicts with v2-main // eslint-disable-next-line no-duplicate-imports, import/order @@ -13,7 +13,7 @@ import { Construct } from '@aws-cdk/core'; /** * Properties for a Kafka event source */ -export interface KafkaEventSourceProps extends StreamEventSourceProps { +export interface KafkaEventSourceProps extends BaseStreamEventSourceProps{ /** * The Kafka topic to subscribe to */ diff --git a/packages/@aws-cdk/aws-lambda-event-sources/lib/stream.ts b/packages/@aws-cdk/aws-lambda-event-sources/lib/stream.ts index 01288efb21a6c..462387397b629 100644 --- a/packages/@aws-cdk/aws-lambda-event-sources/lib/stream.ts +++ b/packages/@aws-cdk/aws-lambda-event-sources/lib/stream.ts @@ -5,7 +5,7 @@ import { Duration } from '@aws-cdk/core'; * The set of properties for event sources that follow the streaming model, * such as, Dynamo, Kinesis and Kafka. */ -export interface StreamEventSourceProps { +export interface BaseStreamEventSourceProps{ /** * 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 @@ -15,25 +15,51 @@ export interface StreamEventSourceProps { * * Minimum value of 1 * * Maximum value of: * * 1000 for {@link DynamoEventSource} - * * 10000 for {@link KinesisEventSource} + * * 10000 for {@link KinesisEventSource}, {@link ManagedKafkaEventSource} and {@link SelfManagedKafkaEventSource} * * @default 100 */ readonly batchSize?: number; /** - * If the function returns an error, split the batch in two and retry. + * An Amazon SQS queue or Amazon SNS topic destination for discarded records. * - * @default false + * @default discarded records are ignored */ - readonly bisectBatchOnError?: boolean; + readonly onFailure?: lambda.IEventSourceDlq; /** - * An Amazon SQS queue or Amazon SNS topic destination for discarded records. + * Where to begin consuming the stream. + */ + readonly startingPosition: lambda.StartingPosition; + + /** + * The maximum amount of time to gather records before invoking the function. + * Maximum of Duration.minutes(5) * - * @default discarded records are ignored + * @default Duration.seconds(0) */ - readonly onFailure?: lambda.IEventSourceDlq; + readonly maxBatchingWindow?: Duration; + + /** + * If the stream event source mapping should be enabled. + * + * @default true + */ + readonly enabled?: boolean; +} + +/** + * The set of properties for event sources that follow the streaming model, + * such as, Dynamo, Kinesis. + */ +export interface StreamEventSourceProps extends BaseStreamEventSourceProps { + /** + * If the function returns an error, split the batch in two and retry. + * + * @default false + */ + readonly bisectBatchOnError?: boolean; /** * The maximum age of a record that Lambda sends to a function for processing. @@ -65,11 +91,6 @@ export interface StreamEventSourceProps { */ readonly parallelizationFactor?: number; - /** - * Where to begin consuming the stream. - */ - readonly startingPosition: lambda.StartingPosition; - /** * Allow functions to return partially successful responses for a batch of records. * @@ -79,14 +100,6 @@ export interface StreamEventSourceProps { */ readonly reportBatchItemFailures?: boolean; - /** - * The maximum amount of time to gather records before invoking the function. - * Maximum of Duration.minutes(5) - * - * @default Duration.seconds(0) - */ - readonly maxBatchingWindow?: Duration; - /** * The size of the tumbling windows to group records sent to DynamoDB or Kinesis * Valid Range: 0 - 15 minutes @@ -94,13 +107,6 @@ export interface StreamEventSourceProps { * @default - None */ readonly tumblingWindow?: Duration; - - /** - * If the stream event source mapping should be enabled. - * - * @default true - */ - readonly enabled?: boolean; } /**