use of com.vmware.photon.controller.model.adapters.vsphere.util.builders.TraversalSpecBuilder in project photon-model by vmware.
the class GetMoRef method propertyFilterSpecs.
public PropertyFilterSpec[] propertyFilterSpecs(ManagedObjectReference container, String morefType, String... morefProperties) throws RuntimeFaultFaultMsg {
init();
ManagedObjectReference viewManager = this.serviceContent.getViewManager();
ManagedObjectReference containerView = this.vimPort.createContainerView(viewManager, container, Arrays.asList(morefType), true);
return new PropertyFilterSpec[] { new PropertyFilterSpecBuilder().propSet(new PropertySpecBuilder().all(Boolean.FALSE).type(morefType).pathSet(morefProperties)).objectSet(new ObjectSpecBuilder().obj(containerView).skip(Boolean.TRUE).selectSet(new TraversalSpecBuilder().name("view").path("view").skip(false).type("ContainerView"))) };
}
use of com.vmware.photon.controller.model.adapters.vsphere.util.builders.TraversalSpecBuilder in project photon-model by vmware.
the class GetMoRef method getVMTraversalSpec.
/**
* @return TraversalSpec specification to get to the VirtualMachine managed
* object.
*/
public TraversalSpec getVMTraversalSpec() {
// Create a traversal spec that starts from the 'root' objects
// and traverses the inventory tree to get to the VirtualMachines.
// Build the traversal specs bottoms up
// Traversal to get to the VM in a VApp
TraversalSpec vAppToVM = new TraversalSpecBuilder().name("vAppToVM").type("VirtualApp").path("vm");
// Traversal spec for VApp to VApp
TraversalSpec vAppToVApp = new TraversalSpecBuilder().name("vAppToVApp").type("VirtualApp").path("resourcePool").selectSet(// SelectionSpec for both VApp to VApp and VApp to VM
new SelectionSpecBuilder().name("vAppToVApp"), new SelectionSpecBuilder().name("vAppToVM"));
// This SelectionSpec is used for recursion for Folder recursion
SelectionSpec visitFolders = new SelectionSpecBuilder().name("VisitFolders");
// Traversal to get to the vmFolder from DataCenter
TraversalSpec dataCenterToVMFolder = new TraversalSpecBuilder().name("DataCenterToVMFolder").type("Datacenter").path("vmFolder").skip(false).selectSet(visitFolders);
// TraversalSpec to get to the DataCenter from rootFolder
return new TraversalSpecBuilder().name("VisitFolders").type("Folder").path("childEntity").skip(false).selectSet(visitFolders, dataCenterToVMFolder, vAppToVM, vAppToVApp);
}
Aggregations