UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 1.66 kB
"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.UrlSubscription=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),sns=require("../../aws-sns"),core_1=require("../../core");class UrlSubscription{constructor(url,props={}){this.url=url,this.props=props;try{jsiiDeprecationWarnings.aws_cdk_lib_aws_sns_subscriptions_UrlSubscriptionProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,UrlSubscription),error}if(this.unresolvedUrl=core_1.Token.isUnresolved(url),!this.unresolvedUrl&&!url.startsWith("http://")&&!url.startsWith("https://"))throw new Error("URL must start with either http:// or https://");if(this.unresolvedUrl&&props.protocol===void 0)throw new Error("Must provide protocol if url is unresolved");this.unresolvedUrl?this.protocol=props.protocol:this.protocol=this.url.startsWith("https:")?sns.SubscriptionProtocol.HTTPS:sns.SubscriptionProtocol.HTTP}bind(_topic){try{jsiiDeprecationWarnings.aws_cdk_lib_aws_sns_ITopic(_topic)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.bind),error}return{subscriberId:this.url,endpoint:this.url,protocol:this.protocol,rawMessageDelivery:this.props.rawMessageDelivery,filterPolicy:this.props.filterPolicy,filterPolicyWithMessageBody:this.props.filterPolicyWithMessageBody,deadLetterQueue:this.props.deadLetterQueue}}}exports.UrlSubscription=UrlSubscription,_a=JSII_RTTI_SYMBOL_1,UrlSubscription[_a]={fqn:"aws-cdk-lib.aws_sns_subscriptions.UrlSubscription",version:"2.70.0"};