Class: Fog::Compute::Linode::Server
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::Linode::Server
show all
- Defined in:
- lib/fog/compute/models/linode/server.rb
Instance Attribute Summary collapse
Attributes inherited from Model
#collection, #connection
Instance Method Summary
collapse
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
Constructor Details
This class inherits a constructor from Fog::Model
Instance Attribute Details
#stack_script ⇒ Object
Returns the value of attribute stack_script.
7
8
9
|
# File 'lib/fog/compute/models/linode/server.rb', line 7
def stack_script
@stack_script
end
|
Instance Method Details
#boot ⇒ Object
32
33
34
|
# File 'lib/fog/compute/models/linode/server.rb', line 32
def boot
connection.linode_boot id, config
end
|
#destroy ⇒ Object
52
53
54
55
56
57
58
|
# File 'lib/fog/compute/models/linode/server.rb', line 52
def destroy
requires :identity
connection.linode_shutdown id
disks.each { |disk| disk.destroy }
wait_for { not disks? }
connection.linode_delete id
end
|
#disks ⇒ Object
16
17
18
|
# File 'lib/fog/compute/models/linode/server.rb', line 16
def disks
Fog::Compute::Linode::Disks.new :server => self, :connection => connection
end
|
#disks? ⇒ Boolean
20
21
22
|
# File 'lib/fog/compute/models/linode/server.rb', line 20
def disks?
not disks.empty?
end
|
#ips ⇒ Object
12
13
14
|
# File 'lib/fog/compute/models/linode/server.rb', line 12
def ips
Fog::Compute::Linode::Ips.new :server => self, :connection => connection
end
|
#reboot ⇒ Object
24
25
26
|
# File 'lib/fog/compute/models/linode/server.rb', line 24
def reboot
connection.linode_reboot id
end
|
#save ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/fog/compute/models/linode/server.rb', line 36
def save
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if identity
@data_center, @flavor, @image, @kernel, @type, @payment_terms, @stack_script, @name, @password, @callback =
attributes.values_at :data_center, :flavor, :image, :kernel, :type, :payment_terms, :stack_script, :name, :password, :callback
create_linode
@callback.call self if @callback
create_disks
create_config
boot_linode
self
rescue Exception => ex
destroy if id
raise ex
end
|
#shutdown ⇒ Object
28
29
30
|
# File 'lib/fog/compute/models/linode/server.rb', line 28
def shutdown
connection.linode_shutdown id
end
|