aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
2 lines (1 loc) • 3.52 kB
JavaScript
var __decorate=exports&&exports.__decorate||function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r},_a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.NotificationRule=exports.DetailType=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var codestarnotifications_generated_1=()=>{var tmp=require("./codestarnotifications.generated");return codestarnotifications_generated_1=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp},metadata_resource_1=()=>{var tmp=require("../../core/lib/metadata-resource");return metadata_resource_1=()=>tmp,tmp},prop_injectable_1=()=>{var tmp=require("../../core/lib/prop-injectable");return prop_injectable_1=()=>tmp,tmp},DetailType;(function(DetailType2){DetailType2.BASIC="BASIC",DetailType2.FULL="FULL"})(DetailType||(exports.DetailType=DetailType={}));let NotificationRule=class NotificationRule2 extends core_1().Resource{static fromNotificationRuleArn(scope,id,notificationRuleArn){class Import extends core_1().Resource{constructor(){super(...arguments),this.notificationRuleArn=notificationRuleArn}addTarget(_target){return!1}}return new Import(scope,id,{environmentFromArn:notificationRuleArn})}constructor(scope,id,props){super(scope,id),this.targets=[],this.events=[];try{jsiiDeprecationWarnings().aws_cdk_lib_aws_codestarnotifications_NotificationRuleProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,NotificationRule2),error}(0,metadata_resource_1().addConstructMetadata)(this,props);const source=props.source.bindAsNotificationRuleSource(this);this.addEvents(props.events);const resource=new(codestarnotifications_generated_1()).CfnNotificationRule(this,"Resource",{name:props.notificationRuleName||core_1().Names.uniqueId(this).slice(-64),detailType:props.detailType||DetailType.FULL,targets:this.targets,eventTypeIds:this.events,resource:source.sourceArn,status:props.enabled!==void 0?props.enabled?"ENABLED":"DISABLED":void 0,createdBy:props.createdBy});this.notificationRuleArn=resource.ref,props.targets?.forEach(target=>{this.addTarget(target)})}addTarget(target){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_codestarnotifications_INotificationRuleTarget(target)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.addTarget),error}return this.targets.push(target.bindAsNotificationRuleTarget(this)),!0}addEvents(events){events.forEach(event=>{this.events.includes(event)||this.events.push(event)})}};exports.NotificationRule=NotificationRule,_a=JSII_RTTI_SYMBOL_1,NotificationRule[_a]={fqn:"aws-cdk-lib.aws_codestarnotifications.NotificationRule",version:"2.211.0"},NotificationRule.PROPERTY_INJECTION_ID="aws-cdk-lib.aws-codestarnotifications.NotificationRule",__decorate([(0,metadata_resource_1().MethodMetadata)()],NotificationRule.prototype,"addTarget",null),exports.NotificationRule=NotificationRule=__decorate([prop_injectable_1().propertyInjectable],NotificationRule);
;