Class: Fog::Compute::DigitalOcean::Server
- Inherits:
-
Server
- Object
- Server
- Fog::Compute::DigitalOcean::Server
- Defined in:
- lib/fog/compute/digitalocean/models/server.rb
Overview
A DigitalOcean Droplet
Instance Method Summary collapse
- #action(action_id) ⇒ Object
- #actions ⇒ Object
- #change_kernel(kernel) ⇒ Object
- #delete ⇒ Object
- #disable_backups ⇒ Object
- #enable_ipv6 ⇒ Object
- #enable_private_networking ⇒ Object
- #ipv4_address ⇒ Object
- #ipv6_address ⇒ Object
- #locked? ⇒ Boolean
- #password_reset ⇒ Object
- #power_cycle ⇒ Object
- #power_off ⇒ Object
- #power_on ⇒ Object
- #public_ip_address ⇒ Object
- #ready? ⇒ Boolean
- #reboot ⇒ Object
- #rebuild(image) ⇒ Object
- #rename(name) ⇒ Object
- #resize(resize_disk, size) ⇒ Object
- #restore(image) ⇒ Object
- #save ⇒ Object
- #shutdown ⇒ Object
- #snapshot(name) ⇒ Object
- #upgrade ⇒ Object
Instance Method Details
#action(action_id) ⇒ Object
89 90 91 92 93 |
# File 'lib/fog/compute/digitalocean/models/server.rb', line 89 def action(action_id) requires :id response = service.get_droplet_action(id, action_id) response.body end |
#actions ⇒ Object
83 84 85 86 87 |
# File 'lib/fog/compute/digitalocean/models/server.rb', line 83 def actions requires :id response = service.list_droplet_actions id response.body end |
#change_kernel(kernel) ⇒ Object
139 140 141 |
# File 'lib/fog/compute/digitalocean/models/server.rb', line 139 def change_kernel(kernel) perform_action :change_kernel, kernel end |
#delete ⇒ Object
69 70 71 72 73 |
# File 'lib/fog/compute/digitalocean/models/server.rb', line 69 def delete requires :id response = service.delete_server id response.body end |
#disable_backups ⇒ Object
99 100 101 |
# File 'lib/fog/compute/digitalocean/models/server.rb', line 99 def disable_backups perform_action :disable_backups end |
#enable_ipv6 ⇒ Object
143 144 145 |
# File 'lib/fog/compute/digitalocean/models/server.rb', line 143 def enable_ipv6 perform_action :enable_ipv6 end |
#enable_private_networking ⇒ Object
147 148 149 |
# File 'lib/fog/compute/digitalocean/models/server.rb', line 147 def enable_private_networking perform_action :enable_private_networking end |
#ipv4_address ⇒ Object
42 43 44 45 46 |
# File 'lib/fog/compute/digitalocean/models/server.rb', line 42 def ipv4_address if (net = networks['v4'].find { |n| n['type'] == 'public' }) net['ip_address'] end end |
#ipv6_address ⇒ Object
36 37 38 39 40 |
# File 'lib/fog/compute/digitalocean/models/server.rb', line 36 def ipv6_address if (net = networks['v6'].find { |n| n['type'] == 'public' }) net['ip_address'] end end |
#locked? ⇒ Boolean
79 80 81 |
# File 'lib/fog/compute/digitalocean/models/server.rb', line 79 def locked? locked end |
#password_reset ⇒ Object
123 124 125 |
# File 'lib/fog/compute/digitalocean/models/server.rb', line 123 def password_reset perform_action :password_reset end |
#power_cycle ⇒ Object
103 104 105 |
# File 'lib/fog/compute/digitalocean/models/server.rb', line 103 def power_cycle perform_action :power_cycle end |
#power_off ⇒ Object
111 112 113 |
# File 'lib/fog/compute/digitalocean/models/server.rb', line 111 def power_off perform_action :power_off end |
#power_on ⇒ Object
115 116 117 |
# File 'lib/fog/compute/digitalocean/models/server.rb', line 115 def power_on perform_action :power_on end |
#public_ip_address ⇒ Object
32 33 34 |
# File 'lib/fog/compute/digitalocean/models/server.rb', line 32 def public_ip_address ipv4_address end |
#ready? ⇒ Boolean
75 76 77 |
# File 'lib/fog/compute/digitalocean/models/server.rb', line 75 def ready? status == 'active' end |
#reboot ⇒ Object
95 96 97 |
# File 'lib/fog/compute/digitalocean/models/server.rb', line 95 def reboot perform_action :reboot_server end |
#rebuild(image) ⇒ Object
131 132 133 |
# File 'lib/fog/compute/digitalocean/models/server.rb', line 131 def rebuild(image) perform_action :rebuild, image end |
#rename(name) ⇒ Object
135 136 137 |
# File 'lib/fog/compute/digitalocean/models/server.rb', line 135 def rename(name) perform_action :rename, name end |
#resize(resize_disk, size) ⇒ Object
127 128 129 |
# File 'lib/fog/compute/digitalocean/models/server.rb', line 127 def resize(resize_disk, size) perform_action :resize, resize_disk, size end |
#restore(image) ⇒ Object
119 120 121 |
# File 'lib/fog/compute/digitalocean/models/server.rb', line 119 def restore(image) perform_action :restore, image end |
#save ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/fog/compute/digitalocean/models/server.rb', line 48 def save raise Fog::Errors::Error.new('Re-saving an existing object may create a duplicate') if persisted? requires :name, :region, :size, :image = {} if attributes[:ssh_keys] [:ssh_keys] = attributes[:ssh_keys] elsif @ssh_keys [:ssh_keys] = @ssh_keys.map(&:id) end [:private_networking] = private_networking [:backups] = backups [:ipv6] = ipv6 data = service.create_server(name, size, image, region, ) merge_attributes(data.body['droplet']) true end |
#shutdown ⇒ Object
107 108 109 |
# File 'lib/fog/compute/digitalocean/models/server.rb', line 107 def shutdown perform_action :shutdown end |
#snapshot(name) ⇒ Object
151 152 153 |
# File 'lib/fog/compute/digitalocean/models/server.rb', line 151 def snapshot(name) perform_action :snapshot, name end |
#upgrade ⇒ Object
155 156 157 |
# File 'lib/fog/compute/digitalocean/models/server.rb', line 155 def upgrade perform_action :upgrade end |