vCO Workflow Script to Add REST Operations to a REST Host for OpsView – Part 2

The following script is part 2 and enables the addition of REST Operations to a REST Host for OpsView

 

 

var arrKeys;
	arrKeys = objProperties.keys;

for ( var a = 0; a < arrRESTHosts.length; a++ )
{
	var objRESTHost;
		objRESTHost = arrRESTHosts[i];

	for ( var i = 0; i < arrKeys.length; i++ )
	{
		var strKey;
			strKey = arrKeys[i];

		var arrKey;
			arrKey = strKey.split('-');

		var strMethod;
			strMethod = arrKey[0].toUpperCase();

		var strTemplateURL;
			strTemplateURL = objProperties.get(strKey);

		var objRESTOperation;
			objRESTOperation = new RESTOperation(strKey);
			objRESTOperation.method = strMethod;
			objRESTOperation.urlTemplate = strTemplateURL;
			objRESTOperation.defaultContentType = "application/json";

			objRESTOperation = objRESTHost.addOperation(objRESTOperation);

			RESTHostManager.updateHost(objRESTHost);
	}
}

Leave a Reply