Class: Kitchen::Driver::Oci::Models::Compute
- Inherits:
-
Instance
- Object
- Base
- Kitchen::Driver::Oci
- Instance
- Kitchen::Driver::Oci::Models::Compute
- Defined in:
- lib/kitchen/driver/oci/models/compute.rb
Overview
Compute instance model
Instance Attribute Summary collapse
-
#launch_details ⇒ Object
rubocop:disable Metrics/ClassLength.
Attributes inherited from Instance
Instance Method Summary collapse
-
#initialize(config, state, oci, api, action = :create) ⇒ Compute
constructor
A new instance of Compute.
- #launch ⇒ Object
- #terminate ⇒ Object
Methods inherited from Instance
#availability_domain, #compartment_id, #defined_tags, #final_state, #freeform_tags, #shape
Methods inherited from Kitchen::Driver::Oci
#create, #destroy, validation_error
Methods included from Kitchen::Driver::Oci::Models
#instance_class, #volume_class
Constructor Details
#initialize(config, state, oci, api, action = :create) ⇒ Compute
Returns a new instance of Compute.
27 28 29 30 |
# File 'lib/kitchen/driver/oci/models/compute.rb', line 27 def initialize(config, state, oci, api, action = :create) super @launch_details = OCI::Core::Models::LaunchInstanceDetails.new end |
Instance Attribute Details
#launch_details ⇒ Object
rubocop:disable Metrics/ClassLength
25 26 27 |
# File 'lib/kitchen/driver/oci/models/compute.rb', line 25 def launch_details @launch_details end |
Instance Method Details
#launch ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/kitchen/driver/oci/models/compute.rb', line 32 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 |
#terminate ⇒ Object
40 41 42 43 |
# File 'lib/kitchen/driver/oci/models/compute.rb', line 40 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 |