Skip to content

feature request: Add support for arrays in EventBridge event patterns #7946

@bruno-imx

Description

@bruno-imx

Is there an existing issue for this?

  • I have searched the existing issues

Feature description

AWS doc: https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns-arrays.html

Currently, the event pattern does not match when a message contains the values in an array

Example:

pattern = {"detail": {"event": {"data": {"type": ["1", "2"]}}}}

# should match an event with the following format

{"event": {"data": {"type": ["3", "1"]}}} 

as per AWS documentation

The preceding event pattern matches an event that includes the following field because the first item in the event pattern array matches the second item in the event array.

🧑‍💻 Implementation

Suggestion

def handle_prefix_filtering(event_pattern, value):
    for element in event_pattern:
        if isinstance(element, (int, str)):
            if str(element) == str(value):
                return True
            if element in value: # added
                return True      # added

       ....

if the current element belongs to the value array in the event-pattern, return true

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions