Class: Fog::Slicehost::Server
- Inherits:
-
Model
- Object
- Model
- Fog::Slicehost::Server
show all
- Defined in:
- lib/fog/slicehost/models/server.rb
Instance Attribute Summary
Attributes inherited from Model
#connection
Instance Method Summary
collapse
Methods inherited from Model
#collection, #initialize, #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
This class inherits a constructor from Fog::Model
Instance Method Details
#destroy ⇒ Object
21
22
23
24
25
|
# File 'lib/fog/slicehost/models/server.rb', line 21
def destroy
requires :id
connection.delete_slice(@id)
true
end
|
#flavor ⇒ Object
27
28
29
30
|
# File 'lib/fog/slicehost/models/server.rb', line 27
def flavor
requires :flavor_id
connection.flavors.get(@flavor_id)
end
|
#image ⇒ Object
32
33
34
35
|
# File 'lib/fog/slicehost/models/server.rb', line 32
def image
requires :image_id
connection.images.get(@image_id)
end
|
#ready? ⇒ Boolean
37
38
39
|
# File 'lib/fog/slicehost/models/server.rb', line 37
def ready?
@status == 'active'
end
|
#reboot(type = 'SOFT') ⇒ Object
41
42
43
44
45
|
# File 'lib/fog/slicehost/models/server.rb', line 41
def reboot(type = 'SOFT')
requires :id
connection.reboot_server(@id, type)
true
end
|
#save ⇒ Object
47
48
49
50
51
52
|
# File 'lib/fog/slicehost/models/server.rb', line 47
def save
requires :flavor_id, :image_id, :name
data = connection.create_slice(@flavor_id, @image_id, @name)
merge_attributes(data.body)
true
end
|