Class: Kitchen::Driver::Oci::Models::Dbaas

Inherits:
Instance show all
Defined in:
lib/kitchen/driver/oci/models/dbaas.rb

Overview

dbaas model

Instance Attribute Summary collapse

Attributes inherited from Instance

#api, #config, #oci, #state

Instance Method Summary collapse

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) ⇒ Dbaas

Returns a new instance of Dbaas.



27
28
29
30
31
32
# File 'lib/kitchen/driver/oci/models/dbaas.rb', line 27

def initialize(config, state, oci, api, action = :create)
  super
  @launch_details = OCI::Database::Models::LaunchDbSystemDetails.new
  @database_details = OCI::Database::Models::CreateDatabaseDetails.new
  @db_home_details = OCI::Database::Models::CreateDbHomeDetails.new
end

Instance Attribute Details

#database_detailsObject

rubocop:disable Metrics/ClassLength



25
26
27
# File 'lib/kitchen/driver/oci/models/dbaas.rb', line 25

def database_details
  @database_details
end

#db_home_detailsObject

rubocop:disable Metrics/ClassLength



25
26
27
# File 'lib/kitchen/driver/oci/models/dbaas.rb', line 25

def db_home_details
  @db_home_details
end

#launch_detailsObject

rubocop:disable Metrics/ClassLength



25
26
27
# File 'lib/kitchen/driver/oci/models/dbaas.rb', line 25

def launch_details
  @launch_details
end

Instance Method Details

#launchObject



34
35
36
37
38
39
40
41
# File 'lib/kitchen/driver/oci/models/dbaas.rb', line 34

def launch
  response = api.dbaas.launch_db_system(launch_instance_details)
  instance_id = response.data.id

  api.dbaas.get_db_system(instance_id).wait_until(:lifecycle_state, OCI::Database::Models::DbSystem::LIFECYCLE_STATE_AVAILABLE,
                                                  max_interval_seconds: 900, max_wait_seconds: 21_600)
  final_state(state, instance_id)
end

#terminateObject



43
44
45
46
47
# File 'lib/kitchen/driver/oci/models/dbaas.rb', line 43

def terminate
  api.dbaas.terminate_db_system(state[:server_id])
  api.dbaas.get_db_system(state[:server_id]).wait_until(:lifecycle_state, OCI::Database::Models::DbSystem::LIFECYCLE_STATE_TERMINATING,
                                                        max_interval_seconds: 900, max_wait_seconds: 21_600)
end