aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
2 lines (1 loc) • 3.31 kB
JavaScript
var __decorate=exports&&exports.__decorate||function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r},_a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.FairshareSchedulingPolicy=exports.SchedulingPolicyBase=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var batch_generated_1=()=>{var tmp=require("./batch.generated");return batch_generated_1=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp},metadata_resource_1=()=>{var tmp=require("../../core/lib/metadata-resource");return metadata_resource_1=()=>tmp,tmp};class SchedulingPolicyBase extends core_1().Resource{constructor(scope,id,props){super(scope,id,{physicalName:props?.schedulingPolicyName})}}exports.SchedulingPolicyBase=SchedulingPolicyBase;class FairshareSchedulingPolicy extends SchedulingPolicyBase{static fromFairshareSchedulingPolicyArn(scope,id,fairshareSchedulingPolicyArn){const stack=core_1().Stack.of(scope);class Import extends SchedulingPolicyBase{constructor(){super(...arguments),this.schedulingPolicyArn=fairshareSchedulingPolicyArn,this.schedulingPolicyName=stack.splitArn(fairshareSchedulingPolicyArn,core_1().ArnFormat.SLASH_RESOURCE_NAME).resourceName,this.shares=[]}}return new Import(scope,id)}constructor(scope,id,props){super(scope,id,props);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_batch_FairshareSchedulingPolicyProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,FairshareSchedulingPolicy),error}(0,metadata_resource_1().addConstructMetadata)(this,props),this.computeReservation=props?.computeReservation,this.shareDecay=props?.shareDecay,this.shares=props?.shares??[];const resource=new(batch_generated_1()).CfnSchedulingPolicy(this,"Resource",{fairsharePolicy:{computeReservation:this.computeReservation,shareDecaySeconds:this.shareDecay?.toSeconds(),shareDistribution:core_1().Lazy.any({produce:()=>this.shares?.map(share=>({shareIdentifier:share.shareIdentifier,weightFactor:share.weightFactor}))})},name:props?.schedulingPolicyName});this.schedulingPolicyArn=this.getResourceArnAttribute(resource.attrArn,{service:"batch",resource:"scheduling-policy",resourceName:this.physicalName}),this.schedulingPolicyName=this.getResourceNameAttribute(resource.ref)}addShare(share){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_batch_Share(share)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.addShare),error}this.shares.push(share)}}exports.FairshareSchedulingPolicy=FairshareSchedulingPolicy,_a=JSII_RTTI_SYMBOL_1,FairshareSchedulingPolicy[_a]={fqn:"aws-cdk-lib.aws_batch.FairshareSchedulingPolicy",version:"2.185.0"},__decorate([(0,metadata_resource_1().MethodMetadata)()],FairshareSchedulingPolicy.prototype,"addShare",null);
;