mirror of
https://github.com/jbowdre/vRealize.git
synced 2024-11-23 10:12:18 +00:00
Create logPayloadProperties.js
This commit is contained in:
parent
31a26de026
commit
745e44fad9
1 changed files with 30 additions and 0 deletions
|
@ -0,0 +1,30 @@
|
||||||
|
/* JavaScript: logPayloadProperties action
|
||||||
|
Writes out all the properties of a VM request payload from vRA for testing purposes.
|
||||||
|
Inputs: payload (Properties)
|
||||||
|
Return Type: string
|
||||||
|
*/
|
||||||
|
System.debug("==== Begin: vRA Event Broker Payload Properties ====");
|
||||||
|
logAllProperties(inputProperties,0);
|
||||||
|
System.debug("==== End: vRA Event Broker Payload Properties ====");
|
||||||
|
|
||||||
|
function logAllProperties(props,indent) {
|
||||||
|
var keys = (props.keys).sort();
|
||||||
|
for each (var key in keys) {
|
||||||
|
var prop = props.get(key);
|
||||||
|
var type = System.getObjectType(prop);
|
||||||
|
if (type == "Properties") {
|
||||||
|
logSingleProperty(key,prop,indent);
|
||||||
|
logAllProperties(prop,indent+1);
|
||||||
|
} else {
|
||||||
|
logSingleProperty(key,prop,indent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function logSingleProperty(name,value,i) {
|
||||||
|
var prefix = "";
|
||||||
|
if (i > 0) {
|
||||||
|
var prefix = Array(i+1).join("-") + " ";
|
||||||
|
}
|
||||||
|
System.debug(prefix + name + " :: " + System.getObjectType(value) + " :: " + value);
|
||||||
|
}
|
Loading…
Reference in a new issue