Class: Fog::Compute::Vsphere::Server
- Inherits:
-
Server
show all
- Defined in:
- lib/fog/vsphere/models/compute/server.rb
Instance Attribute Summary
Attributes inherited from Model
#collection, #connection
Instance Method Summary
collapse
Methods inherited from Server
#scp, #ssh
Methods inherited from Model
#initialize, #inspect, #reload, #to_json, #wait_for
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Model
Instance Method Details
#clone(options = {}) ⇒ Object
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# File 'lib/fog/vsphere/models/compute/server.rb', line 60
def clone(options = {})
requires :name, :path
req_options = options.inject({}) { |hsh, (k,v)| hsh[k.to_s] = v; hsh }
req_options['path'] ="#{path}/#{name}"
clone_results = connection.vm_clone(req_options)
new_vm = self.class.new(clone_results['vm_attributes'])
new_vm.collection = self.collection
new_vm.connection = self.connection
new_vm
end
|
#destroy(options = {}) ⇒ Object
55
56
57
58
|
# File 'lib/fog/vsphere/models/compute/server.rb', line 55
def destroy(options = {})
requires :instance_uuid
connection.vm_destroy('instance_uuid' => instance_uuid)
end
|
#reboot(options = {}) ⇒ Object
49
50
51
52
53
|
# File 'lib/fog/vsphere/models/compute/server.rb', line 49
def reboot(options = {})
options = { :force => false }.merge(options)
requires :instance_uuid
connection.vm_reboot('instance_uuid' => instance_uuid, 'force' => options[:force])
end
|
#start(options = {}) ⇒ Object
38
39
40
41
|
# File 'lib/fog/vsphere/models/compute/server.rb', line 38
def start(options = {})
requires :instance_uuid
connection.vm_power_on('instance_uuid' => instance_uuid)
end
|
#stop(options = {}) ⇒ Object
43
44
45
46
47
|
# File 'lib/fog/vsphere/models/compute/server.rb', line 43
def stop(options = {})
options = { :force => false }.merge(options)
requires :instance_uuid
connection.vm_power_off('instance_uuid' => instance_uuid, 'force' => options[:force])
end
|