Class: Fog::Compute::Joyent::Server
- Inherits:
-
Server
show all
- Defined in:
- lib/fog/joyent/models/compute/server.rb
Instance Attribute Summary
Attributes inherited from Model
#collection, #connection
Instance Method Summary
collapse
Methods inherited from Server
#scp, #scp_download, #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
94
95
96
97
|
# File 'lib/fog/joyent/models/compute/server.rb', line 94
def add_tags(tags_hash = {})
requires :id
self.connection.add_machine_tags(self.id, tags_hash).body
end
|
83
84
85
86
87
|
# File 'lib/fog/joyent/models/compute/server.rb', line 83
def delete_all_metadata
requires :id
self.connection.delete_all_machine_metadata(self.id)
true
end
|
107
108
109
110
111
112
|
# File 'lib/fog/joyent/models/compute/server.rb', line 107
def delete_all_tags
requires :id
self.connection.delete_all_machine_tags(self.id)
true
end
|
75
76
77
78
79
80
81
|
# File 'lib/fog/joyent/models/compute/server.rb', line 75
def delete_metadata(keyname)
raise ArgumentError, "Must provide a key name to delete" if keyname.nil? || keyname.empty?
requires :id
self.connection.delete_machine_metadata(self.id, keyname)
true
end
|
#delete_tag(tagname) ⇒ Object
99
100
101
102
103
104
105
|
# File 'lib/fog/joyent/models/compute/server.rb', line 99
def delete_tag(tagname)
requires :id
raise ArgumentError, "Must provide a tag name to delete" if tagname.nil? || tagname.empty?
self.connection.delete_machine_tag(self.id, tagname)
true
end
|
#destroy ⇒ Object
31
32
33
34
35
|
# File 'lib/fog/joyent/models/compute/server.rb', line 31
def destroy
requires :id
self.connection.delete_machine(id)
true
end
|
#ready? ⇒ Boolean
22
23
24
|
# File 'lib/fog/joyent/models/compute/server.rb', line 22
def ready?
self.state == 'running'
end
|
#reboot ⇒ Object
57
58
59
60
61
|
# File 'lib/fog/joyent/models/compute/server.rb', line 57
def reboot
requires :id
self.connection.reboot_machine(id)
true
end
|
#resize(flavor) ⇒ Object
51
52
53
54
55
|
# File 'lib/fog/joyent/models/compute/server.rb', line 51
def resize(flavor)
requires :id
self.connection.resize(id, flavor)
true
end
|
#snapshots ⇒ Object
63
64
65
66
|
# File 'lib/fog/joyent/models/compute/server.rb', line 63
def snapshots
requires :id
self.connection.snapshots.all(id)
end
|
#start ⇒ Object
37
38
39
40
41
42
|
# File 'lib/fog/joyent/models/compute/server.rb', line 37
def start
requires :id
self.connection.start_machine(id)
self.wait_for { ready? }
true
end
|
#stop ⇒ Object
44
45
46
47
48
49
|
# File 'lib/fog/joyent/models/compute/server.rb', line 44
def stop
requires :id
self.connection.stop_machine(id)
self.wait_for { stopped? }
true
end
|
#stopped? ⇒ Boolean
26
27
28
29
|
# File 'lib/fog/joyent/models/compute/server.rb', line 26
def stopped?
requires :id
self.state == 'stopped'
end
|
89
90
91
92
|
# File 'lib/fog/joyent/models/compute/server.rb', line 89
def tags
requires :id
self.connection.list_machine_tags(id).body
end
|
68
69
70
71
72
73
|
# File 'lib/fog/joyent/models/compute/server.rb', line 68
def update_metadata(data = {})
requires :id
self.connection.update_machine_metadata(self.id, data)
self.reload
true
end
|