VMware Cloud Community
schmitz3michael
Contributor
Contributor

Automatic vRA 8.x Deployment Update with vRO

Hi,

I created a workflow to move a virtual machine to another network. It changes the VM Network adapter to another distributed port group. If I run it, everyting looks fine in vCenter, but the vRA deployment is still showing the old network name.

So my first idea was to wait until the next data collection run, but the network name didn't changed.

Only after manually click on Actions > Update at the deployment and then change the Network input, I'm able to Update the Network Name in my deployment.

Is there a way to automate these manual steps with a vRO Workflow?
I don't find any option to edit a vRA deployment with vRO.

Reply
0 Kudos
1 Reply
xian_
Expert
Expert

Here is a sample code from vRA plugin extensibility action setDeploymentLease

 

if (vraHost == null || deploymentId == null) return null;

var operation = "POST";
var url = "/deployment/api/deployments/" + deploymentId + "/requests";

var leaseDateFormatted = System.formatDate(leaseDate, "yyyy-MM-dd'T'HH:mm:ss'.000Z'");

var object = {
	"actionId": "Deployment.ChangeLease",
	"targetId": deploymentId,
	"inputs": {
		"Lease Expiration Date": leaseDateFormatted
	}
};

var content = JSON.stringify(object);

try {
	var contentAsString = System.getModule("com.vmware.vra.extensibility.plugin.rest").invokeRestOperation(vraHost, operation, url, content);
	var object = JSON.parse(contentAsString);
	return contentAsString;
} catch (e) {
	throw ("Unable to POST object url : " + url + "\n" + e + "\nWith Content : " + content);
}

 

 It's easy to adapt for your usecase, actionId is Deployment.Update

HTH

Reply
0 Kudos