Class: Fog::Compute::Joyent::Server
- Inherits:
-
Server
- Object
- Server
- Fog::Compute::Joyent::Server
- Defined in:
- lib/fog/joyent/models/compute/server.rb
Instance Method Summary collapse
- #add_tags(tags_hash = {}) ⇒ Object
- #delete_all_metadata ⇒ Object
- #delete_all_tags ⇒ Object
- #delete_metadata(keyname) ⇒ Object
- #delete_tag(tagname) ⇒ Object
- #destroy ⇒ Object
- #list_tags ⇒ Object
- #public_ip_address ⇒ Object
- #ready? ⇒ Boolean
- #reboot ⇒ Object
- #resize(flavor) ⇒ Object
- #snapshots ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
- #stopped? ⇒ Boolean
- #update_metadata(data = {}) ⇒ Object
Instance Method Details
#add_tags(tags_hash = {}) ⇒ Object
102 103 104 105 |
# File 'lib/fog/joyent/models/compute/server.rb', line 102 def ( = {}) requires :id service.(self.id, ).body end |
#delete_all_metadata ⇒ Object
91 92 93 94 95 |
# File 'lib/fog/joyent/models/compute/server.rb', line 91 def requires :id service.(self.id) true end |
#delete_all_tags ⇒ Object
115 116 117 118 119 120 |
# File 'lib/fog/joyent/models/compute/server.rb', line 115 def requires :id service.(self.id) true end |
#delete_metadata(keyname) ⇒ Object
83 84 85 86 87 88 89 |
# File 'lib/fog/joyent/models/compute/server.rb', line 83 def (keyname) raise ArgumentError, "Must provide a key name to delete" if keyname.nil? || keyname.empty? requires :id service.(self.id, keyname) true end |
#delete_tag(tagname) ⇒ Object
107 108 109 110 111 112 113 |
# File 'lib/fog/joyent/models/compute/server.rb', line 107 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
39 40 41 42 43 |
# File 'lib/fog/joyent/models/compute/server.rb', line 39 def destroy requires :id service.delete_machine(id) true end |
#list_tags ⇒ Object
97 98 99 100 |
# File 'lib/fog/joyent/models/compute/server.rb', line 97 def requires :id service.(id).body end |
#public_ip_address ⇒ Object
26 27 28 |
# File 'lib/fog/joyent/models/compute/server.rb', line 26 def public_ip_address ips.empty? ? nil : ips.first end |
#ready? ⇒ Boolean
30 31 32 |
# File 'lib/fog/joyent/models/compute/server.rb', line 30 def ready? self.state == 'running' end |
#reboot ⇒ Object
65 66 67 68 69 |
# File 'lib/fog/joyent/models/compute/server.rb', line 65 def reboot requires :id service.reboot_machine(id) true end |
#resize(flavor) ⇒ Object
59 60 61 62 63 |
# File 'lib/fog/joyent/models/compute/server.rb', line 59 def resize(flavor) requires :id service.resize_machine(id, flavor.name) true end |
#snapshots ⇒ Object
71 72 73 74 |
# File 'lib/fog/joyent/models/compute/server.rb', line 71 def snapshots requires :id service.snapshots.all(id) end |
#start ⇒ Object
45 46 47 48 49 50 |
# File 'lib/fog/joyent/models/compute/server.rb', line 45 def start requires :id service.start_machine(id) self.wait_for { ready? } true end |
#stop ⇒ Object
52 53 54 55 56 57 |
# File 'lib/fog/joyent/models/compute/server.rb', line 52 def stop requires :id service.stop_machine(id) self.wait_for { stopped? } true end |
#stopped? ⇒ Boolean
34 35 36 37 |
# File 'lib/fog/joyent/models/compute/server.rb', line 34 def stopped? requires :id self.state == 'stopped' end |
#update_metadata(data = {}) ⇒ Object
76 77 78 79 80 81 |
# File 'lib/fog/joyent/models/compute/server.rb', line 76 def (data = {}) requires :id service.(self.id, data) self.reload true end |