Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

target should be made optional in OnEventOptions #2913

Closed
jogold opened this issue Jun 18, 2019 · 0 comments · Fixed by #2921 or MechanicalRock/tech-radar#14 · May be fixed by MechanicalRock/cdk-constructs#5, MechanicalRock/cdk-constructs#6 or MechanicalRock/cdk-constructs#7
Labels
@aws-cdk/core Related to core CDK functionality feature-request A feature should be added or improved.

Comments

@jogold
Copy link
Contributor

jogold commented Jun 18, 2019

https://github.com/awslabs/aws-cdk/blob/60f46c830e7e27dd8d5339c53166a07174ce3a4b/packages/%40aws-cdk/aws-events/lib/on-event-options.ts#L7-L16

Making target optional allows to use the rule returned by the onXxx() in another construct that will call addTarget().

const onCommitRule = repo.onCommit('CommitEvent'); // event pattern is correctly set up
                                                   // don't want to set the target here

const other = new ComplexConstructThatCallsAddTarget(this, 'Complex', {
  rule: onCommitRule
});
@jogold jogold added the feature-request A feature should be added or improved. label Jun 18, 2019
@NGL321 NGL321 added needs-triage This issue or PR still needs to be triaged. @aws-cdk/core Related to core CDK functionality and removed needs-triage This issue or PR still needs to be triaged. labels Jun 18, 2019
jogold added a commit to jogold/aws-cdk that referenced this issue Jun 19, 2019
Make `target` optional in `OnEventOptions` so that it is no required when calling a `onXxx()`
method.

This allows to use "preconfigured" rules on other constructs.

Closes aws#2913
jogold added a commit to jogold/aws-cdk that referenced this issue Jun 19, 2019
Make `target` optional in `OnEventOptions` so that it is no required when calling a `onXxx()`
method.

This allows to use "preconfigured" rules in other constructs.

Closes aws#2913
eladb pushed a commit that referenced this issue Jun 19, 2019
Make `target` optional in `OnEventOptions` so that it is no required when calling a `onXxx()`
method.

This allows to use "preconfigured" rules in other constructs.

Update `awslint:events-method-signature` to enforce optional `options` parameter in `onXxx()` method signatures.

Closes #2913
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment