aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
2 lines (1 loc) • 9.74 kB
JavaScript
"use strict";var __esDecorate=exports&&exports.__esDecorate||function(ctor,descriptorIn,decorators,contextIn,initializers,extraInitializers){function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Function expected");return f}for(var kind=contextIn.kind,key=kind==="getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor?contextIn.static?ctor:ctor.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor(target,contextIn.name):{}),_,done=!1,i=decorators.length-1;i>=0;i--){var context={};for(var p in contextIn)context[p]=p==="access"?{}:contextIn[p];for(var p in contextIn.access)context.access[p]=contextIn.access[p];context.addInitializer=function(f){if(done)throw new TypeError("Cannot add initializers after decoration has completed");extraInitializers.push(accept(f||null))};var result=(0,decorators[i])(kind==="accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key],context);if(kind==="accessor"){if(result===void 0)continue;if(result===null||typeof result!="object")throw new TypeError("Object expected");(_=accept(result.get))&&(descriptor.get=_),(_=accept(result.set))&&(descriptor.set=_),(_=accept(result.init))&&initializers.unshift(_)}else(_=accept(result))&&(kind==="field"?initializers.unshift(_):descriptor[key]=_)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers=exports&&exports.__runInitializers||function(thisArg,initializers,value){for(var useValue=arguments.length>2,i=0;i<initializers.length;i++)value=useValue?initializers[i].call(thisArg,value):initializers[i].call(thisArg);return useValue?value:void 0};Object.defineProperty(exports,"__esModule",{value:!0}),exports.SecretPathVolume=exports.HostPathVolume=exports.EmptyDirVolume=exports.EmptyDirMediumType=exports.EksVolume=exports.EksContainerDefinition=exports.ImagePullPolicy=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},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp},prop_injectable_1=()=>{var tmp=require("../../core/lib/prop-injectable");return prop_injectable_1=()=>tmp,tmp};const EMPTY_DIR_VOLUME_SYMBOL=Symbol.for("aws-cdk-lib/aws-batch/lib/eks-container-definition.EmptyDirVolume"),HOST_PATH_VOLUME_SYMBOL=Symbol.for("aws-cdk-lib/aws-batch/lib/eks-container-definition.HostPathVolume"),SECRET_PATH_VOLUME_SYMBOL=Symbol.for("aws-cdk-lib/aws-batch/lib/eks-container-definition.SecretVolume");var ImagePullPolicy;(function(ImagePullPolicy2){ImagePullPolicy2.ALWAYS="Always",ImagePullPolicy2.IF_NOT_PRESENT="IfNotPresent",ImagePullPolicy2.NEVER="Never"})(ImagePullPolicy||(exports.ImagePullPolicy=ImagePullPolicy={}));let EksContainerDefinition=(()=>{let _classDecorators=[prop_injectable_1().propertyInjectable],_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=constructs_1().Construct;var EksContainerDefinition2=class extends _classSuper{static{_classThis=this}static{const _metadata=typeof Symbol=="function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0;__esDecorate(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),EksContainerDefinition2=_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata})}static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_batch.EksContainerDefinition",version:"2.234.1"};static PROPERTY_INJECTION_ID="aws-cdk-lib.aws-batch.EksContainerDefinition";image;args;command;env;imagePullPolicy;name;memoryLimit;memoryReservation;cpuLimit;cpuReservation;gpuLimit;gpuReservation;privileged;readonlyRootFilesystem;runAsGroup;runAsRoot;runAsUser;volumes;imageConfig;constructor(scope,id,props){super(scope,id);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_batch_EksContainerDefinitionProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,EksContainerDefinition2),error}this.image=props.image,this.args=props.args,this.command=props.command,this.env=props.env,this.imagePullPolicy=props.imagePullPolicy,this.name=props.name,this.memoryLimit=props.memoryLimit,this.memoryReservation=props.memoryReservation,this.cpuLimit=props.cpuLimit,this.cpuReservation=props.cpuReservation,this.gpuLimit=props.gpuLimit,this.gpuReservation=props.gpuReservation,this.privileged=props.privileged,this.readonlyRootFilesystem=props.readonlyRootFilesystem,this.runAsGroup=props.runAsGroup,this.runAsRoot=props.runAsRoot,this.runAsUser=props.runAsUser,this.volumes=props.volumes??[],this.imageConfig=props.image.bind(this,this)}addVolume(volume){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_batch_EksVolume(volume)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.addVolume),error}this.volumes.push(volume)}_renderContainerDefinition(){return{image:this.imageConfig.imageName,command:this.command,args:this.args,env:Object.keys(this.env??{}).map(key=>({name:key,value:this.env[key]})),name:this.name,imagePullPolicy:this.imagePullPolicy,resources:{limits:{cpu:this.cpuLimit,memory:this.memoryLimit?this.memoryLimit.toMebibytes()+"Mi":void 0,"nvidia.com/gpu":this.gpuLimit},requests:{cpu:this.cpuReservation,memory:this.memoryReservation?this.memoryReservation.toMebibytes()+"Mi":void 0,"nvidia.com/gpu":this.gpuReservation}},securityContext:{privileged:this.privileged,readOnlyRootFilesystem:this.readonlyRootFilesystem,runAsGroup:this.runAsGroup,runAsNonRoot:!this.runAsRoot,runAsUser:this.runAsUser},volumeMounts:core_1().Lazy.any({produce:()=>{if(this.volumes.length!==0)return this.volumes.map(volume=>({name:volume.name,mountPath:volume.containerPath,readOnly:volume.readonly}))}})}}static{__runInitializers(_classThis,_classExtraInitializers)}};return EksContainerDefinition2=_classThis})();exports.EksContainerDefinition=EksContainerDefinition;class EksVolume{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_batch.EksVolume",version:"2.234.1"};static emptyDir(options){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_batch_EmptyDirVolumeOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.emptyDir),error}return new EmptyDirVolume(options)}static hostPath(options){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_batch_HostPathVolumeOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.hostPath),error}return new HostPathVolume(options)}static secret(options){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_batch_SecretPathVolumeOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.secret),error}return new SecretPathVolume(options)}name;containerPath;readonly;constructor(options){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_batch_EksVolumeOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,EksVolume),error}this.name=options.name,this.containerPath=options.mountPath,this.readonly=options.readonly}}exports.EksVolume=EksVolume;var EmptyDirMediumType;(function(EmptyDirMediumType2){EmptyDirMediumType2.DISK="",EmptyDirMediumType2.MEMORY="Memory"})(EmptyDirMediumType||(exports.EmptyDirMediumType=EmptyDirMediumType={}));class EmptyDirVolume extends EksVolume{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_batch.EmptyDirVolume",version:"2.234.1"};static isEmptyDirVolume(x){return x!==null&&typeof x=="object"&&EMPTY_DIR_VOLUME_SYMBOL in x}medium;sizeLimit;constructor(options){super(options);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_batch_EmptyDirVolumeOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,EmptyDirVolume),error}this.medium=options.medium,this.sizeLimit=options.sizeLimit}}exports.EmptyDirVolume=EmptyDirVolume,Object.defineProperty(EmptyDirVolume.prototype,EMPTY_DIR_VOLUME_SYMBOL,{value:!0,enumerable:!1,writable:!1});class HostPathVolume extends EksVolume{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_batch.HostPathVolume",version:"2.234.1"};static isHostPathVolume(x){return x!==null&&typeof x=="object"&&HOST_PATH_VOLUME_SYMBOL in x}path;constructor(options){super(options);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_batch_HostPathVolumeOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,HostPathVolume),error}this.path=options.hostPath}}exports.HostPathVolume=HostPathVolume,Object.defineProperty(HostPathVolume.prototype,HOST_PATH_VOLUME_SYMBOL,{value:!0,enumerable:!1,writable:!1});class SecretPathVolume extends EksVolume{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_batch.SecretPathVolume",version:"2.234.1"};static isSecretPathVolume(x){return x!==null&&typeof x=="object"&&SECRET_PATH_VOLUME_SYMBOL in x}secretName;optional;constructor(options){super(options);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_batch_SecretPathVolumeOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,SecretPathVolume),error}this.secretName=options.secretName,this.optional=options.optional??!0}}exports.SecretPathVolume=SecretPathVolume,Object.defineProperty(SecretPathVolume.prototype,SECRET_PATH_VOLUME_SYMBOL,{value:!0,enumerable:!1,writable:!1});