First, you will need to download the vCO Cli Fling here and download the vmoapp plugin. After that, we’ll need to download the vCO Cli itself from the drop down box (tar or zip, depends on your OS). Once that is done, you’ll need to install the vmoapp plugin on vCO through the plugin install section in vCO Configuration page. After we’ve successfully installed the plugin, (make sure you don’t see ‘ will be installed on next startup’ this means you are not done!) we’ll open up vCO client, a new vCO Cli folder with a ‘Start Session’ Workflow will appear!
To achieve this, what I usually do is to edit copy the “start session” workflow, into a specific plugin’s folder, and name it “Start a<plugin name> plugin session”.
For the sake of a simple example, I’ll use a simple VC:VirtualMachine object for this demonstration. But, when developing with new plugins its great to be able to execute an object’s method, and explore the result instantly. After copying the workflow to the folder with the proper name, we’ll edit the workflow, adding some predefined attributes of our choice to explore.
Here I’ll add a VC:VirtualMachine object for us to work on.
Connecting to our session
After everything is set, we’ll start the vCO CLI Session workflow.
Two optional input parameters available for us, ‘name’ and ‘ipaddress’. While I’m not quite sure what’s the purpose of ipaddress, giving the session a helpful name will allow me to identify the specific session with vCO CLI with ease.
The workflow will now be in a running state for about 3-4 hours from my experience. Next, we’ll start our vCO CLI session by opening the zip / tar folder on our client machine, and running vcocli-gui.bat
Make sure you have the java binary folder in your ‘path’ environement variable set on your computer . If you don’t have it set, just run this command in cmd.exe:
[code]setx PATH “%PATH%;C:\progra~1\Java\jre7\bin\” [/code]
After entering an IP address, and a proper username / password for our vCO server, we’ll get a list of active sessions, and choose which one we want to connect to. Be sure to click Attach, since we’re connecting to an existing session (with a specific object in it). We could also create a new general session.
Exploring & Coding
Lets start exploring some of the features available to us with this interface. First, I’ll mess around with the VC:VirtualMachine I’ve passed in. The VM ‘EmptyPlayVM’.
By simply typing the variable name (vm) and since this interface hooks to an active vCO session, we can now explore it in a visual studio autocomplete style press ctrl+space, and ENTER to complete.
What’s nice about this, is that we can explore the object freely without the need to ask the system for output using System.print , just by clicking the ‘play’ button , which will execute our code.
keep in mind that if you execute any methods on the object – they will happen for real! Say I wanted to execute this line of code:
My vCenter VM won’t be happy about it.
But non the less, this interface is just great for exploring API relationships, such as how to get to one object from another, what certain methods return and such.
Even more things to explore!
If you take a closer look at the help section of vCO CLI , you will notice that there are a lot more things that we’re able to do with this tool like:
- Exploring the real time objects in the right side pane
- Running actual vCO workflows with a simple command $workflows.Library.<path to workflow>
- saving script files, and write functions.
- parse existing script files, JSON files and more!