Orchestrator Function: VcResourcePoolCreate

by Simon Sparks · January 5, 2026

To use this function add it to the class library file named vCenterServerService.ts

GitHub Repository: https://github.com/SimonSparksUK/Orchestrator

Filename: vCenterServerService.ts

public VcResourcePoolCreate(objVcResourcePool: VcResourcePool, strResourcePoolName: string, intSharesInfoMemory: number, intSharesInfoCPU: number): VcResourcePool {

    let objVcSharesInfoMemory: VcSharesInfo = new VcSharesInfo();
    objVcSharesInfoMemory.shares = intSharesInfoMemory;
    objVcSharesInfoMemory.level = VcSharesLevel.normal;

    let objVcResourceAllocationInfoMemory: VcResourceAllocationInfo = new VcResourceAllocationInfo();
    objVcResourceAllocationInfoMemory.shares = objVcSharesInfoMemory;
    objVcResourceAllocationInfoMemory.limit = -1;
    objVcResourceAllocationInfoMemory.reservation = 0;
    objVcResourceAllocationInfoMemory.expandableReservation = true;

    let objVcSharesInfoCPU: VcSharesInfo = new VcSharesInfo();
    objVcSharesInfoCPU.shares = intSharesInfoCPU;
    objVcSharesInfoCPU.level = VcSharesLevel.normal;

    let objVcResourceAllocationInfoCPU: VcResourceAllocationInfo = new VcResourceAllocationInfo();
    objVcResourceAllocationInfoCPU.shares = objVcSharesInfoCPU;
    objVcResourceAllocationInfoCPU.limit = -1;
    objVcResourceAllocationInfoCPU.reservation = 0;
    objVcResourceAllocationInfoCPU.expandableReservation = true;

    let objVcResourceConfigSpec: VcResourceConfigSpec = new VcResourceConfigSpec();
    objVcResourceConfigSpec.memoryAllocation = objVcResourceAllocationInfoMemory;
    objVcResourceConfigSpec.cpuAllocation = objVcResourceAllocationInfoCPU;
    // @ts-ignore
    objVcResourceConfigSpec.scaleDescendantsShares = 'disabled';

    let objVcResourcePoolReturn: VcResourcePool = objVcResourcePool.createResourcePool(strResourcePoolName, objVcResourceConfigSpec);

    return objVcResourcePoolReturn;
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like