I have written a solution to this request in TypeScript using the Aria Build Tools
https://github.com/vmware/build-tools-for-vmware-aria
The API definition for this function is available at this URL
https://developer.broadcom.com/xapis/vmware-storage-policy-api/latest/vim.host.PatchManager.html#Query
public VcHostSystemQueryHostPatch(@notNull @notEmpty @required objVcHostSystem: VcHostSystem, @notNull @notEmpty @required strCommandOption: string, @notNull @notEmpty @required strUsername: string, @notNull @notEmpty @required strPassword: string, @notNull @notEmpty @required strProxy: string = "", @notNull @notEmpty @required intPort: number = null): void {
let objVcHostPatchManagerPatchManagerOperationSpec: VcHostPatchManagerPatchManagerOperationSpec = new VcHostPatchManagerPatchManagerOperationSpec();
objVcHostPatchManagerPatchManagerOperationSpec.proxy = strProxy;
objVcHostPatchManagerPatchManagerOperationSpec.port = intPort;
objVcHostPatchManagerPatchManagerOperationSpec.cmdOption = strCommandOption;
objVcHostPatchManagerPatchManagerOperationSpec.userName = strUsername;
objVcHostPatchManagerPatchManagerOperationSpec.password = strPassword;
let objVcHostPatchManager: VcHostPatchManager = objVcHostSystem.retrievePatchManager();
try {
let objVcTask: VcTask = objVcHostPatchManager.queryHostPatch_Task(objVcHostPatchManagerPatchManagerOperationSpec);
this.WaitForVcTaskEnd(objVcTask, 2);
}
catch (objException) {
let objError: Error = objException as Error;
this.objLogger.error(`Name: ${objError.name}`);
this.objLogger.error(`Message: ${objError.message}`);
if (objException instanceof VcInvalidState) {
this.objLogger.error(`Thrown if the bulletin ID did not exist.`);
}
else if (objException instanceof VcPlatformConfigFault) {
this.objLogger.error(`Thrown if any error occurs during the operation.More detailed information will be returned within the payload of the exception as xml string`);
}
else if (objException instanceof VcRequestCanceled) {
this.objLogger.error(`Thrown if the operation is canceled.`);
}
else if (objException instanceof VcRuntimeFault) {
this.objLogger.error(`Thrown if any type of runtime fault is thrown that is not covered by the other faults; for example, a communication error.`);
}
else if (objException instanceof VcTaskInProgress) {
this.objLogger.error(`Thrown if there is already a patch installation in progress.`);
}
}
}
------------------------------
Simon Sparks
Automation & Orchestration Consultant
North West England, UK, Europe
Broadcom Employee
------------------------------
Original Message:
Sent: Nov 23, 2011 03:40 AM
From: sanjose
Subject: sample code for queryHostPatch_Task
Hi,
Can I get reference to using result of
queryHostPatch_Task in java code
Thanks