From 65ffc88d2c9ac1cd782b66bded2f95750d749e1a Mon Sep 17 00:00:00 2001 From: Jorge Diaz Alvarado Date: Thu, 5 Jun 2025 17:51:25 +0200 Subject: [PATCH] updated onEvent example implementation to follow better coding practices --- .../example-construct-library/lib/example-resource.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/@aws-cdk/example-construct-library/lib/example-resource.ts b/packages/@aws-cdk/example-construct-library/lib/example-resource.ts index f9f423c3c7aa3..00abab83f17fc 100644 --- a/packages/@aws-cdk/example-construct-library/lib/example-resource.ts +++ b/packages/@aws-cdk/example-construct-library/lib/example-resource.ts @@ -201,7 +201,11 @@ abstract class ExampleResourceBase extends Resource implements IExampleResource * as it simplifies the implementation code (less branching). */ public onEvent(id: string, options: events.OnEventOptions = {}): events.Rule { - const rule = new events.Rule(this, id, options); + const rule = new events.Rule(this, id, { + description: options.description, + ruleName: options.ruleName, + crossStackScope: options.crossStackScope, + }); rule.addTarget(options.target); rule.addEventPattern({ // obviously, you would put your resource-specific values here