Having created a sample to run a program in guest operating system using GuestProgramManager, I started to write a similar one to show how to use the GuestFileManager. Compared with the GuestProgramManager, the GuestFileManager is much more complicated to use.
So I decided to take time to develop a high-level guest management API on top of the existing VI Java API. Besides the existing features offered by the vSphere API itself, I also added new features like uploading and downloading a whole directory (vSphere API itself only supports uploading and downloading a single file), uploading and downloading file to and from Java stream. The stream support is very important for an API, not much so for a command line tool.
Bothered by SLOW Web UI to manage vSphere? Want to manage ALL your VMware vCenters, AWS, Azure, Openstack, container behind a SINGLE pane of glass? Want to search, analyze, report, visualize VMs, hosts, networks, datastores, events as easily as Google the Web? Find out more about vSearch 3.0: the search engine for all your private and public clouds.
The core of the guest opermanagement API for vSphere is two classes: GuestProgramDirector and GuestFileDirector, which corresponds to the GuestProgramManager and GuestFileManager. The names are consistent with the fact that a director is high level to a manager.
The usage of the APIs is straight-forward. The methods, especially those in the GuestFileDirector, are pretty similar to what you do with conventional command lines. For example, the downloadFile method has the following signature. I think you can guess out how to use this method easily.
public void downloadFile(String filePathInGuest, String filePathLocal) throws IOException
I will explain more about each of the types with samples in future blogs. Here is the API for you to download.