Skip to content

Commit 1f8acc1

Browse files
authored
docs(lambda): add missing JSDoc Markdown code block (#29348)
### Reason for this change There is a missing Markdown code block in the [`EventSourceMapping` documentation](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.EventSourceMapping.html): ![image](https://github.com/aws/aws-cdk/assets/2505696/cb50ded7-a4b0-43f9-ace7-736d805b23d0) ### Description of changes Adds missing Markdown code block tags ### 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*
1 parent 946412b commit 1f8acc1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Diff for: packages/aws-cdk-lib/aws-lambda/lib/event-source-mapping.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,15 @@ export interface IEventSourceMapping extends cdk.IResource {
292292
* Usually, you won't need to define the mapping yourself. This will usually be done by
293293
* event sources. For example, to add an SQS event source to a function:
294294
*
295-
* import { SqsEventSource } from 'aws-cdk-lib/aws-lambda-event-sources';
296-
* lambda.addEventSource(new SqsEventSource(sqs));
295+
* ```ts
296+
* import * as sqs from 'aws-cdk-lib/aws-sqs';
297+
* import * as eventsources from 'aws-cdk-lib/aws-lambda-event-sources';
298+
*
299+
* declare const handler: lambda.Function;
300+
* declare const queue: sqs.Queue;
301+
*
302+
* handler.addEventSource(new eventsources.SqsEventSource(queue));
303+
* ```
297304
*
298305
* The `SqsEventSource` class will automatically create the mapping, and will also
299306
* modify the Lambda's execution role so it can consume messages from the queue.

0 commit comments

Comments
 (0)