Note: for support questions, please first reference our documentation, then use Stackoverflow. This repository's issues are intended for feature requests and bug reports.
I'm submitting a ...
What is the current behavior?
If the current behavior is a :beetle:bug:beetle:: Please provide the steps to reproduce
I can create a CloudWatch Event Rule that uses a Schedule as follows:
new events.Rule(this, "heartbeat_rule", {
schedule: events.Schedule.expression("rate(30 minutes)"),
...
});
But if I try to do that with an EventPattern, it is undefined. Example:
new events.Rule(this, "heartbeat_rule", {
eventPattern: events.EventPattern.source([...]),
...
});
events.EventPattern is undefined.
EventPattern as described in the docs here: https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-events.Rule.htmlI can't figure out how to use an EventPattern though. I think maybe because it is an Interface, but nothing seem to implement that Interface.
What is the motivation / use case for changing the behavior or adding this feature?
I want to create a CloudWatch Events Rule to receive GuardDuty events.
Please tell us about your environment:
Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. associated pull-request, stackoverflow, gitter, etc)
new events.Rule(this, "heartbeat_rule", {
eventPattern: events.EventPattern.source([...]),
...
});
I'm not even sure how the proposed code compiles. EventPattern is an interface, not a class, so this can't work in either TypeScript or JavaScript.
The correct syntax would be:
new events.Rule(this, "heartbeat_rule", {
eventPattern: {
source: ['...']
},
});
I will admit it's not super obvious that one uses a class constructor and the other one uses an object literal.
Please reopen if you have further questions or remarks.
Most helpful comment
I'm not even sure how the proposed code compiles.
EventPatternis an interface, not a class, so this can't work in either TypeScript or JavaScript.The correct syntax would be:
I will admit it's not super obvious that one uses a class constructor and the other one uses an object literal.