Class: Kitchen::Driver::Oci::Models::Compute
- Inherits:
-
Instance
- Object
- Base
- Kitchen::Driver::Oci
- Instance
- Kitchen::Driver::Oci::Models::Compute
- Includes:
- ComputeLaunchDetails
- Defined in:
- lib/kitchen/driver/oci/models/compute.rb
Overview
Compute instance model.
Instance Attribute Summary collapse
-
#launch_details ⇒ OCI::Core::Models::LaunchInstanceDetails
The details model that describes a compute instance.
Attributes inherited from Instance
#api, #config, #logger, #oci, #state
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Compute
constructor
A new instance of Compute.
-
#launch ⇒ Hash
Launches a compute instance.
-
#reboot ⇒ Object
Reboots a compute instance.
-
#terminate ⇒ Object
Terminates a compute instance.
Methods inherited from Instance
Methods included from Kitchen::Driver::Oci::Mixin::SshKeys
#algorithm, #generate_keys, #private_key_file, #public_key_file, #read_public_key
Methods included from Instance::CommonLaunchDetails
#availability_domain, #compartment_id, #defined_tags, #freeform_tags, #shape
Methods inherited from Kitchen::Driver::Oci
#create, #destroy, #finalize_config!, validation_error
Methods included from Kitchen::Driver::Oci::Mixin::Volumes
#create_and_attach_volumes, #create_volume, #detatch_and_delete_volumes, #process_volumes
Methods included from Kitchen::Driver::Oci::Mixin::Models
#instance_class, #volume_class
Methods included from Kitchen::Driver::Oci::Mixin::Actions
#are_legacy_imds_endpoints_disbled?, #auth, #execute_post_create_file, #execute_post_create_script, #execute_post_create_string, #instance_options, #instance_options?
Constructor Details
#initialize(opts = {}) ⇒ Compute
Returns a new instance of Compute.
31 32 33 34 |
# File 'lib/kitchen/driver/oci/models/compute.rb', line 31 def initialize(opts = {}) super @launch_details = OCI::Core::Models::LaunchInstanceDetails.new end |
Instance Attribute Details
#launch_details ⇒ OCI::Core::Models::LaunchInstanceDetails
The details model that describes a compute instance.
39 40 41 |
# File 'lib/kitchen/driver/oci/models/compute.rb', line 39 def launch_details @launch_details end |
Instance Method Details
#launch ⇒ Hash
Launches a compute instance.
44 45 46 47 48 49 50 |
# File 'lib/kitchen/driver/oci/models/compute.rb', line 44 def launch response = api.compute.launch_instance(launch_instance_details) instance_id = response.data.id api.compute.get_instance(instance_id).wait_until(:lifecycle_state, OCI::Core::Models::Instance::LIFECYCLE_STATE_RUNNING) final_state(state, instance_id) end |
#reboot ⇒ Object
Reboots a compute instance.
59 60 61 62 |
# File 'lib/kitchen/driver/oci/models/compute.rb', line 59 def reboot api.compute.instance_action(state[:server_id], "SOFTRESET") api.compute.get_instance(state[:server_id]).wait_until(:lifecycle_state, OCI::Core::Models::Instance::LIFECYCLE_STATE_RUNNING) end |
#terminate ⇒ Object
Terminates a compute instance.
53 54 55 56 |
# File 'lib/kitchen/driver/oci/models/compute.rb', line 53 def terminate api.compute.terminate_instance(state[:server_id]) api.compute.get_instance(state[:server_id]).wait_until(:lifecycle_state, OCI::Core::Models::Instance::LIFECYCLE_STATE_TERMINATING) end |