Class: Fog::Slicehost::Compute::Server
- Inherits:
-
Model
- Object
- Model
- Fog::Slicehost::Compute::Server
show all
- Defined in:
- lib/fog/slicehost/models/compute/server.rb
Instance Attribute Summary
Attributes inherited from Model
#connection
Instance Method Summary
collapse
Methods inherited from Model
#collection, #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.
22
23
24
25
|
# File 'lib/fog/slicehost/models/compute/server.rb', line 22
def initialize(attributes={})
@flavor_id ||= 1
super
end
|
Instance Method Details
#destroy ⇒ Object
27
28
29
30
31
|
# File 'lib/fog/slicehost/models/compute/server.rb', line 27
def destroy
requires :id
connection.delete_slice(@id)
true
end
|
#flavor ⇒ Object
33
34
35
36
|
# File 'lib/fog/slicehost/models/compute/server.rb', line 33
def flavor
requires :flavor_id
connection.flavors.get(@flavor_id)
end
|
#image ⇒ Object
38
39
40
41
|
# File 'lib/fog/slicehost/models/compute/server.rb', line 38
def image
requires :image_id
connection.images.get(@image_id)
end
|
#ready? ⇒ Boolean
43
44
45
|
# File 'lib/fog/slicehost/models/compute/server.rb', line 43
def ready?
@status == 'active'
end
|
#reboot(type = 'SOFT') ⇒ Object
47
48
49
50
51
|
# File 'lib/fog/slicehost/models/compute/server.rb', line 47
def reboot(type = 'SOFT')
requires :id
connection.reboot_slice(@id, type)
true
end
|
#save ⇒ Object
53
54
55
56
57
58
|
# File 'lib/fog/slicehost/models/compute/server.rb', line 53
def save
requires :flavor_id, :image_id, :name
data = connection.create_slice(@flavor_id, @image_id, @name)
merge_attributes(data.body)
true
end
|