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_options, #ssh_port, #username
Attributes inherited from Model
#collection, #service
Instance Method Summary
collapse
Methods inherited from Server
#scp, #scp_download, #ssh, #ssh_ip_address, #ssh_ip_address=, #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
98
99
100
101
|
# File 'lib/fog/joyent/models/compute/server.rb', line 98
def add_tags(tags_hash = {})
requires :id
service.add_machine_tags(self.id, tags_hash).body
end
|
87
88
89
90
91
|
# File 'lib/fog/joyent/models/compute/server.rb', line 87
def delete_all_metadata
requires :id
service.delete_all_machine_metadata(self.id)
true
end
|
111
112
113
114
115
116
|
# File 'lib/fog/joyent/models/compute/server.rb', line 111
def delete_all_tags
requires :id
service.delete_all_machine_tags(self.id)
true
end
|
79
80
81
82
83
84
85
|
# File 'lib/fog/joyent/models/compute/server.rb', line 79
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
103
104
105
106
107
108
109
|
# File 'lib/fog/joyent/models/compute/server.rb', line 103
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
35
36
37
38
39
|
# File 'lib/fog/joyent/models/compute/server.rb', line 35
def destroy
requires :id
service.delete_machine(id)
true
end
|
93
94
95
96
|
# File 'lib/fog/joyent/models/compute/server.rb', line 93
def list_tags
requires :id
service.list_machine_tags(id).body
end
|
#public_ip_address ⇒ Object
22
23
24
|
# File 'lib/fog/joyent/models/compute/server.rb', line 22
def public_ip_address
ips.empty? ? nil : ips.first
end
|
#ready? ⇒ Boolean
26
27
28
|
# File 'lib/fog/joyent/models/compute/server.rb', line 26
def ready?
self.state == 'running'
end
|
#reboot ⇒ Object
61
62
63
64
65
|
# File 'lib/fog/joyent/models/compute/server.rb', line 61
def reboot
requires :id
service.reboot_machine(id)
true
end
|
#resize(flavor) ⇒ Object
55
56
57
58
59
|
# File 'lib/fog/joyent/models/compute/server.rb', line 55
def resize(flavor)
requires :id
service.resize_machine(id, flavor.name)
true
end
|
#snapshots ⇒ Object
67
68
69
70
|
# File 'lib/fog/joyent/models/compute/server.rb', line 67
def snapshots
requires :id
service.snapshots.all(id)
end
|
#start ⇒ Object
41
42
43
44
45
46
|
# File 'lib/fog/joyent/models/compute/server.rb', line 41
def start
requires :id
service.start_machine(id)
self.wait_for { ready? }
true
end
|
#stop ⇒ Object
48
49
50
51
52
53
|
# File 'lib/fog/joyent/models/compute/server.rb', line 48
def stop
requires :id
service.stop_machine(id)
self.wait_for { stopped? }
true
end
|
#stopped? ⇒ Boolean
30
31
32
33
|
# File 'lib/fog/joyent/models/compute/server.rb', line 30
def stopped?
requires :id
self.state == 'stopped'
end
|
72
73
74
75
76
77
|
# File 'lib/fog/joyent/models/compute/server.rb', line 72
def update_metadata(data = {})
requires :id
service.update_machine_metadata(self.id, data)
self.reload
true
end
|