I am setting up our AWS infrastructure using CDK in Python. I want to subscribe an sqs queue to an SNS topic using a filter when the id is in a range and the type is one of two types. The filter should look like this:
{ "id": [{"numeric": [">", 0, "<", 100]}], "type": ["foo", "bar"] }
This is what I have:
class MyStack(core.Stack): def init(self, scope: core.Construct, id: str, **kwargs) -> None: super().init(scope, id, **kwargs)
queue = sqs.Queue(self, "MyQueue")
snsTopic = sns.Topic(self, "MyTopic", display_name="My Topic")
idMapping = {"id": sns.SubscriptionFilter(conditions=[{"numeric": [">", 0, "<", 100] } ])}
typeMapping = {"type" : sns.SubscriptionFilter(conditions=["foo", "bar"])}
sub = subs.SqsSubscription(queue, filter_policy = idMapping)
snsTopic.add_subscription(sub)
It seems to work if I set the filter_policy to either idMapping or typeMapping, but how do I do the AND of the two?