question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

EventBridge matcher support

See original GitHub issue

EventBridge had release improved set of matchers for it’s Pattern by end of 2019. This had been described in detail in Blog post and Documentation page

The current implementation of EventPattern needs to be changed to address it: https://github.com/aws/aws-cdk/blob/master/packages/@aws-cdk/aws-events/lib/event-pattern.ts#L30

The operators to be supported:

  • Prefix
  • AnythingBut
  • Numeric
  • Exists

Use Case

The use case is to allow customer use the full capabilities of EventBridge pattern matching through CDK.

Proposed Solution

This is to be discuss, I would like to expand the existing way using the union like structure that would convert the existing definition from i.e.:

readonly source?: string[]

into:

readonly source?: string[] | Prefix | AnythingBut | Exists | Numeric 

Providing the this can be supported by CDK transcompilation.

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:22
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

16reactions
ryanvadecommented, Feb 12, 2020

Apparently this works for now:

source: [ { prefix: "your.prefix.here"} ] as any[]
5reactions
davecapcommented, Aug 19, 2021

Is there a known workaround for CDK Python?

UPDATE: Here is a workaround for Python

rule = events.Rule(
    ...
    # set dummy pattern
    event_pattern=events.EventPattern(account=[self.account])
)
# Use "escape hatch" to set the pattern
rule.node.default_child.event_pattern = {
    "field": [{"prefix": "your.prefix."}]
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Amazon EventBridge event patterns - AWS Documentation
Event patterns have the same structure as the events they match. ... Not all comparison operators are currently supported by EventBridge Pipes.
Read more >
EventBridge event patterns - Alibaba Cloud
Note Only IPv4 addresses are supported. Event matching based on a combined condition. You can combine multiple filter rules as a matching ......
Read more >
How can I create a custom event pattern for an EventBridge ...
... Knowledge Center article with this video: https://aws.amazon.com/premiumsupport/knowledge-center/ eventbridge -create-custom-event-pat...
Read more >
Creating Amazon EventBridge rules that react to events
If you want this rule to match events that come from your account, select Amazon default event bus. When an Amazon Web Service...
Read more >
AWS Lambda Events - Event Bridge - Serverless Framework
With 2.27.0 an optional support for native CloudFormation was introduced and can be ... Here is an example that uses "prefix matching" to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Hashnode Post

No results found