Function: vCenter VAPI Plugin Connect and Disconnect

by Simon Sparks · 13 January 2026

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

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

Filename: vCenterVAPIService.ts

Function VAPIConnect

protected VAPIConnect(objVcSdkConnection: VcSdkConnection): boolean {

    let blnReturn: boolean = false;

    try {
        this.objVAPIEndpoint = VAPIManager.findEndpoint("https://" + objVcSdkConnection.id + "/api");

        this.objVAPIClient = this.objVAPIEndpoint.client(null, null);

        blnReturn = true;
    }
    catch (objException) {
        blnReturn = false;
    }

    return blnReturn;
}

Function VAPIDisconnect

protected VAPIDisconnect(): boolean {

    let blnReturn: boolean = false;

    try {
        this.objVAPIClient.close();

        this.objVAPIEndpoint = null;
        this.objVAPIClient = null;

        blnReturn = true;
    }
    catch (objException) {
        blnReturn = false;
    }

    return blnReturn;
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like