Skip to content

aws-sns-subscriptions: add support for not exists filter in a subscription filter #34707

Open
@jaw111

Description

@jaw111

Describe the feature

The existsFilter method of SubscriptionFilter class does not take any parameters and hard codes the value to true. I want to be able to set the value to false.

See: https://docs.aws.amazon.com/sns/latest/dg/attribute-key-matching.html

Use Case

I want to subscribe to messages on a topic that do not include the specified property.

Proposed Solution

In: https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-sns/lib/subscription-filter.ts

Add a default parameter on the existsFilter method that has default value true for backwards compatibility.

  /**
   * Returns a subscription filter for attribute key matching.
   */
  public static existsFilter(existsCondition: boolean = true) {
    return new SubscriptionFilter([{ exists: existsCondition }]);
  }

Other Information

No response

Acknowledgements

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

AWS CDK Library version (aws-cdk-lib)

2.198.0

AWS CDK CLI version

2.1018.0 (build e629e30)

Environment details (OS name and version, etc.)

WSL Ubuntu 22.04.5

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions