Correct lambda filter pattern syntax for DynamoDb stream event, where any string in a list matches one of multiple fields

0

In my DynamoDb stream object, I have a field that is an array of strings, i.e. attribute type SS.

"FOO": {"SS": ["hello"]},

I want to filter out the event if any string in that array matches one of "x", "y", or "z" (placeholder values). I can't figure out the correct filter pattern syntax here, but it does seem possible based on the answer in https://repost.aws/questions/QUgqGseyltTceWNYpMF_2tXw/how-to-create-dynamo-db-stream-event-filter-for-a-field-from-array-of-objects. Here's what I've tried:

"FOO": {
    "SS": {
        "anything-but": ["x","y","z"]
    }
}

Can anyone advise on what the filter pattern should look like?

1 Antwort
0

My first thought is that https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventfiltering.html#filtering-syntax shows the anything-but syntax as being embedded in an array:

"Weather": [ { "anything-but": [ "Raining" ] } ]

If that doesn't fix it, what I'd try next is something that is definitely an "AND", given there don't seem to be any examples out there using anything-but with multiple items to confirm how it works.

https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventfiltering.html#filtering-syntax shows that, in general, items in a filter array act as "OR", so maybe what you tried is acting like:

"anything-but": ["x"] OR "anything-but": ["y"] OR ...

which will always be true.

Maybe try something like:

"FOO": {
    "SS": [
        {"anything-but": ["x"]},
        {"anything-but": ["y"]},
        {"anything-but": ["z"]}
    ]
}
EXPERTE
beantwortet vor einem Jahr

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen