Skip to content

Commit

Permalink
fix(aws-events): ruleName can now be specified (#726)
Browse files Browse the repository at this point in the history
Fix bug where ruleName property would not be propagated to the L1.

Fixes #708.
  • Loading branch information
rix0rrr authored Sep 17, 2018
1 parent 9e7d311 commit a7bc5ee
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-events/lib/rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export class EventRule extends EventRuleRef {
super(parent, name);

const resource = new cloudformation.RuleResource(this, 'Resource', {
ruleName: props.ruleName,
description: props.description,
state: props.enabled == null ? 'ENABLED' : (props.enabled ? 'ENABLED' : 'DISABLED'),
scheduleExpression: new Token(() => this.scheduleExpression),
Expand Down
20 changes: 19 additions & 1 deletion packages/@aws-cdk/aws-events/test/test.rule.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect } from '@aws-cdk/assert';
import { expect, haveResource } from '@aws-cdk/assert';
import iam = require('@aws-cdk/aws-iam');
import cdk = require('@aws-cdk/cdk');
import { resolve } from '@aws-cdk/cdk';
Expand Down Expand Up @@ -30,6 +30,24 @@ export = {
test.done();
},

'rule with physical name'(test: Test) {
// GIVEN
const stack = new cdk.Stack();

// WHEN
new EventRule(stack, 'MyRule', {
ruleName: 'PhysicalName',
scheduleExpression: 'rate(10 minutes)'
});

// THEN
expect(stack).to(haveResource('AWS::Events::Rule', {
Name: 'PhysicalName'
}));

test.done();
},

'eventPattern is rendered properly'(test: Test) {
const stack = new cdk.Stack();

Expand Down

0 comments on commit a7bc5ee

Please sign in to comment.