Class: IBM::Cloud::SDK::VPC::INSTANCE::Actions
- Inherits:
-
VPCCollection
- Object
- IBM::Cloud::SDKHTTP::BaseCollection
- VPCCollection
- IBM::Cloud::SDK::VPC::INSTANCE::Actions
- Defined in:
- lib/ibm/cloud/sdk/vpc/instance/actions.rb
Overview
Actions for an instance.
Instance Attribute Summary
Attributes included from IBM::Cloud::SDKHTTP::BaseHTTPMixin
Attributes inherited from IBM::Cloud::SDKHTTP::BaseCollection
#connection, #endpoint, #logger, #token
Instance Method Summary collapse
-
#create(action, force: false) ⇒ Object
Send a custom action request.
-
#initialize(parent) ⇒ Actions
constructor
A new instance of Actions.
-
#reboot(force: false) ⇒ Object
Send an action request to reboot the instance.
-
#start ⇒ Object
Send an action request to start the instance.
-
#stop(force: false) ⇒ Object
Send an action request to stop the instance.
Methods inherited from VPCCollection
Methods included from VpcHTTP
Methods included from IBM::Cloud::SDKHTTP::BaseHTTPMixin
#adhoc, #delete, #get, #metadata, #patch, #post, #put, #unchecked_response, #url
Methods inherited from IBM::Cloud::SDKHTTP::BaseCollection
#all, #data, #fetch, #params, #reset_params
Constructor Details
#initialize(parent) ⇒ Actions
14 15 16 |
# File 'lib/ibm/cloud/sdk/vpc/instance/actions.rb', line 14 def initialize(parent) super(parent, 'actions') end |
Instance Method Details
#create(action, force: false) ⇒ Object
Send a custom action request.
38 39 40 41 42 43 44 |
# 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) ⇒ Object
Send an action request to reboot the instance.
31 32 33 |
# File 'lib/ibm/cloud/sdk/vpc/instance/actions.rb', line 31 def reboot(force: false) create('reboot', force: force) end |
#start ⇒ Object
Send an action request to start the instance.
19 20 21 |
# File 'lib/ibm/cloud/sdk/vpc/instance/actions.rb', line 19 def start create('start') end |
#stop(force: false) ⇒ Object
Send an action request to stop the instance.
25 26 27 |
# File 'lib/ibm/cloud/sdk/vpc/instance/actions.rb', line 25 def stop(force: false) create('stop', force: force) end |