Search in sources :

Example 1 with TraversalSpecBuilder

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"))) };
}
Also used : PropertyFilterSpec(com.vmware.vim25.PropertyFilterSpec) PropertyFilterSpecBuilder(com.vmware.photon.controller.model.adapters.vsphere.util.builders.PropertyFilterSpecBuilder) PropertySpecBuilder(com.vmware.photon.controller.model.adapters.vsphere.util.builders.PropertySpecBuilder) TraversalSpecBuilder(com.vmware.photon.controller.model.adapters.vsphere.util.builders.TraversalSpecBuilder) ObjectSpecBuilder(com.vmware.photon.controller.model.adapters.vsphere.util.builders.ObjectSpecBuilder) ManagedObjectReference(com.vmware.vim25.ManagedObjectReference)

Example 2 with TraversalSpecBuilder

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);
}
Also used : TraversalSpec(com.vmware.vim25.TraversalSpec) SelectionSpec(com.vmware.vim25.SelectionSpec) TraversalSpecBuilder(com.vmware.photon.controller.model.adapters.vsphere.util.builders.TraversalSpecBuilder) SelectionSpecBuilder(com.vmware.photon.controller.model.adapters.vsphere.util.builders.SelectionSpecBuilder)

Aggregations

TraversalSpecBuilder (com.vmware.photon.controller.model.adapters.vsphere.util.builders.TraversalSpecBuilder)2 ObjectSpecBuilder (com.vmware.photon.controller.model.adapters.vsphere.util.builders.ObjectSpecBuilder)1 PropertyFilterSpecBuilder (com.vmware.photon.controller.model.adapters.vsphere.util.builders.PropertyFilterSpecBuilder)1 PropertySpecBuilder (com.vmware.photon.controller.model.adapters.vsphere.util.builders.PropertySpecBuilder)1 SelectionSpecBuilder (com.vmware.photon.controller.model.adapters.vsphere.util.builders.SelectionSpecBuilder)1 ManagedObjectReference (com.vmware.vim25.ManagedObjectReference)1 PropertyFilterSpec (com.vmware.vim25.PropertyFilterSpec)1 SelectionSpec (com.vmware.vim25.SelectionSpec)1 TraversalSpec (com.vmware.vim25.TraversalSpec)1