def build_recursive_traversal_spec(client_factory):
 visit_folders_select_spec = build_selection_spec(client_factory, 'visitFolders')
 dc_to_hf = build_traversal_spec(client_factory, 'dc_to_hf', 'Datacenter', 'hostFolder', False, [visit_folders_select_spec])
 dc_to_vmf = build_traversal_spec(client_factory, 'dc_to_vmf', 'Datacenter', 'vmFolder', False, [visit_folders_select_spec])
 h_to_vm = build_traversal_spec(client_factory, 'h_to_vm', 'HostSystem', 'vm', False, [visit_folders_select_spec])
 cr_to_h = build_traversal_spec(client_factory, 'cr_to_h', 'ComputeResource', 'host', False, [])
 cr_to_ds = build_traversal_spec(client_factory, 'cr_to_ds', 'ComputeResource', 'datastore', False, [])
 rp_to_rp_select_spec = build_selection_spec(client_factory, 'rp_to_rp')
 rp_to_vm_select_spec = build_selection_spec(client_factory, 'rp_to_vm')
 cr_to_rp = build_traversal_spec(client_factory, 'cr_to_rp', 'ComputeResource', 'resourcePool', False, [rp_to_rp_select_spec, rp_to_vm_select_spec])
 rp_to_rp = build_traversal_spec(client_factory, 'rp_to_rp', 'ResourcePool', 'resourcePool', False, [rp_to_rp_select_spec, rp_to_vm_select_spec])
 rp_to_vm = build_traversal_spec(client_factory, 'rp_to_vm', 'ResourcePool', 'vm', False, [rp_to_rp_select_spec, rp_to_vm_select_spec])
 traversal_spec = build_traversal_spec(client_factory, 'visitFolders', 'Folder', 'childEntity', False, [visit_folders_select_spec, dc_to_hf, dc_to_vmf, cr_to_ds, cr_to_h, cr_to_rp, rp_to_rp, h_to_vm, rp_to_vm])
 return traversal_spec

def build_recursive_traversal_spec ( client_factory ) : visit_folders_select_spec = build_selection_spec ( client_factory , 'visitFolders' ) dc_to_hf = build_traversal_spec ( client_factory , 'dc_to_hf' , 'Datacenter' , 'hostFolder' , False , [ visit_folders_select_spec ] ) dc_to_vmf = build_traversal_spec ( client_factory , 'dc_to_vmf' , 'Datacenter' , 'vmFolder' , False , [ visit_folders_select_spec ] ) h_to_vm = build_traversal_spec ( client_factory , 'h_to_vm' , 'HostSystem' , 'vm' , False , [ visit_folders_select_spec ] ) cr_to_h = build_traversal_spec ( client_factory , 'cr_to_h' , 'ComputeResource' , 'host' , False , [ ] ) cr_to_ds = build_traversal_spec ( client_factory , 'cr_to_ds' , 'ComputeResource' , 'datastore' , False , [ ] ) rp_to_rp_select_spec = build_selection_spec ( client_factory , 'rp_to_rp' ) rp_to_vm_select_spec = build_selection_spec ( client_factory , 'rp_to_vm' ) cr_to_rp = build_traversal_spec ( client_factory , 'cr_to_rp' , 'ComputeResource' , 'resourcePool' , False , [ rp_to_rp_select_spec , rp_to_vm_select_spec ] ) rp_to_rp = build_traversal_spec ( client_factory , 'rp_to_rp' , 'ResourcePool' , 'resourcePool' , False , [ rp_to_rp_select_spec , rp_to_vm_select_spec ] ) rp_to_vm = build_traversal_spec ( client_factory , 'rp_to_vm' , 'ResourcePool' , 'vm' , False , [ rp_to_rp_select_spec , rp_to_vm_select_spec ] ) traversal_spec = build_traversal_spec ( client_factory , 'visitFolders' , 'Folder' , 'childEntity' , False , [ visit_folders_select_spec , dc_to_hf , dc_to_vmf , cr_to_ds , cr_to_h , cr_to_rp , rp_to_rp , h_to_vm , rp_to_vm ] ) return traversal_spec
builds the recursive traversal spec to traverse the object managed object hierarchy .