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 ?

posta un anno fa492 visualizzazioni
1 Risposta
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
ESPERTO
Uri
con risposta un anno fa
profile picture
ESPERTO
verificato un anno fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande