aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
2 lines (1 loc) • 2.56 kB
JavaScript
var _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};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}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.160.0"};
;