To use this function add it to the class library file named OrchestratorPluginVRAService.ts
GitHub Repository: https://github.com/SimonSparksUK/Orchestrator
Filename: OrchestratorPluginVRAService.ts
Description: Orchestrator Function to Get a JSON Response Object from a vRA REST Request ( GET )
Public Function: VraRestGetSpecificTest
public VraRestGetSpecificTest(objVraHost: VraHost): VraMachine[] {
let arrVraMachine: VraMachine[] = this.VraRestGetSpecific<VraMachine[]>(objVraHost, "/iaas/api/machines", 100, 0, "name", "name", "name asc", undefined, undefined, true, false);
return arrVraMachine;
}TypeScriptPublic Function: VraRestGetSpecific
public VraRestGetSpecific<T>(objVraHost: VraHost, strPath: string, intTop?: number, intSkip?: number, strSelect?: string, strFilter?: string, strOrderBy?: string, intPage?: number, intSize?: number, blnCount: boolean = true, blnSkipOperationLinks: boolean = true): T {
let strApiVersion: string = "2021-07-15";
let strUri: string = strPath;
strUri = strUri + `?$apiVersion=${strApiVersion}`;
if (strFilter && strFilter !== null && strFilter !== undefined && strFilter !== "") { strUri = strUri + `&$filter=${strFilter}` };
if (strSelect && strSelect !== null && strSelect !== undefined && strSelect !== "") { strUri = strUri + `&$select=${strSelect}` };
if (strOrderBy && strOrderBy !== null && strOrderBy !== undefined && strSelect !== "") { strUri = strUri + `&$orderby=${strOrderBy}` };
if (intSkip && intSkip !== null && intSkip !== undefined && intSkip !== 0) { strUri = strUri + `&$skip=${intSkip.toString()}` };
if (intTop && intTop !== null && intTop !== undefined && intSkip !== 0) { strUri = strUri + `&$top=${intTop.toString()}` };
if (intSize && intSize !== null && intSize !== undefined && intSkip !== 0) { strUri = strUri + `&size=${intSize.toString()}` };
if (intPage && intPage !== null && intPage !== undefined) { strUri = strUri + `&page=${intPage.toString()}` };
if (blnCount && blnCount !== null && blnCount !== undefined) { strUri = strUri + `&$count=${blnCount}` };
if (blnSkipOperationLinks && blnSkipOperationLinks !== null && blnSkipOperationLinks !== undefined) { strUri = strUri + `&skipOperationLinks=${blnSkipOperationLinks}` };
let objReturn: T = this.VraRestGet<T>(objVraHost, strUri, null);
return objReturn;
}TypeScriptDiscover more from Cloud Build Tools
Subscribe to get the latest posts sent to your email.
