Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS SNS Subscriptions: missing match_suffixes argument #28765

Closed
2 tasks
wdesouza opened this issue Jan 18, 2024 · 3 comments · Fixed by #28795
Closed
2 tasks

AWS SNS Subscriptions: missing match_suffixes argument #28765

wdesouza opened this issue Jan 18, 2024 · 3 comments · Fixed by #28795
Labels
@aws-cdk/aws-sns Related to Amazon Simple Notification Service effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Comments

@wdesouza
Copy link

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

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.122.0 (build 7e77e02)

Environment details (OS name and version, etc.)

macOS, Python 3.12.1

@wdesouza wdesouza added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Jan 18, 2024
@github-actions github-actions bot added the @aws-cdk/aws-sns Related to Amazon Simple Notification Service label Jan 18, 2024
@msambol
Copy link
Contributor

msambol commented Jan 19, 2024

I'll take this.

@pahud
Copy link
Contributor

pahud commented Jan 19, 2024

According to this, yes we do not have matchSuffixes at this moment.

export interface StringConditions {
/**
* Match one or more values.
*
* @deprecated use `allowlist`
* @default - None
*/
readonly whitelist?: string[];
/**
* Match any value that doesn't include any of the specified values.
* @deprecated use `denylist`
* @default - None
*/
readonly blacklist?: string[];
/**
* Match one or more values.
* @default - None
*/
readonly allowlist?: string[];
/**
* Match any value that doesn't include any of the specified values.
* @default - None
*/
readonly denylist?: string[];
/**
* Matches values that begins with the specified prefixes.
*
* @default - None
*/
readonly matchPrefixes?: string[];
}

@pahud pahud added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Jan 19, 2024
@wdesouza wdesouza changed the title AWS SNS Subscriptions: missing match_prefixes argument AWS SNS Subscriptions: missing match_suffixes argument Jan 20, 2024
@mergify mergify bot closed this as completed in #28795 Jan 25, 2024
mergify bot pushed a commit that referenced this issue Jan 25, 2024
Closes #28765.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Vandita2020 pushed a commit to Vandita2020/aws-cdk that referenced this issue Jan 30, 2024
Closes aws#28765.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
SankyRed pushed a commit that referenced this issue Feb 8, 2024
Closes #28765.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-sns Related to Amazon Simple Notification Service effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants