NumericConditions

class aws_cdk.aws_sns.NumericConditions(*, allowlist=None, between=None, between_strict=None, greater_than=None, greater_than_or_equal_to=None, less_than=None, less_than_or_equal_to=None, whitelist=None)

Bases: object

Conditions that can be applied to numeric attributes.

Parameters:
  • allowlist (Optional[Sequence[Union[int, float]]]) – Match one or more values. Default: - None

  • between (Union[BetweenCondition, Dict[str, Any], None]) – Match values that are between the specified values. Default: - None

  • between_strict (Union[BetweenCondition, Dict[str, Any], None]) – Match values that are strictly between the specified values. Default: - None

  • greater_than (Union[int, float, None]) – Match values that are greater than the specified value. Default: - None

  • greater_than_or_equal_to (Union[int, float, None]) – Match values that are greater than or equal to the specified value. Default: - None

  • less_than (Union[int, float, None]) – Match values that are less than the specified value. Default: - None

  • less_than_or_equal_to (Union[int, float, None]) – Match values that are less than or equal to the specified value. Default: - None

  • whitelist (Optional[Sequence[Union[int, float]]]) – (deprecated) Match one or more values. Default: - None

ExampleMetadata:

infused

Example:

import aws_cdk.aws_lambda as lambda_
# fn: lambda.Function


my_topic = sns.Topic(self, "MyTopic")

# Lambda should receive only message matching the following conditions on attributes:
# color: 'red' or 'orange' or begins with 'bl'
# size: anything but 'small' or 'medium'
# price: between 100 and 200 or greater than 300
# store: attribute must be present
my_topic.add_subscription(subscriptions.LambdaSubscription(fn,
    filter_policy={
        "color": sns.SubscriptionFilter.string_filter(
            allowlist=["red", "orange"],
            match_prefixes=["bl"]
        ),
        "size": sns.SubscriptionFilter.string_filter(
            denylist=["small", "medium"]
        ),
        "price": sns.SubscriptionFilter.numeric_filter(
            between=sns.BetweenCondition(start=100, stop=200),
            greater_than=300
        ),
        "store": sns.SubscriptionFilter.exists_filter()
    }
))

Attributes

allowlist

Match one or more values.

Default:
  • None

between

Match values that are between the specified values.

Default:
  • None

between_strict

Match values that are strictly between the specified values.

Default:
  • None

greater_than

Match values that are greater than the specified value.

Default:
  • None

greater_than_or_equal_to

Match values that are greater than or equal to the specified value.

Default:
  • None

less_than

Match values that are less than the specified value.

Default:
  • None

less_than_or_equal_to

Match values that are less than or equal to the specified value.

Default:
  • None

whitelist

(deprecated) Match one or more values.

Default:
  • None

Deprecated:

use allowlist

Stability:

deprecated