UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 3.12 kB
"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.SubscriptionFilter=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var errors_1=()=>{var tmp=require("../../core/lib/errors");return errors_1=()=>tmp,tmp};class SubscriptionFilter{static stringFilter(stringConditions){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_sns_StringConditions(stringConditions)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.stringFilter),error}const conditions=new Array;if(stringConditions.whitelist&&stringConditions.allowlist)throw new(errors_1()).UnscopedValidationError("`whitelist` is deprecated; please use `allowlist` instead");if(stringConditions.blacklist&&stringConditions.denylist)throw new(errors_1()).UnscopedValidationError("`blacklist` is deprecated; please use `denylist` instead");const allowlist=stringConditions.allowlist??stringConditions.whitelist,denylist=stringConditions.denylist??stringConditions.blacklist;return allowlist&&conditions.push(...allowlist),denylist&&conditions.push({"anything-but":denylist}),stringConditions.matchPrefixes&&conditions.push(...stringConditions.matchPrefixes.map(p=>({prefix:p}))),stringConditions.matchSuffixes&&conditions.push(...stringConditions.matchSuffixes.map(s=>({suffix:s}))),new SubscriptionFilter(conditions)}static numericFilter(numericConditions){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_sns_NumericConditions(numericConditions)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.numericFilter),error}const conditions=new Array;if(numericConditions.whitelist&&numericConditions.allowlist)throw new(errors_1()).UnscopedValidationError("`whitelist` is deprecated; please use `allowlist` instead");const allowlist=numericConditions.allowlist??numericConditions.whitelist;return allowlist&&conditions.push(...allowlist.map(v=>({numeric:["=",v]}))),numericConditions.greaterThan!==void 0&&conditions.push({numeric:[">",numericConditions.greaterThan]}),numericConditions.greaterThanOrEqualTo!==void 0&&conditions.push({numeric:[">=",numericConditions.greaterThanOrEqualTo]}),numericConditions.lessThan!==void 0&&conditions.push({numeric:["<",numericConditions.lessThan]}),numericConditions.lessThanOrEqualTo!==void 0&&conditions.push({numeric:["<=",numericConditions.lessThanOrEqualTo]}),numericConditions.between&&conditions.push({numeric:[">=",numericConditions.between.start,"<=",numericConditions.between.stop]}),numericConditions.betweenStrict&&conditions.push({numeric:[">",numericConditions.betweenStrict.start,"<",numericConditions.betweenStrict.stop]}),new SubscriptionFilter(conditions)}static existsFilter(){return new SubscriptionFilter([{exists:!0}])}constructor(conditions=[]){this.conditions=conditions}}exports.SubscriptionFilter=SubscriptionFilter,_a=JSII_RTTI_SYMBOL_1,SubscriptionFilter[_a]={fqn:"aws-cdk-lib.aws_sns.SubscriptionFilter",version:"2.202.0"};