chelnak
3/23/2016 - 12:11 PM

List the properties for a vCAC entity object link http://www.helloitscraig.co.uk/2016/03/list-available-vcacvirtualmachine-entity-links.htm

/*
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]));
		
	}
		
}