Virtual Infrastructure View Manager APIs
The ViewManager managed object provides methods to create ContainerView, InventoryView, and ListView managed objects.
The ViewManager also maintains a list of managed object references to the views that you have created. Use the viewList property to access the views.
A View is a mechanism that supports selection of objects on the server and subsequently, access to those objects. Views can simplify the task of retrieving data from the server. When you use a view, you can use a single invocation of a PropertyCollector method to retrieve data or receive notification of changes instead of multiple invocations involving multiple filter specifications. A view exists until you destroy it or until the end of the session.
The ViewManager supports the following views:
- A ContainerView is based on Folder, Datacenter, ComputeResource, ResourcePool, or HostSystem managed objects. Use a container view to monitor the container contents and optionally, its descendants.
- A ListView managed object is based on an arbitrary but specific set of objects. When you create a list view, you provide a list of objects to populate the view (CreateListView), or you provide an existing view from which the new view is created (CreateListViewFromView).
- An InventoryView managed object is based on the entire inventory. Use an inventory view as a general mechanism to monitor the inventory or portions of the inventory.
For example, you might use the following sequence of operations to get the names of all the virtual machines on a server:
- Create a ContainerView for the root folder in the server inventory. For the ContainerView, use the type property to include only virtual machines.
- Create a filter specification for the PropertyCollector.
- Use the ContainerView as the starting object in the ObjectSpec for the filter.
- Use the TraversalSpec to select all objects in the view list (all the virtual machines).
- Use the PropertySpec to retrieve the name property from each virtual machine.
- Invoke the PropertyCollector RetrieveProperties method.