aws-cdk-lib.aws_sns.NumericConditions

interface NumericConditions

LanguageType name
.NETAmazon.CDK.AWS.SNS.NumericConditions
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awssns#NumericConditions
Javasoftware.amazon.awscdk.services.sns.NumericConditions
Pythonaws_cdk.aws_sns.NumericConditions
TypeScript (source)aws-cdk-lib » aws_sns » NumericConditions

Conditions that can be applied to numeric attributes.

Example

import * as lambda from 'aws-cdk-lib/aws-lambda';

const myTopic = new sns.Topic(this, 'MyTopic');
declare const fn: lambda.Function;

// 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
myTopic.addSubscription(new subscriptions.LambdaSubscription(fn, {
  filterPolicy: {
    color: sns.SubscriptionFilter.stringFilter({
      allowlist: ['red', 'orange'],
      matchPrefixes: ['bl'],
    }),
    size: sns.SubscriptionFilter.stringFilter({
      denylist: ['small', 'medium'],
    }),
    price: sns.SubscriptionFilter.numericFilter({
      between: { start: 100, stop: 200 },
      greaterThan: 300,
    }),
    store: sns.SubscriptionFilter.existsFilter(),
  },
}));

Properties

NameTypeDescription
allowlist?number[]Match one or more values.
between?BetweenConditionMatch values that are between the specified values.
betweenStrict?BetweenConditionMatch values that are strictly between the specified values.
greaterThan?numberMatch values that are greater than the specified value.
greaterThanOrEqualTo?numberMatch values that are greater than or equal to the specified value.
lessThan?numberMatch values that are less than the specified value.
lessThanOrEqualTo?numberMatch values that are less than or equal to the specified value.

allowlist?

Type: number[] (optional, default: None)

Match one or more values.


between?

Type: BetweenCondition (optional, default: None)

Match values that are between the specified values.


betweenStrict?

Type: BetweenCondition (optional, default: None)

Match values that are strictly between the specified values.


greaterThan?

Type: number (optional, default: None)

Match values that are greater than the specified value.


greaterThanOrEqualTo?

Type: number (optional, default: None)

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


lessThan?

Type: number (optional, default: None)

Match values that are less than the specified value.


lessThanOrEqualTo?

Type: number (optional, default: None)

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