Class: Fog::Voxel::Compute::Server
- Inherits:
-
Model
- Object
- Model
- Fog::Voxel::Compute::Server
show all
- Defined in:
- lib/fog/compute/models/voxel/server.rb
Instance Attribute Summary
Attributes inherited from Model
#collection, #connection
Instance Method Summary
collapse
Methods inherited from Model
#inspect, #reload, #to_json, #wait_for
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
#_dump, #attributes, #identity, #identity=, #merge_attributes, #new_record?, #requires
Constructor Details
#initialize(attributes = {}) ⇒ Server
Returns a new instance of Server.
18
19
20
|
# File 'lib/fog/compute/models/voxel/server.rb', line 18
def initialize(attributes={})
super
end
|
Instance Method Details
#destroy ⇒ Object
22
23
24
25
26
|
# File 'lib/fog/compute/models/voxel/server.rb', line 22
def destroy
requires :id
connection.voxcloud_delete(id)
true
end
|
#image ⇒ Object
28
29
30
31
|
# File 'lib/fog/compute/models/voxel/server.rb', line 28
def image
requires :image_id
connection.images.get(image_id)
end
|
#private_ip_address ⇒ Object
37
38
39
|
# File 'lib/fog/compute/models/voxel/server.rb', line 37
def private_ip_address
ip_assignments.select {|ip_assignment| ip_assignment['type'] == 'internal'}.first
end
|
#public_ip_address ⇒ Object
41
42
43
|
# File 'lib/fog/compute/models/voxel/server.rb', line 41
def public_ip_address
ip_assignments.select {|ip_assignment| ip_assignment['type'] == 'external'}.first
end
|
#ready? ⇒ Boolean
33
34
35
|
# File 'lib/fog/compute/models/voxel/server.rb', line 33
def ready?
status == 'SUCCEEDED'
end
|
#reboot ⇒ Object
45
46
47
48
49
|
# File 'lib/fog/compute/models/voxel/server.rb', line 45
def reboot
requires :id
connection.devices_power(id, :reboot)
true
end
|
#save ⇒ Object
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/fog/compute/models/voxel/server.rb', line 55
def save
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if identity
requires :name, :image_id, :processing_cores, :facility, :disk_size
data = connection.voxcloud_create({
:disk_size => disk_size,
:facility => facility,
:hostname => name,
:image_id => image_id,
:processing_cores => processing_cores
}).body
merge_attributes(data['device'])
true
end
|
#status ⇒ Object
51
52
53
|
# File 'lib/fog/compute/models/voxel/server.rb', line 51
def status
@status ||= connection.voxcloud_status(id).body['devices'].first['status']
end
|