From bba099a5379edac34375ad8e4cc08d843416760c Mon Sep 17 00:00:00 2001 From: Roger Zhang Date: Wed, 27 Mar 2024 00:42:19 -0700 Subject: [PATCH] docs(lambda-event-source): improve docstring in KinesisEventSourceProps (#29582) ### Issue # (if applicable) Closes #27321 ### Reason for this change Our customer found `maxRecordAge` can't be set to `-1` Due to limitation of `cdk.Duration`. However, it's not obvious in the docstring that the [default value](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-maximumrecordageinseconds) of `maxRecordAge` is already -1. Our customer can simply leave this prop empty to set it to -1. So, This PR improves the docstring to make default value more apparent. See more discussion in the ticket. ### Description of changes Improve docstring of `maxRecordAge` and `retryAttempts` in `KinesisEventSourceProps` in `aws-lambda-event-source` ### Description of how you validated changes ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../aws-lambda-event-sources/lib/stream.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/aws-cdk-lib/aws-lambda-event-sources/lib/stream.ts b/packages/aws-cdk-lib/aws-lambda-event-sources/lib/stream.ts index cd78ca0520f4e..46b20d01e1787 100644 --- a/packages/aws-cdk-lib/aws-lambda-event-sources/lib/stream.ts +++ b/packages/aws-cdk-lib/aws-lambda-event-sources/lib/stream.ts @@ -63,7 +63,11 @@ export interface StreamEventSourceProps extends BaseStreamEventSourceProps { * * Minimum value of 60 seconds * * Maximum value of 7 days * - * @default - the retention period configured on the stream + * The default value is -1, which sets the maximum age to infinite. + * When the value is set to infinite, Lambda never discards old records. + * Record are valid until it expires in the event source. + * + * @default -1 */ readonly maxRecordAge?: Duration; @@ -73,7 +77,11 @@ export interface StreamEventSourceProps extends BaseStreamEventSourceProps { * * Minimum value of 0 * * Maximum value of 10000 * - * @default - retry until the record expires + * The default value is -1, which sets the maximum number of retries to infinite. + * When MaximumRetryAttempts is infinite, Lambda retries failed records until + * the record expires in the event source. + * + * @default -1 */ readonly retryAttempts?: number;