lib/VMwareWebService/MiqVimObjectSet.rb
#
# Construct an ObjectSpec to traverse the entire VI inventory tree.
#
Construct an ObjectSpec to traverse the entire VI inventory tree.
Construct an ObjectSpec to traverse the entire VI inventory tree .
def objectSet
     Traverse VirtualApp to Vm.
    virtualAppTs = VimHash.new("TraversalSpec") do |ts|
      ts.name = "virtualAppTraversalSpec"
      ts.type = "VirtualApp"
      ts.path = "vm"
      ts.skip = "false"
    end unless @v2
     Traverse ResourcePool to ResourcePool and VirtualApp.
    resourcePoolTs = VimHash.new("TraversalSpec") do |ts|
      ts.name      = "resourcePoolTraversalSpec"
      ts.type      = "ResourcePool"
      ts.path      = "resourcePool"
      ts.skip      = "false"
      ts.selectSet = VimArray.new("ArrayOfSelectionSpec") do |ssa|
        ssa << VimHash.new("SelectionSpec") { |ss| ss.name = "resourcePoolTraversalSpec" }
      end
    end
     Traverse ComputeResource to ResourcePool.
    computeResourceRpTs = VimHash.new("TraversalSpec") do |ts|
      ts.name      = "computeResourceRpTraversalSpec"
      ts.type      = "ComputeResource"
      ts.path      = "resourcePool"
      ts.skip      = "false"
      ts.selectSet = VimArray.new("ArrayOfSelectionSpec") do |ssa|
        ssa << VimHash.new("SelectionSpec") { |ss| ss.name = "resourcePoolTraversalSpec" }
      end
    end
     Traverse ComputeResource to host.
    computeResourceHostTs = VimHash.new("TraversalSpec") do |ts|
      ts.name = "computeResourceHostTraversalSpec"
      ts.type = "ComputeResource"
      ts.path = "host"
      ts.skip = "false"
    end
     Traverse Datacenter to host folder.
    datacenterHostTs = VimHash.new("TraversalSpec") do |ts|
      ts.name      = "datacenterHostTraversalSpec"
      ts.type      = "Datacenter"
      ts.path      = "hostFolder"
      ts.skip      = "false"
      ts.selectSet = VimArray.new("ArrayOfSelectionSpec") do |ssa|
        ssa << VimHash.new("SelectionSpec") { |ss| ss.name = "folderTraversalSpec" }
      end
    end
     Traverse Datacenter to VM folder.
    datacenterVmTs = VimHash.new("TraversalSpec") do |ts|
      ts.name      = "datacenterVmTraversalSpec"
      ts.type      = "Datacenter"
      ts.path      = "vmFolder"
      ts.skip      = "false"
      ts.selectSet = VimArray.new("ArrayOfSelectionSpec") do |ssa|
        ssa << VimHash.new("SelectionSpec") { |ss| ss.name = "folderTraversalSpec" }
      end
    end
     Traverse Datacenter to Datastore folder.
    datacenterDsFolderTs = VimHash.new("TraversalSpec") do |ts|
      ts.name      = "dcTodf"
      ts.type      = "Datacenter"
      ts.path      = "datastoreFolder"
      ts.skip      = "false"
      ts.selectSet = VimArray.new("ArrayOfSelectionSpec") do |ssa|
        ssa << VimHash.new("SelectionSpec") { |ss| ss.name = "folderTraversalSpec" }
      end
    end
     Traverse Datacenter to Datastore.
    datacenterDsTs = VimHash.new("TraversalSpec") do |ts|
      ts.name = "datacenterDsTraversalSpec"
      ts.type = "Datacenter"
      ts.path = "datastore"
      ts.skip = "false"
    end
     Traverse Datacenter to Network folder
    datacenterNetworkFolderTs = VimHash.new("TraversalSpec") do |ts|
      ts.name = "dcTonf"
      ts.type = "Datacenter"
      ts.path = "networkFolder"
      ts.skip = "false"
      ts.selectSet = VimArray.new("ArrayOfSelectionSpec") do |ssa|
        ssa << VimHash.new("SelectionSpec") { |ss| ss.name = "folderTraversalSpec" }
      end
    end
     Traverse Folder to children.
    folderTs = VimHash.new("TraversalSpec") do |ts|
      ts.name      = "folderTraversalSpec"
      ts.type      = "Folder"
      ts.path      = "childEntity"
      ts.skip      = "false"
      ts.selectSet = VimArray.new("ArrayOfSelectionSpec") do |ssa|
        ssa << VimHash.new("SelectionSpec") { |ss| ss.name = "folderTraversalSpec" }
        ssa << datacenterHostTs
        ssa << datacenterVmTs
        ssa << datacenterDsTs
        ssa << datacenterDsFolderTs
        ssa << datacenterNetworkFolderTs
        ssa << computeResourceRpTs
        ssa << computeResourceHostTs
        ssa << resourcePoolTs
        ssa << virtualAppTs unless @v2
      end
    end
    aOobjSpec = VimArray.new("ArrayOfObjectSpec") do |osa|
      osa << VimHash.new("ObjectSpec") do |os|
        os.obj       = @sic.rootFolder
        os.skip      = "false"
        os.selectSet = VimArray.new("ArrayOfSelectionSpec") { |ssa| ssa << folderTs }
      end
      if isVirtualCenter
        osa << VimHash.new("ObjectSpec") do |os|
          os.obj = @sic.licenseManager
        end
        osa << VimHash.new("ObjectSpec") do |os|
          os.obj = @sic.extensionManager
        end
      end
    end
    (aOobjSpec)
  end
def objectSet virtualAppTs = VimHash . new ( "TraversalSpec" ) do | ts | ts . name = "virtualAppTraversalSpec" ts . type = "VirtualApp" ts . path = "vm" ts . skip = "false" end unless @v2 resourcePoolTs = VimHash . new ( "TraversalSpec" ) do | ts | ts . name = "resourcePoolTraversalSpec" ts . type = "ResourcePool" ts . path = "resourcePool" ts . skip = "false" ts . selectSet = VimArray . new ( "ArrayOfSelectionSpec" ) do | ssa | ssa << VimHash . new ( "SelectionSpec" ) { | ss | ss . name = "resourcePoolTraversalSpec" } end end computeResourceRpTs = VimHash . new ( "TraversalSpec" ) do | ts | ts . name = "computeResourceRpTraversalSpec" ts . type = "ComputeResource" ts . path = "resourcePool" ts . skip = "false" ts . selectSet = VimArray . new ( "ArrayOfSelectionSpec" ) do | ssa | ssa << VimHash . new ( "SelectionSpec" ) { | ss | ss . name = "resourcePoolTraversalSpec" } end end computeResourceHostTs = VimHash . new ( "TraversalSpec" ) do | ts | ts . name = "computeResourceHostTraversalSpec" ts . type = "ComputeResource" ts . path = "host" ts . skip = "false" end datacenterHostTs = VimHash . new ( "TraversalSpec" ) do | ts | ts . name = "datacenterHostTraversalSpec" ts . type = "Datacenter" ts . path = "hostFolder" ts . skip = "false" ts . selectSet = VimArray . new ( "ArrayOfSelectionSpec" ) do | ssa | ssa << VimHash . new ( "SelectionSpec" ) { | ss | ss . name = "folderTraversalSpec" } end end datacenterVmTs = VimHash . new ( "TraversalSpec" ) do | ts | ts . name = "datacenterVmTraversalSpec" ts . type = "Datacenter" ts . path = "vmFolder" ts . skip = "false" ts . selectSet = VimArray . new ( "ArrayOfSelectionSpec" ) do | ssa | ssa << VimHash . new ( "SelectionSpec" ) { | ss | ss . name = "folderTraversalSpec" } end end datacenterDsFolderTs = VimHash . new ( "TraversalSpec" ) do | ts | ts . name = "dcTodf" ts . type = "Datacenter" ts . path = "datastoreFolder" ts . skip = "false" ts . selectSet = VimArray . new ( "ArrayOfSelectionSpec" ) do | ssa | ssa << VimHash . new ( "SelectionSpec" ) { | ss | ss . name = "folderTraversalSpec" } end end datacenterDsTs = VimHash . new ( "TraversalSpec" ) do | ts | ts . name = "datacenterDsTraversalSpec" ts . type = "Datacenter" ts . path = "datastore" ts . skip = "false" end datacenterNetworkFolderTs = VimHash . new ( "TraversalSpec" ) do | ts | ts . name = "dcTonf" ts . type = "Datacenter" ts . path = "networkFolder" ts . skip = "false" ts . selectSet = VimArray . new ( "ArrayOfSelectionSpec" ) do | ssa | ssa << VimHash . new ( "SelectionSpec" ) { | ss | ss . name = "folderTraversalSpec" } end end folderTs = VimHash . new ( "TraversalSpec" ) do | ts | ts . name = "folderTraversalSpec" ts . type = "Folder" ts . path = "childEntity" ts . skip = "false" ts . selectSet = VimArray . new ( "ArrayOfSelectionSpec" ) do | ssa | ssa << VimHash . new ( "SelectionSpec" ) { | ss | ss . name = "folderTraversalSpec" } ssa << datacenterHostTs ssa << datacenterVmTs ssa << datacenterDsTs ssa << datacenterDsFolderTs ssa << datacenterNetworkFolderTs ssa << computeResourceRpTs ssa << computeResourceHostTs ssa << resourcePoolTs ssa << virtualAppTs unless @v2 end end aOobjSpec = VimArray . new ( "ArrayOfObjectSpec" ) do | osa | osa << VimHash . new ( "ObjectSpec" ) do | os | os . obj = @sic . rootFolder os . skip = "false" os . selectSet = VimArray . new ( "ArrayOfSelectionSpec" ) { | ssa | ssa << folderTs } end if isVirtualCenter osa << VimHash . new ( "ObjectSpec" ) do | os | os . obj = @sic . licenseManager end osa << VimHash . new ( "ObjectSpec" ) do | os | os . obj = @sic . extensionManager end end end ( aOobjSpec ) end
Construct an ObjectSpec to traverse the entire VI inventory tree.
Construct an ObjectSpec to traverse the entire VI inventory tree .
# # Traverse VirtualApp to Vm. # # # Traverse ResourcePool to ResourcePool and VirtualApp. # # # Traverse ComputeResource to ResourcePool. # # # Traverse ComputeResource to host. # # # Traverse Datacenter to host folder. # # # Traverse Datacenter to VM folder. # # # Traverse Datacenter to Datastore folder. # # # Traverse Datacenter to Datastore. # # # Traverse Datacenter to Network folder # # # Traverse Folder to children. #