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:
The use case is to allow customer use the full capabilities of EventBridge pattern matching through CDK.
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.
This is a :rocket: Feature Request
We don't support unions in our transcompilation. We usually follow the pattern of a union-like class with static factory functions.
Then I don't see other way to support this without changing the types from
readonly attribute?: string[]
into
readonly attribute?: any[]
In language like Java this is going to be backward compatible change as the array are covariant, though not sure about other cases.
Note that https://github.com/aws/aws-cdk/issues/5205 is still relevant here. For example, when using [{ "exists": true }] the generated template preserves the booleans but the CF deployment fails with Reason: exists match pattern must be either true or false...
Apparently this works for now:
source: [ { prefix: "your.prefix.here"} ] as any[]
is there a workaround for {exists: right now?
Most helpful comment
Apparently this works for now: