Class: RbVmomi::VIM
- Inherits:
-
Object
show all
- Defined in:
- lib/vmonkey/vim/vim.rb
Defined Under Namespace
Classes: Datacenter, Folder, VirtualApp, VirtualMachine
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Instance Attribute Details
#cluster ⇒ Object
Returns the value of attribute cluster.
7
8
9
|
# File 'lib/vmonkey/vim/vim.rb', line 7
def cluster
@cluster
end
|
#dc ⇒ Object
Returns the value of attribute dc.
6
7
8
|
# File 'lib/vmonkey/vim/vim.rb', line 6
def dc
@dc
end
|
#opts ⇒ Object
Returns the value of attribute opts.
8
9
10
|
# File 'lib/vmonkey/vim/vim.rb', line 8
def opts
@opts
end
|
Class Method Details
.default_opts ⇒ Object
20
21
22
|
# File 'lib/vmonkey/vim/vim.rb', line 20
def self.default_opts
self.read_yml_opts
end
|
.monkey_connect(opts = nil) ⇒ Object
10
11
12
13
14
15
16
17
18
|
# File 'lib/vmonkey/vim/vim.rb', line 10
def self.monkey_connect(opts = nil)
opts ||= self.default_opts
vim = self.connect(opts)
vim.opts = opts
vim.dc = vim.serviceInstance.find_datacenter(vim.opts[:datacenter]) or raise "Datacenter not found [#{vim.opts[:datacenter]}]"
vim.cluster = vim.dc.find_compute_resource(vim.opts[:cluster]) or raise "Cluster not found [#{vim.opts[:cluster]}]"
vim
end
|
Instance Method Details
#customization_spec(spec_name) ⇒ Object
68
69
70
71
72
73
|
# File 'lib/vmonkey/vim/vim.rb', line 68
def customization_spec(spec_name)
return nil if spec_name.nil?
serviceContent.customizationSpecManager.GetCustomizationSpec(name: spec_name).spec
rescue
nil
end
|
#folder(path) ⇒ Object
24
25
26
|
# File 'lib/vmonkey/vim/vim.rb', line 24
def folder(path)
dc.vmFolder.traverse path, RbVmomi::VIM::Folder
end
|
#folder!(path) ⇒ Object
28
29
30
|
# File 'lib/vmonkey/vim/vim.rb', line 28
def folder!(path)
folder(path) || raise("Folder not found. [#{path}]")
end
|
#get(path) ⇒ Object
64
65
66
|
# File 'lib/vmonkey/vim/vim.rb', line 64
def get(path)
dc.vmFolder.traverse path
end
|
#vapp(path) ⇒ Object
56
57
58
|
# File 'lib/vmonkey/vim/vim.rb', line 56
def vapp(path)
dc.vmFolder.traverse path, RbVmomi::VIM::VirtualApp
end
|
#vapp!(path) ⇒ Object
60
61
62
|
# File 'lib/vmonkey/vim/vim.rb', line 60
def vapp!(path)
vapp(path) || raise("VirtualApp not found. [#{path}]")
end
|
#vm(path) ⇒ Object
32
33
34
|
# File 'lib/vmonkey/vim/vim.rb', line 32
def vm(path)
dc.vmFolder.traverse path, RbVmomi::VIM::VirtualMachine
end
|
#vm!(path) ⇒ Object
36
37
38
|
# File 'lib/vmonkey/vim/vim.rb', line 36
def vm!(path)
vm(path) || raise("VirtualMachine not found. [#{path}]")
end
|
#vm_by_instance_uuid(uuid) ⇒ Object
48
49
50
|
# File 'lib/vmonkey/vim/vim.rb', line 48
def vm_by_instance_uuid(uuid)
dc.vmFolder.findByInstanceUuid uuid
end
|
#vm_by_instance_uuid!(uuid) ⇒ Object
52
53
54
|
# File 'lib/vmonkey/vim/vim.rb', line 52
def vm_by_instance_uuid!(uuid)
vm_by_instance_uuid(uuid) || raise("VirtualMachine not found. [#{uuid}]")
end
|
#vm_by_uuid(uuid) ⇒ Object
40
41
42
|
# File 'lib/vmonkey/vim/vim.rb', line 40
def vm_by_uuid(uuid)
dc.vmFolder.findByUuid uuid, RbVmomi::VIM::VirtualMachine, dc
end
|
#vm_by_uuid!(uuid) ⇒ Object
44
45
46
|
# File 'lib/vmonkey/vim/vim.rb', line 44
def vm_by_uuid!(uuid)
vm_by_uuid(uuid) || raise("VirtualMachine not found. [#{uuid}]")
end
|