"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.HelmChart=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var constructs_1=()=>{var tmp=require("constructs");return constructs_1=()=>tmp,tmp},kubectl_provider_1=()=>{var tmp=require("./kubectl-provider");return kubectl_provider_1=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp};class HelmChart extends constructs_1().Construct{constructor(scope,id,props){super(scope,id);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_eks_HelmChartProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,HelmChart),error}this.chart=props.chart,this.repository=props.repository,this.version=props.version,this.chartAsset=props.chartAsset;const stack=core_1().Stack.of(this),provider=kubectl_provider_1().KubectlProvider.getOrCreate(this,props.cluster),timeout=props.timeout?.toSeconds();if(timeout&&timeout>900)throw new Error("Helm chart timeout cannot be higher than 15 minutes.");if(!this.chart&&!this.chartAsset)throw new Error("Either 'chart' or 'chartAsset' must be specified to install a helm chart");if(this.chartAsset&&(this.repository||this.version))throw new Error("Neither 'repository' nor 'version' can be used when configuring 'chartAsset'");const wait=props.wait??!1,createNamespace=props.createNamespace??!0,skipCrds=props.skipCrds??!1,atomic=props.atomic??!1;this.chartAsset?.grantRead(provider.handlerRole),new(core_1()).CustomResource(this,"Resource",{serviceToken:provider.serviceToken,resourceType:HelmChart.RESOURCE_TYPE,properties:{ClusterName:props.cluster.clusterName,RoleArn:provider.roleArn,Release:props.release??core_1().Names.uniqueId(this).slice(-53).toLowerCase(),Chart:this.chart,ChartAssetURL:this.chartAsset?.s3ObjectUrl,Version:this.version,Wait:wait||void 0,Timeout:timeout?`${timeout.toString()}s`:void 0,Values:props.values?stack.toJsonString(props.values):void 0,Namespace:props.namespace??"default",Repository:this.repository,CreateNamespace:createNamespace||void 0,SkipCrds:skipCrds||void 0,Atomic:atomic||void 0}})}}exports.HelmChart=HelmChart,_a=JSII_RTTI_SYMBOL_1,HelmChart[_a]={fqn:"aws-cdk-lib.aws_eks.HelmChart",version:"2.148.1"},HelmChart.RESOURCE_TYPE="Custom::AWSCDK-EKS-HelmChart";
