UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 1.86 kB
"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.UrlSubscription=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var sns=()=>{var tmp=require("../../aws-sns");return sns=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp};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,deliveryPolicy:this.props.deliveryPolicy}}}exports.UrlSubscription=UrlSubscription,_a=JSII_RTTI_SYMBOL_1,UrlSubscription[_a]={fqn:"aws-cdk-lib.aws_sns_subscriptions.UrlSubscription",version:"2.185.0"};