Anybody have an example of editing the Machine Item Description field programmatically through any means?
I have tried working with the Café Entity, but it only adds a Custom property called "description" instead of actually editing the description itself.
When you execute a Reconfigure (once called Edit) from the Web GUI, the REST call has a couple of keys for description... but it also has all the Networks, Storage, and "PropertyBag" keys. And those keys are so long with properties and custom properties, it wouldn't be terribly viable to build out the keys based on the machine choice. (doable but nightmarish to support... e.g if a custom property is added later, the key value breaks)
I am going to try to play around with the REST calls today, but I don't think it will turn out very promising.
If I understand your question correctly I think this should work
var entity = vCACVm.getEntity();
var hostId = entity.hostId;
var modelName = entity.modelName;
var entitySetName = entity.entitySetName;
var entityIdString = entity.keyString;
var links = null;
var headers = null;
var updateProperties = new Properties();
updateProperties.put("Notes", description);
System.getModule("com.vmware.library.vcac").updateVCACEntity(hostId, modelName, entitySetName, entityIdString, updateProperties, links, headers);
Reconfigure requires all the properties which are already part of the existing item + the modified value so there is not way you can achieve this directly. I have tried out doing some thing similar like Edit CPU and Memory using vCO workflows as well as through vCAC Rest API. From Rest API you wont be getting all the required information that are required to perform Reconfigure since most of the information are stored in IAAS.
If I understand your question correctly I think this should work
var entity = vCACVm.getEntity();
var hostId = entity.hostId;
var modelName = entity.modelName;
var entitySetName = entity.entitySetName;
var entityIdString = entity.keyString;
var links = null;
var headers = null;
var updateProperties = new Properties();
updateProperties.put("Notes", description);
System.getModule("com.vmware.library.vcac").updateVCACEntity(hostId, modelName, entitySetName, entityIdString, updateProperties, links, headers);
Kumarakpl... thanks, that is pretty much what I determined as well.
Paul,
You are a genius!
Thank you very much. That is exactly what we needed. Whatever your company is paying you, they should double it.
This also helps me to better understand working with these model entities in general. I really appreciate it.
Sean