"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.AliasTargetInstance=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),instance_1=require("./instance"),namespace_1=require("./namespace"),service_1=require("./service"),servicediscovery_generated_1=require("./servicediscovery.generated"),core_1=require("../../core");class AliasTargetInstance extends instance_1.InstanceBase{constructor(scope,id,props){super(scope,id);try{jsiiDeprecationWarnings.aws_cdk_lib_aws_servicediscovery_AliasTargetInstanceProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,AliasTargetInstance),error}if(props.service.namespace.type===namespace_1.NamespaceType.HTTP)throw new Error("Namespace associated with Service must be a DNS Namespace.");const dnsRecordType=props.service.dnsRecordType;if(dnsRecordType!==service_1.DnsRecordType.A&&dnsRecordType!==service_1.DnsRecordType.AAAA&&dnsRecordType!==service_1.DnsRecordType.A_AAAA)throw new Error("Service must use `A` or `AAAA` records to register an AliasRecordTarget.");if(props.service.routingPolicy!==service_1.RoutingPolicy.WEIGHTED)throw new Error("Service must use `WEIGHTED` routing policy.");const resource=new servicediscovery_generated_1.CfnInstance(this,"Resource",{instanceAttributes:{AWS_ALIAS_DNS_NAME:props.dnsName,...props.customAttributes},instanceId:props.instanceId||core_1.Names.uniqueId(this),serviceId:props.service.serviceId});this.service=props.service,this.instanceId=resource.ref,this.dnsName=props.dnsName}}exports.AliasTargetInstance=AliasTargetInstance,_a=JSII_RTTI_SYMBOL_1,AliasTargetInstance[_a]={fqn:"aws-cdk-lib.aws_servicediscovery.AliasTargetInstance",version:"2.96.1"};
