Lambda event filter for Json array

0

In the documentation https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventfiltering.html#filtering-syntax it is only mention "Weather": [ { "anything-but": [ "Raining" ] } ]

What I am need is to filter if the array contains a specific value. Example json { "MyKey": "Value", "Number": 12, "References": [ { "Key1": 14 }, { "Key2": 14 } ] }

What would be the filter syntax to check if "Key1" exists ?

已提問 1 年前檢視次數 492 次
1 個回答
0

In EventBridge, your custom payload is always included in the "detail" field, so your actual event will look like:

{
  "detail-type": "MyCustomEvent",
  "source": "aws.partner/salesforce.com/xxxxxxxxxxxx/xxxxxxxxxxx",
  "account": "12345678921",
  "time": "2022-04-06T20:24:01Z",
  "resources": [],
  "detail": {
    "MyKey": "Value",
    "Number": 12,
    "References": [{
      "Key1": 14
    }, {
      "Key2": 14
    }]
  }
}

Your rule should look like this:

{
  "detail": {
    "References": {
      "Key2": [14]
    }
  }
}
profile pictureAWS
專家
Uri
已回答 1 年前
profile picture
專家
已審閱 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南