Class: Fog::Compute::Joyent::Server
- Inherits:
-
Server
show all
- Defined in:
- lib/fog/joyent/models/compute/server.rb
Instance Attribute Summary
Attributes inherited from Server
#private_key, #private_key_path, #public_key, #public_key_path, #ssh_port, #username
Attributes inherited from Model
#collection, #service
Instance Method Summary
collapse
Methods inherited from Server
#scp, #scp_download, #ssh, #sshable?
Methods inherited from Model
#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
#connection, #connection=, #prepare_service_value
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Model
Instance Method Details
97
98
99
100
|
# File 'lib/fog/joyent/models/compute/server.rb', line 97
def add_tags(tags_hash = {})
requires :id
service.add_machine_tags(self.id, tags_hash).body
end
|
86
87
88
89
90
|
# File 'lib/fog/joyent/models/compute/server.rb', line 86
def delete_all_metadata
requires :id
service.delete_all_machine_metadata(self.id)
true
end
|
110
111
112
113
114
115
|
# File 'lib/fog/joyent/models/compute/server.rb', line 110
def delete_all_tags
requires :id
service.delete_all_machine_tags(self.id)
true
end
|
78
79
80
81
82
83
84
|
# File 'lib/fog/joyent/models/compute/server.rb', line 78
def delete_metadata(keyname)
raise ArgumentError, "Must provide a key name to delete" if keyname.nil? || keyname.empty?
requires :id
service.delete_machine_metadata(self.id, keyname)
true
end
|
#delete_tag(tagname) ⇒ Object
102
103
104
105
106
107
108
|
# File 'lib/fog/joyent/models/compute/server.rb', line 102
def delete_tag(tagname)
requires :id
raise ArgumentError, "Must provide a tag name to delete" if tagname.nil? || tagname.empty?
service.delete_machine_tag(self.id, tagname)
true
end
|
#destroy ⇒ Object
34
35
36
37
38
|
# File 'lib/fog/joyent/models/compute/server.rb', line 34
def destroy
requires :id
service.delete_machine(id)
true
end
|
#public_ip_address ⇒ Object
21
22
23
|
# File 'lib/fog/joyent/models/compute/server.rb', line 21
def public_ip_address
ips.empty? ? nil : ips.first
end
|
#ready? ⇒ Boolean
25
26
27
|
# File 'lib/fog/joyent/models/compute/server.rb', line 25
def ready?
self.state == 'running'
end
|
#reboot ⇒ Object
60
61
62
63
64
|
# File 'lib/fog/joyent/models/compute/server.rb', line 60
def reboot
requires :id
service.reboot_machine(id)
true
end
|
#resize(flavor) ⇒ Object
54
55
56
57
58
|
# File 'lib/fog/joyent/models/compute/server.rb', line 54
def resize(flavor)
requires :id
service.resize_machine(id, flavor.name)
true
end
|
#snapshots ⇒ Object
66
67
68
69
|
# File 'lib/fog/joyent/models/compute/server.rb', line 66
def snapshots
requires :id
service.snapshots.all(id)
end
|
#start ⇒ Object
40
41
42
43
44
45
|
# File 'lib/fog/joyent/models/compute/server.rb', line 40
def start
requires :id
service.start_machine(id)
self.wait_for { ready? }
true
end
|
#stop ⇒ Object
47
48
49
50
51
52
|
# File 'lib/fog/joyent/models/compute/server.rb', line 47
def stop
requires :id
service.stop_machine(id)
self.wait_for { stopped? }
true
end
|
#stopped? ⇒ Boolean
29
30
31
32
|
# File 'lib/fog/joyent/models/compute/server.rb', line 29
def stopped?
requires :id
self.state == 'stopped'
end
|
92
93
94
95
|
# File 'lib/fog/joyent/models/compute/server.rb', line 92
def tags
requires :id
service.list_machine_tags(id).body
end
|
71
72
73
74
75
76
|
# File 'lib/fog/joyent/models/compute/server.rb', line 71
def update_metadata(data = {})
requires :id
service.update_machine_metadata(self.id, data)
self.reload
true
end
|