Class: RbVmomi::VIM::ManagedObject
- Inherits:
-
Object
- Object
- RbVmomi::VIM::ManagedObject
- Defined in:
- lib/rbvmomi/vim/ManagedObject.rb
Instance Method Summary collapse
-
#collect(*pathSet) {|*values| ... } ⇒ Array
Efficiently retrieve multiple properties from an object.
-
#collect!(*pathSet) ⇒ Hash
Efficiently retrieve multiple properties from an object.
-
#wait_until(*pathSet) { ... } ⇒ Object
Wait for updates on an object until a condition becomes true.
Instance Method Details
#collect(*pathSet) {|*values| ... } ⇒ Array
Efficiently retrieve multiple properties from an object.
46 47 48 49 50 51 52 53 54 |
# File 'lib/rbvmomi/vim/ManagedObject.rb', line 46 def collect *pathSet h = collect! *pathSet a = pathSet.map { |k| h[k.to_s] } if block_given? yield a else a end end |
#collect!(*pathSet) ⇒ Hash
Efficiently retrieve multiple properties from an object.
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/rbvmomi/vim/ManagedObject.rb', line 30 def collect! *pathSet spec = { :objectSet => [{ :obj => self }], :propSet => [{ :pathSet => pathSet, :type => self.class.wsdl_name }] } @soap.propertyCollector.RetrieveProperties(:specSet => [spec])[0].to_hash end |
#wait_until(*pathSet) { ... } ⇒ Object
TODO:
Pass the current property values to the block.
Wait for updates on an object until a condition becomes true.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/rbvmomi/vim/ManagedObject.rb', line 9 def wait_until *pathSet, &b all = pathSet.empty? filter = @soap.propertyCollector.CreateFilter :spec => { :propSet => [{ :type => self.class.wsdl_name, :all => all, :pathSet => pathSet }], :objectSet => [{ :obj => self }], }, :partialUpdates => false ver = '' loop do result = @soap.propertyCollector.WaitForUpdates(:version => ver) ver = result.version if x = b.call return x end end ensure filter.DestroyPropertyFilter if filter end |