"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.EksJobDefinition=exports.DnsPolicy=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),batch_generated_1=require("./batch.generated"),eks_container_definition_1=require("./eks-container-definition"),job_definition_base_1=require("./job-definition-base"),core_1=require("../../core");var DnsPolicy;(function(DnsPolicy2){DnsPolicy2.DEFAULT="Default",DnsPolicy2.CLUSTER_FIRST="ClusterFirst",DnsPolicy2.CLUSTER_FIRST_WITH_HOST_NET="ClusterFirstWithHostNet"})(DnsPolicy||(exports.DnsPolicy=DnsPolicy={}));class EksJobDefinition extends job_definition_base_1.JobDefinitionBase{static fromEksJobDefinitionArn(scope,id,eksJobDefinitionArn){const jobDefinitionName=core_1.Stack.of(scope).splitArn(eksJobDefinitionArn,core_1.ArnFormat.SLASH_RESOURCE_NAME).resourceName;class Import extends job_definition_base_1.JobDefinitionBase{constructor(){super(...arguments),this.jobDefinitionArn=eksJobDefinitionArn,this.jobDefinitionName=jobDefinitionName,this.enabled=!0,this.container={}}}return new Import(scope,id)}constructor(scope,id,props){super(scope,id,props);try{jsiiDeprecationWarnings.aws_cdk_lib_aws_batch_EksJobDefinitionProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,EksJobDefinition),error}this.container=props.container,this.dnsPolicy=props.dnsPolicy,this.useHostNetwork=props.useHostNetwork,this.serviceAccount=props.serviceAccount;const resource=new batch_generated_1.CfnJobDefinition(this,"Resource",{...(0,job_definition_base_1.baseJobDefinitionProperties)(this),type:"container",jobDefinitionName:props.jobDefinitionName,eksProperties:{podProperties:{containers:[this.container._renderContainerDefinition()],dnsPolicy:this.dnsPolicy,hostNetwork:this.useHostNetwork,serviceAccountName:this.serviceAccount,volumes:core_1.Lazy.any({produce:()=>{if(this.container.volumes.length!==0)return this.container.volumes.map(volume=>{if(eks_container_definition_1.EmptyDirVolume.isEmptyDirVolume(volume))return{name:volume.name,emptyDir:{medium:volume.medium,sizeLimit:volume.sizeLimit?volume.sizeLimit.toMebibytes().toString()+"Mi":void 0}};if(eks_container_definition_1.HostPathVolume.isHostPathVolume(volume))return{name:volume.name,hostPath:{path:volume.path}};if(eks_container_definition_1.SecretPathVolume.isSecretPathVolume(volume))return{name:volume.name,secret:{optional:volume.optional,secretName:volume.secretName}};throw new Error("unknown volume type")})}})}}});this.jobDefinitionArn=this.getResourceArnAttribute(resource.ref,{service:"batch",resource:"job-definition",resourceName:this.physicalName}),this.jobDefinitionName=this.getResourceNameAttribute(resource.ref)}}exports.EksJobDefinition=EksJobDefinition,_a=JSII_RTTI_SYMBOL_1,EksJobDefinition[_a]={fqn:"aws-cdk-lib.aws_batch.EksJobDefinition",version:"2.96.1"};
