"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ElasticBeanstalkEnvironmentEndpointTarget=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var cdk=()=>{var tmp=require("../../core");return cdk=()=>tmp,tmp},errors_1=()=>{var tmp=require("../../core/lib/errors");return errors_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp},region_info_1=()=>{var tmp=require("../../region-info");return region_info_1=()=>tmp,tmp};class ElasticBeanstalkEnvironmentEndpointTarget{environmentEndpoint;props;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_route53_targets.ElasticBeanstalkEnvironmentEndpointTarget",version:"2.256.1"};hostedZoneId;constructor(environmentEndpoint,props){this.environmentEndpoint=environmentEndpoint,this.props=props;try{jsiiDeprecationWarnings().aws_cdk_lib_aws_route53_targets_IAliasRecordTargetProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,ElasticBeanstalkEnvironmentEndpointTarget),error}this.hostedZoneId=props?.hostedZoneId}bind(record,_zone){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_route53_IRecordSet(record),jsiiDeprecationWarnings().aws_cdk_lib_aws_route53_IHostedZone(_zone)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.bind),error}if(!this.hostedZoneId){let{region}=cdk().Stack.of(record);if(!cdk().Token.isUnresolved(this.environmentEndpoint)){const subDomains=cdk().Fn.split(".",this.environmentEndpoint),regionSubdomainIndex=subDomains.length-3;region=cdk().Fn.select(regionSubdomainIndex,subDomains)}this.hostedZoneId=region_info_1().RegionInfo.get(region).ebsEnvEndpointHostedZoneId}if(!this.hostedZoneId)throw new(errors_1()).ValidationError((0,literal_string_1().lit)`CannotFindBeanstalkHostedZone`,"Cannot find Beanstalk `hostedZoneId`. You must specify either `hostedZoneId` using `RegionInfo.get(yourRegion).ebsEnvEndpointHostedZoneId` or Stack region or find correct EBS environment endpoint via AWS console. See Elastic Beanstalk developer guide: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customdomains.html",record);return{hostedZoneId:this.hostedZoneId,dnsName:this.environmentEndpoint,evaluateTargetHealth:this.props?.evaluateTargetHealth}}}exports.ElasticBeanstalkEnvironmentEndpointTarget=ElasticBeanstalkEnvironmentEndpointTarget;
