class IBM::Cloud::SDK::VPC::INSTANCE::Actions

Actions for an instance.

Public Class Methods

new(parent) click to toggle source
Calls superclass method
# File lib/ibm/cloud/sdk/vpc/instance/actions.rb, line 14
def initialize(parent)
  super(parent, 'actions')
end

Public Instance Methods

create(action, force: false) click to toggle source

Send a custom action request. @param action [String] The type of action. Allowable values: [reboot, start, stop] @param force [Boolean] If set to true, the action will be forced immediately, and all queued actions deleted. Ignored for the start action.

# File lib/ibm/cloud/sdk/vpc/instance/actions.rb, line 38
def create(action, force: false)
  @logger.info("Sending action request for #{action} with force #{force}.")
  payload = { type: action }
  payload[:force] = force if force
  response = post(payload: payload)
  Action.new(response)
end
reboot(force: false) click to toggle source

Send an action request to reboot the instance. @param force [Boolean] Clear the queue and run this action.

# File lib/ibm/cloud/sdk/vpc/instance/actions.rb, line 31
def reboot(force: false)
  create('reboot', force: force)
end
start() click to toggle source

Send an action request to start the instance.

# File lib/ibm/cloud/sdk/vpc/instance/actions.rb, line 19
def start
  create('start')
end
stop(force: false) click to toggle source

Send an action request to stop the instance. @param force [Boolean] Clear the queue and run this action.

# File lib/ibm/cloud/sdk/vpc/instance/actions.rb, line 25
def stop(force: false)
  create('stop', force: force)
end