Class: Fog::Compute::Glesys::Server
Instance Attribute Summary
Attributes inherited from Model
#collection, #connection
Instance Method Summary
collapse
deprecate, self_deprecate
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
#destroy ⇒ Object
43
44
45
46
|
# File 'lib/fog/glesys/models/compute/server.rb', line 43
def destroy
requires :identity
connection.destroy(:serverid => identity, :keepip => keepip)
end
|
#ready? ⇒ Boolean
29
30
31
|
# File 'lib/fog/glesys/models/compute/server.rb', line 29
def ready?
state == 'running'
end
|
#save ⇒ Object
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/fog/glesys/models/compute/server.rb', line 48
def save
raise "Operation not supported" if self.identity
requires :hostname, :rootpw
options = {
:datacenter => datacenter || "Falkenberg",
:platform => platform || "Xen",
:hostname => hostname,
:template => template || "Debian-6 x64",
:disksize => disksize || "10",
:memorysize => memorysize || "512",
:cpucores => cpucores || "1",
:rootpw => rootpw,
:transfer => transfer || "500",
}
data = connection.create(options)
merge_attributes(data.body['response']['server'])
data.status == 200 ? true : false
end
|
#start ⇒ Object
33
34
35
36
|
# File 'lib/fog/glesys/models/compute/server.rb', line 33
def start
requires :identity
connection.start(:serverid => identity)
end
|
#stop ⇒ Object
38
39
40
41
|
# File 'lib/fog/glesys/models/compute/server.rb', line 38
def stop
requires :identity
connection.stop(:serverid => identity)
end
|