File tree 1 file changed +9
-2
lines changed
packages/aws-cdk-lib/aws-lambda/lib
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -292,8 +292,15 @@ export interface IEventSourceMapping extends cdk.IResource {
292
292
* Usually, you won't need to define the mapping yourself. This will usually be done by
293
293
* event sources. For example, to add an SQS event source to a function:
294
294
*
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
+ * ```
297
304
*
298
305
* The `SqsEventSource` class will automatically create the mapping, and will also
299
306
* modify the Lambda's execution role so it can consume messages from the queue.
You can’t perform that action at this time.
0 commit comments