class RbVmomi::VIM::ResourcePool
Copyright © 2011-2017 VMware, Inc. All Rights Reserved. SPDX-License-Identifier: MIT
Public Class Methods
resourcePoolSubTree(objs, fields = [])
click to toggle source
# File lib/rbvmomi/vim/ResourcePool.rb, line 27 def self.resourcePoolSubTree objs, fields = [] fields = (fields + ['name', 'resourcePool']).uniq filterSpec = RbVmomi::VIM.PropertyFilterSpec( objectSet: objs.map do |obj| RbVmomi::VIM.ObjectSpec( obj: obj, selectSet: [ RbVmomi::VIM.TraversalSpec( name: 'tsRP', type: 'ResourcePool', path: 'resourcePool', skip: false, selectSet: [ RbVmomi::VIM.SelectionSpec(name: 'tsRP') ] ) ] ) end, propSet: [{ pathSet: fields, type: 'ResourcePool' }] ) propCollector = objs.first._connection.propertyCollector result = propCollector.RetrieveProperties(specSet: [filterSpec]) Hash[result.map do |x| [x.obj, x.to_hash] end] end
Public Instance Methods
find(name)
click to toggle source
Retrieve a child ResourcePool
. @param name [String] Name of the child. @return [VIM::ResourcePool]
# File lib/rbvmomi/vim/ResourcePool.rb, line 9 def find name _connection.searchIndex.FindChild(entity: self, name: name) end
resourcePoolSubTree(fields = [])
click to toggle source
# File lib/rbvmomi/vim/ResourcePool.rb, line 23 def resourcePoolSubTree fields = [] self.class.resourcePoolSubTree [self], fields end
traverse(path)
click to toggle source
Retrieve a descendant of this ResourcePool
. @param path [String] Path delimited by ‘/’. @return [VIM::ResourcePool]
# File lib/rbvmomi/vim/ResourcePool.rb, line 16 def traverse path es = path.split('/').reject(&:empty?) es.inject(self) do |f, e| f.find(e) || return end end