"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.Accelerator=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),ga=require("./globalaccelerator.generated"),listener_1=require("./listener"),cdk=require("../../core");class Accelerator extends cdk.Resource{static fromAcceleratorAttributes(scope,id,attrs){try{jsiiDeprecationWarnings.aws_cdk_lib_aws_globalaccelerator_AcceleratorAttributes(attrs)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.fromAcceleratorAttributes),error}class Import extends cdk.Resource{constructor(){super(...arguments),this.acceleratorArn=attrs.acceleratorArn,this.dnsName=attrs.dnsName}}return new Import(scope,id)}constructor(scope,id,props={}){super(scope,id);try{jsiiDeprecationWarnings.aws_cdk_lib_aws_globalaccelerator_AcceleratorProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,Accelerator),error}this.validateAcceleratorName(props.acceleratorName);const name=props.acceleratorName??cdk.Names.uniqueResourceName(this,{maxLength:64}),resource=new ga.CfnAccelerator(this,"Resource",{enabled:props.enabled??!0,name});this.acceleratorArn=resource.attrAcceleratorArn,this.dnsName=resource.attrDnsName}addListener(id,options){try{jsiiDeprecationWarnings.aws_cdk_lib_aws_globalaccelerator_ListenerOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.addListener),error}return new listener_1.Listener(this,id,{accelerator:this,...options})}validateAcceleratorName(name){if(!cdk.Token.isUnresolved(name)&&name!==void 0&&(name.length<1||name.length>64))throw new Error(`Invalid acceleratorName value ${name}, must have length between 1 and 64, got: ${name.length}`)}}exports.Accelerator=Accelerator,_a=JSII_RTTI_SYMBOL_1,Accelerator[_a]={fqn:"aws-cdk-lib.aws_globalaccelerator.Accelerator",version:"2.96.1"};
