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年前494ビュー
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年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ