"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.IpInstance=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var instance_1=()=>{var tmp=require("./instance");return instance_1=()=>tmp,tmp},service_1=()=>{var tmp=require("./service");return service_1=()=>tmp,tmp},servicediscovery_generated_1=()=>{var tmp=require("./servicediscovery.generated");return servicediscovery_generated_1=()=>tmp,tmp};class IpInstance extends instance_1().InstanceBase{constructor(scope,id,props){super(scope,id);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_servicediscovery_IpInstanceProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,IpInstance),error}const dnsRecordType=props.service.dnsRecordType;if(dnsRecordType===service_1().DnsRecordType.CNAME)throw new Error("Service must support `A`, `AAAA` or `SRV` records to register this instance type.");if(dnsRecordType===service_1().DnsRecordType.SRV){if(!props.port)throw new Error("A `port` must be specified for a service using a `SRV` record.");if(!props.ipv4&&!props.ipv6)throw new Error("At least `ipv4` or `ipv6` must be specified for a service using a `SRV` record.")}if(!props.ipv4&&(dnsRecordType===service_1().DnsRecordType.A||dnsRecordType===service_1().DnsRecordType.A_AAAA))throw new Error("An `ipv4` must be specified for a service using a `A` record.");if(!props.ipv6&&(dnsRecordType===service_1().DnsRecordType.AAAA||dnsRecordType===service_1().DnsRecordType.A_AAAA))throw new Error("An `ipv6` must be specified for a service using a `AAAA` record.");const port=props.port||80,resource=new(servicediscovery_generated_1()).CfnInstance(this,"Resource",{instanceAttributes:{AWS_INSTANCE_IPV4:props.ipv4,AWS_INSTANCE_IPV6:props.ipv6,AWS_INSTANCE_PORT:port.toString(),...props.customAttributes},instanceId:props.instanceId||this.uniqueInstanceId(),serviceId:props.service.serviceId});this.service=props.service,this.instanceId=resource.ref,this.ipv4=props.ipv4||"",this.ipv6=props.ipv6||"",this.port=port}}exports.IpInstance=IpInstance,_a=JSII_RTTI_SYMBOL_1,IpInstance[_a]={fqn:"aws-cdk-lib.aws_servicediscovery.IpInstance",version:"2.159.0"};
