aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
2 lines (1 loc) • 1.38 kB
JavaScript
var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.SnsDestination=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var iam=()=>{var tmp=require("../../aws-iam");return iam=()=>tmp,tmp},s3=()=>{var tmp=require("../../aws-s3");return s3=()=>tmp,tmp};class SnsDestination{constructor(topic){this.topic=topic;try{jsiiDeprecationWarnings().aws_cdk_lib_aws_sns_ITopic(topic)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,SnsDestination),error}}bind(_scope,bucket){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_s3_IBucket(bucket)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.bind),error}return this.topic.addToResourcePolicy(new(iam()).PolicyStatement({principals:[new(iam()).ServicePrincipal("s3.amazonaws.com")],actions:["sns:Publish"],resources:[this.topic.topicArn],conditions:{ArnLike:{"aws:SourceArn":bucket.bucketArn}}})),{arn:this.topic.topicArn,type:s3().BucketNotificationDestinationType.TOPIC,dependencies:[this.topic]}}}exports.SnsDestination=SnsDestination,_a=JSII_RTTI_SYMBOL_1,SnsDestination[_a]={fqn:"aws-cdk-lib.aws_s3_notifications.SnsDestination",version:"2.185.0"};
;