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 ?

질문됨 일 년 전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
답변함 일 년 전
profile picture
전문가
검토됨 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠