Hi,
I **think** that this maps to the Properties object...
try this...
System.log(yourObject.toSource());
Where are you finding this in the API explorer exactly? java.util.Map should be a java class that is being exposed. I'm not finding it in my api explorer however or referenced anywhere.
importing java.util.map should give you access to all of this stuff in Java though:
https://docs.oracle.com/javase/7/docs/api/java/util/Map.html
It is used by vCACCAFECatalogResourceRequest class in vRO API, shown as below. So that I do not know how to use these methods.
Yeah, I think so, but I have tried to treat it as Properties object, failed, I can not get attribute keys of the Properties object.
And I also tried System.log(yourObject.toSource()), the output is ({}) @
Sorry, no @ in last my comment.
Yeah, it's just a java map as a return type. Give me a bit and I'll get some example code on how to read what it's doing.
Okay, so I found where I'm actually using this. In general, you want to know what you are looking for already but you can experiment in a workflow by taking apart the map:
Assuming 'foo' is your java.util.Map returned object, and barring that I am bad at javascript today and you should not use this for anything more than just browsing:
This will give you the key names in the map:
var fooKeys = Object.keys(foo);
System.log(fooKeys);
This will just output stuff from it, and I know there is a better way to do this and I'm just blanking on it:
for(i in fooKeys){
System.log('Key Name: ' + fooKeys[i]);
System.log('Value: ' + foo[fooKeys[i]]);
}
In general, you're trying to put together an updated or new map depending on what you are calling, and the contents of that will vary based on what you are up to. In my case I'm using this to update blueprint component properties, so I'm creating new maps out of the existing structures and calling them in updateBlueprintComponentProperties
Thanks so much for the detailed reply. Yeah, I tried you code
var fooKeys = Object.keys(foo);
System.log(fooKeys);
But, the output is weird, that is "[Add vCAC VirtualMachine disk v1 (2/20/17 01:32:09)] " ,
In fact, What I want to do is to request the built-in vRA action "Reconfigure" to add disk to a VM. I want to customize my request data,
so I want to get the request template first and set the request data, which is the java.util.map type in vRO.
var requestTemplate = vCACCAFERequestsHelper.getRequestForResourceAction(resourceAction);
System.log("requestTemplate: " + requestTemplate);
var requestTemplateData = requestTemplate.getData();
System.log("requestTemplateData: " + requestTemplateData);
With the Above code, I can saw the requestTemplate details, but can not saw any details about RequestTemplateData . So I am almost confused.
Sadly I'm failing to find any working resource actions to test this with (and it doesn't help that my test env's vro blew up), but I did find:
"Request a resource action with a request template" which is an example workflow in vRO.
It's looking like you want:
//Operation is a thing that the workflow started with, unsure what it would be. You can probably skip it if you already have a way to find your resource request.
var requestTemplate = vCACCAFERequestsHelper.getRequestForResourceAction(operation)
//This is the part you were missing, and is one of those hilarious vra-isms:
var jsonData = vCACCAFERequestsHelper.getResourceActionRequestData(requestTemplate);
var json = JSON.parse(jsonData);
//Change cpu example
json.cpu = 2;
//Apparently you just need to do this, vra-ism:
json["Cafe.Shim.VirtualMachine.Reconfigure.Requestor"] = 1;
//This puts everything back in the right format:
vCACCAFERequestsHelper.setResourceActionRequestData(requestTemplate, JSON.stringify(json));
//And this actually says go do the work:
request = System.getModule("com.vmware.library.vcaccafe.request").requestResourceActionWithRequestTemplate(operation, requestTemplate);
In general the challenge with a lot of vRA stuff is that so much of it is figuring out what the heck the data format you got back was, and how to convert it back and forth to usable formats. But thankfully you can crib a lot by some creative searches through other workflows and actions. All credit to VMWare on this one, I didn't come up with any of that code.