"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.HelmChart=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),core_1=require("../../core"),constructs_1=require("constructs"),kubectl_provider_1=require("./kubectl-provider");class HelmChart extends constructs_1.Construct{constructor(scope,id,props){var _b,_c,_d,_e,_f,_g,_h;super(scope,id);jsiiDeprecationWarnings.aws_cdk_lib_aws_eks_HelmChartProps(props);const stack=core_1.Stack.of(this),provider=kubectl_provider_1.KubectlProvider.getOrCreate(this,props.cluster),timeout=(_b=props.timeout)===null||_b===void 0?void 0:_b.toSeconds();if(timeout&&timeout>900)throw new Error("Helm chart timeout cannot be higher than 15 minutes.");if(!props.chart&&!props.chartAsset)throw new Error("Either 'chart' or 'chartAsset' must be specified to install a helm chart");if(props.chartAsset&&(props.repository||props.version))throw new Error("Neither 'repository' nor 'version' can be used when configuring 'chartAsset'");const wait=(_c=props.wait)!==null&&_c!==void 0?_c:!1,createNamespace=(_d=props.createNamespace)!==null&&_d!==void 0?_d:!0;(_e=props.chartAsset)===null||_e===void 0||_e.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:(_f=props.release)!==null&&_f!==void 0?_f:core_1.Names.uniqueId(this).slice(-53).toLowerCase(),Chart:props.chart,ChartAssetURL:(_g=props.chartAsset)===null||_g===void 0?void 0:_g.s3ObjectUrl,Version:props.version,Wait:wait||void 0,Timeout:timeout?`${timeout.toString()}s`:void 0,Values:props.values?stack.toJsonString(props.values):void 0,Namespace:(_h=props.namespace)!==null&&_h!==void 0?_h:"default",Repository:props.repository,CreateNamespace:createNamespace||void 0}})}}exports.HelmChart=HelmChart,_a=JSII_RTTI_SYMBOL_1,HelmChart[_a]={fqn:"aws-cdk-lib.aws_eks.HelmChart",version:"2.13.0"},HelmChart.RESOURCE_TYPE="Custom::AWSCDK-EKS-HelmChart";
//# sourceMappingURL=helm-chart.js.map
