Class: Fog::Compute::Joyent::Server
- Inherits:
-
Server
show all
- Defined in:
- lib/rackspace-fog/joyent/models/compute/server.rb
Instance Attribute Summary
Attributes inherited from Model
#collection, #connection
Instance Method Summary
collapse
Methods inherited from Server
#private_key=, #scp, #scp_download, #ssh, #ssh_port, #sshable?
Methods inherited from Model
#initialize, #inspect, #reload, #symbolize_keys, #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
93
94
95
96
|
# File 'lib/rackspace-fog/joyent/models/compute/server.rb', line 93
def add_tags(tags_hash = {})
requires :id
self.connection.add_machine_tags(self.id, tags_hash).body
end
|
82
83
84
85
86
|
# File 'lib/rackspace-fog/joyent/models/compute/server.rb', line 82
def delete_all_metadata
requires :id
self.connection.delete_all_machine_metadata(self.id)
true
end
|
106
107
108
109
110
111
|
# File 'lib/rackspace-fog/joyent/models/compute/server.rb', line 106
def delete_all_tags
requires :id
self.connection.delete_all_machine_tags(self.id)
true
end
|
74
75
76
77
78
79
80
|
# File 'lib/rackspace-fog/joyent/models/compute/server.rb', line 74
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
98
99
100
101
102
103
104
|
# File 'lib/rackspace-fog/joyent/models/compute/server.rb', line 98
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
30
31
32
33
34
|
# File 'lib/rackspace-fog/joyent/models/compute/server.rb', line 30
def destroy
requires :id
self.connection.delete_machine(id)
true
end
|
#ready? ⇒ Boolean
21
22
23
|
# File 'lib/rackspace-fog/joyent/models/compute/server.rb', line 21
def ready?
self.state == 'running'
end
|
#reboot ⇒ Object
56
57
58
59
60
|
# File 'lib/rackspace-fog/joyent/models/compute/server.rb', line 56
def reboot
requires :id
self.connection.reboot_machine(id)
true
end
|
#resize(flavor) ⇒ Object
50
51
52
53
54
|
# File 'lib/rackspace-fog/joyent/models/compute/server.rb', line 50
def resize(flavor)
requires :id
self.connection.resize_machine(id, flavor)
true
end
|
#snapshots ⇒ Object
62
63
64
65
|
# File 'lib/rackspace-fog/joyent/models/compute/server.rb', line 62
def snapshots
requires :id
self.connection.snapshots.all(id)
end
|
#start ⇒ Object
36
37
38
39
40
41
|
# File 'lib/rackspace-fog/joyent/models/compute/server.rb', line 36
def start
requires :id
self.connection.start_machine(id)
self.wait_for { ready? }
true
end
|
#stop ⇒ Object
43
44
45
46
47
48
|
# File 'lib/rackspace-fog/joyent/models/compute/server.rb', line 43
def stop
requires :id
self.connection.stop_machine(id)
self.wait_for { stopped? }
true
end
|
#stopped? ⇒ Boolean
25
26
27
28
|
# File 'lib/rackspace-fog/joyent/models/compute/server.rb', line 25
def stopped?
requires :id
self.state == 'stopped'
end
|
88
89
90
91
|
# File 'lib/rackspace-fog/joyent/models/compute/server.rb', line 88
def tags
requires :id
self.connection.list_machine_tags(id).body
end
|
67
68
69
70
71
72
|
# File 'lib/rackspace-fog/joyent/models/compute/server.rb', line 67
def update_metadata(data = {})
requires :id
self.connection.update_machine_metadata(self.id, data)
self.reload
true
end
|