Describe the feature
I've been working with AWS SNS Filter Policy and CDK for Python. I noticed that there are no parameter to set suffixes, only prefixes. Is there any way to pass policy as dict?
Use Case
Code snippet
# topic - sns.Topic
# fn - _lambda.Function
filter_policy = {
"key": sns.SubscriptionFilter.string_filter(
match_suffixes=[".fastq", ".fastq.gz"] # param doesn't exist
)
}
topic.add_subscription(
subscriptions.LambdaSubscription(fn, filter_policy=filter_policy)
)
Proposed Solution
Maybe to include match_suffixes in future releases; or a way to pass filter policy as dict.
I am using CfnSubscription as workaround.
filter_policy = {"key": [{"suffix": ".fastq"}, {"suffix": ".fastq.gz"}]}
sns.CfnSubscription(
self,
"SubscriptionExample",
topic_arn=topic.topic_arn,
filter_policy=filter_policy,
protocol="lambda",
endpoint=fn.function_arn,
)
# I don't know how to use fn.grant_invoke on topic
lambda_.CfnPermission(
self,
"LambdaPermission",
action="lambda:InvokeFunction",
function_name=fn.function_arn,
principal="sns.amazonaws.com",
source_arn=topic.topic_arn,
)
Other Information
No response
Acknowledgements
CDK version used
2.122.0 (build 7e77e02)
Environment details (OS name and version, etc.)
macOS, Python 3.12.1
Describe the feature
I've been working with AWS SNS Filter Policy and CDK for Python. I noticed that there are no parameter to set suffixes, only prefixes. Is there any way to pass policy as dict?
Use Case
Code snippet
Proposed Solution
Maybe to include
match_suffixesin future releases; or a way to pass filter policy as dict.I am using
CfnSubscriptionas workaround.Other Information
No response
Acknowledgements
CDK version used
2.122.0 (build 7e77e02)
Environment details (OS name and version, etc.)
macOS, Python 3.12.1