Skip to content

Instantly share code, notes, and snippets.

@chelnak
Last active December 7, 2020 09:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chelnak/03eebad726f5e3ade12d to your computer and use it in GitHub Desktop.
Save chelnak/03eebad726f5e3ade12d to your computer and use it in GitHub Desktop.
/*
Name: getLinkProperties
Input: vCACHost - vCAC:VCACHost
Input: vCACVirtualMachine - vCAC:VirtualMachine
Description: List the properties for a vCAC entity object link
*/
//Set the name of the link here:
var linkName = "VMDiskHardware";
var properties = new Properties();
properties.put("VirtualMachineID", vCACVirtualMachine.virtualMachineID);
var vmEntity = vCACEntityManager.readModelEntity(vCACHost.id, "ManagementModelEntities.svc", "VirtualMachines", properties, null);
var linkEntity = vmEntity.getLink(vCACHost, linkName);
//Log snapshot properties to the console
for (var i = 0; i < linkEntity.length; i++) {
var linkProperties = linkEntity[i].getProperties();
for (var j = 0; j < linkProperties.keys.length; j++) {
System.log(linkProperties.keys[j] + " : " + linkProperties.get(linkProperties.keys[j]));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment