I am looking to get VM annotation from VMware VM. I see a task name Get VMware VM Details it does provides lot of details but not annotation. Is it possible to modify the script to extract annotations ? Below is the current script for VMware VM Details custom workflow task
loadLibrary("JSON-JS-Module/JSON-JS-ModuleLibrary");
var vmId = input.vmid;
var opName = "userAPIGetVMSummary";
function getVMDetails(){
var payload = {};
payload.param0 = vmId;
var jsonInString = JSON2.stringify(payload);
logger.addInfo(jsonInString);
resultObj = executeJSONAPI(opName,jsonInString);
if(resultObj.serviceResult == null){
logger.addError(responseObj.serviceError);
ctxt.setFailed();
ctxt.exit();
}
output.OUTPUT_OVERVIEW_VM_ID = resultObj.serviceResult.rows[0].Overview_VM_ID;
output.OUTPUT_OVERVIEW_INSTANCE_NAME = resultObj.serviceResult.rows[0].Overview_Instance_Name;
output.OUTPUT_OVERVIEW_STATUS = resultObj.serviceResult.rows[0].Overview_Status;
output.OUTPUT_OVERVIEW_IP_ADDRESS = resultObj.serviceResult.rows[0].Overview_IP_Address;
output.OUTPUT_OVERVIEW_HOSTNAME = resultObj.serviceResult.rows[0].Overview_Hostname;
output.OUTPUT_OVERVIEW_CLOUD_NAME = resultObj.serviceResult.rows[0].Overview_Cloud_Name;
output.OUTPUT_OWNERSHIP_GROUP = resultObj.serviceResult.rows[0].Ownership_Group;
output.OUTPUT_OWNERSHIP_VDC = resultObj.serviceResult.rows[0].Ownership_vDC;
output.OUTPUT_OVERVIEW_FOLDER = resultObj.serviceResult.rows[0].Overview_Folder;
output.OUTPUT_OVERVIEW_VCENTER_VM_ID = resultObj.serviceResult.rows[0].Overview_vCenter_VM_ID;
output.OUTPUT_RESOURCES_NUM_VIRTUAL_CPUS = resultObj.serviceResult.rows[0].Resources_Num_Virtual_CPUs;
output.OUTPUT_RESOURCES_CPU_SHARES = resultObj.serviceResult.rows[0].Resources_CPU_Shares;
output.OUTPUT_RESOURCES_MEMORY_MB = resultObj.serviceResult.rows[0].Resources_Memory_MB;
output.OUTPUT_GUEST_INFORMATION_GUEST_OS = resultObj.serviceResult.rows[0].Guest_Information_Guest_OS;
output.OUTPUT_STORAGE_NO_OF_DISKS = resultObj.serviceResult.rows[0].Storage_No_of_Disks;
}
function executeJSONAPI(opName, jsonInString){
var result = ctxt.getAPI().performOperationOnJSONPayload(opName,jsonInString);
//logger.addInfo(result);
var resultObj = JSON2.parse(result);
return resultObj;
}
getVMDetails();