Is it possible to match a pattern inside an array in an eventBridge rule?

129 views Asked by At

I'm trying to write an event rule for an event that matches with this :

{  
   object1 : "",
   object2 : {
      array1: [
        {
            field1: "abcd",
            field2: "1234"
        },
        {
            field1: "pqrs",
            field2: "2345"
        }
     ]
}

I'm trying to capture events for a particular combination of "field1" and "field2" ( within a same element ). Has anyone tried this before and can possibly share some pointers ? Thanks in advance.

What I've tried till now is :

{
  "object1": ["value1"],
  "object2": {
    "array1": {
      "field1": ["pqrs"],
      "field2": ["2345"]
    }
  }
}

Unfortunately, this is will match even if source event looks something like this :

{  
   object1 : "",
   object2 : {
      array1: [
        {
            field1: "pqrs",
            field2: "1234"
        },
        {
            field1: "vxyz",
            field2: "2345"
        }
     ]
}

*notice how field1 are different in this one ( but still the mentioned rule will match with both such events ).

0

There are 0 answers