Home > database >  Is there a wildcard character in AWS EventBridge rules?
Is there a wildcard character in AWS EventBridge rules?

Time:03-25

I'm creating a rule for EventBridge and I want the rule to match the following structure:

{
  "id": "<string>",
  "changes": {
    "name": {
      "old": "old name",
      "new": "new name",
    },
  }
}

Inside of the changes object, I don't know what the keys are. Once an attribute is modified, I'll receive the key name, the old value, and the new value in the format referenced above. I want to verify that the changes object exists. According to their docs, I can only use the Exists matcher on leaf nodes and not intermediate nodes. Is there a wildcard character I could use to do something of the following:

{
  "detail": {
    "id": [{
      "exists": true
    }],
    "changes": [{
      *: {
        "old": [{
          "exists": true
        }],
        "new": [{
          "exists": true
        }],
      }
    }]
  }
}

CodePudding user response:

Sadly you can't do this. Instead, it would be better to send all your events to a lambda function, and the function would take care of filtering and re-distributing the events further down your message pipeline.

  • Related