Module: OnlyofficeDigitaloceanWrapper::PowerActions

Included in:
DigitalOceanWrapper
Defined in:
lib/onlyoffice_digitalocean_wrapper/digitalocean_wrapper/power_actions.rb

Overview

Actions with power (turn on/off, reboot)

Instance Method Summary collapse

Instance Method Details

#power_off_droplet(droplet_name) ⇒ Symbol

Turn off droplet

Parameters:

  • droplet_name (String)

    droplet to turn off

Returns:

  • (Symbol)

    droplet result status



9
10
11
12
13
# File 'lib/onlyoffice_digitalocean_wrapper/digitalocean_wrapper/power_actions.rb', line 9

def power_off_droplet(droplet_name)
  droplet_id = get_droplet_id_by_name(droplet_name)
  client.droplet_actions.power_off(droplet_id: droplet_id)
  wait_until_droplet_have_status(droplet_name, 'off')
end

#power_on_droplet(droplet_name) ⇒ Symbol

Turn on droplet

Parameters:

  • droplet_name (String)

    droplet to turn on

Returns:

  • (Symbol)

    droplet result status



18
19
20
21
22
# File 'lib/onlyoffice_digitalocean_wrapper/digitalocean_wrapper/power_actions.rb', line 18

def power_on_droplet(droplet_name)
  droplet_id = get_droplet_id_by_name(droplet_name)
  client.droplet_actions.power_on(droplet_id: droplet_id)
  wait_until_droplet_have_status(droplet_name)
end

#reboot_droplet(droplet_name) ⇒ Symbol

Reboot droplet

Parameters:

  • droplet_name (String)

    droplet to reboot

Returns:

  • (Symbol)

    droplet result status



27
28
29
30
31
# File 'lib/onlyoffice_digitalocean_wrapper/digitalocean_wrapper/power_actions.rb', line 27

def reboot_droplet(droplet_name)
  droplet_id = get_droplet_id_by_name(droplet_name)
  client.droplet_actions.reboot(droplet_id: droplet_id)
  wait_until_droplet_have_status(droplet_name)
end