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개 답변
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"]}
    ]
}
전문가
답변함 일 년 전

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

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

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

관련 콘텐츠