Skip to content

Commit 65ffc88

Browse files
author
Jorge Diaz Alvarado
committed
updated onEvent example implementation to follow better coding practices
1 parent 29e0ccf commit 65ffc88

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/@aws-cdk/example-construct-library/lib/example-resource.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,11 @@ abstract class ExampleResourceBase extends Resource implements IExampleResource
201201
* as it simplifies the implementation code (less branching).
202202
*/
203203
public onEvent(id: string, options: events.OnEventOptions = {}): events.Rule {
204-
const rule = new events.Rule(this, id, options);
204+
const rule = new events.Rule(this, id, {
205+
description: options.description,
206+
ruleName: options.ruleName,
207+
crossStackScope: options.crossStackScope,
208+
});
205209
rule.addTarget(options.target);
206210
rule.addEventPattern({
207211
// obviously, you would put your resource-specific values here

0 commit comments

Comments
 (0)