Class: RbVmomi::VIM::Folder

Inherits:
Object
  • Object
show all
Defined in:
lib/vmonkey/vim/Folder.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject



50
51
52
# File 'lib/vmonkey/vim/Folder.rb', line 50

def destroy
  self.Destroy_Task.wait_for_completion
end

#findByInstanceUuid(uuid, type = RbVmomi::VIM::VirtualMachine, dc = nil) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/vmonkey/vim/Folder.rb', line 12

def findByInstanceUuid uuid, type=RbVmomi::VIM::VirtualMachine, dc=nil
  propSpecs = {
    :entity => self, :uuid => uuid, :instanceUuid => true,
    :vmSearch => type == RbVmomi::VIM::VirtualMachine
  }
  propSpecs[:datacenter] = dc if dc
  x = _connection.searchIndex.FindByUuid(propSpecs)
  x if x.is_a? type
end

#folder(path) ⇒ Object



34
35
36
# File 'lib/vmonkey/vim/Folder.rb', line 34

def folder(path)
  self.traverse path, RbVmomi::VIM::Folder
end

#folder!(path) ⇒ Object



38
39
40
# File 'lib/vmonkey/vim/Folder.rb', line 38

def folder!(path)
  folder(path) || raise("Folder not found. [#{path}]")
end

#foldersObject



22
23
24
# File 'lib/vmonkey/vim/Folder.rb', line 22

def folders
  self.childEntity.grep(RbVmomi::VIM::Folder)
end

#mk_folder(path) ⇒ Object



42
43
44
# File 'lib/vmonkey/vim/Folder.rb', line 42

def mk_folder(path)
  self.traverse path, RbVmomi::VIM::Folder, true
end

#mk_parent_folder(path) ⇒ Object



46
47
48
# File 'lib/vmonkey/vim/Folder.rb', line 46

def mk_parent_folder(path)
  mk_folder path.parent unless path.parent.to_s.empty?
end

#templatesObject



26
27
28
# File 'lib/vmonkey/vim/Folder.rb', line 26

def templates
  self.childEntity.grep(RbVmomi::VIM::VirtualMachine).select { |v| v.config && v.config.template }
end

#vm_folderObject



8
9
10
# File 'lib/vmonkey/vim/Folder.rb', line 8

def vm_folder
  self
end

#vm_poolObject



4
5
6
# File 'lib/vmonkey/vim/Folder.rb', line 4

def vm_pool
  monkey.cluster.resourcePool
end

#vmsObject



30
31
32
# File 'lib/vmonkey/vim/Folder.rb', line 30

def vms
  self.childEntity.grep(RbVmomi::VIM::VirtualMachine).select { |v| v.config.nil? || (v.config && !v.config.template) }
end