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

Inherits:
Instance show all
Includes:
DbaasLaunchDetails
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

#final_state

Methods included from Instance::CommonLaunchDetails

#availability_domain, #compartment_id, #defined_tags, #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) ⇒ Dbaas

Returns a new instance of Dbaas.



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

def initialize(config, state, oci, api, action)
  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_detailsOCI::Database::Models::CreateDatabaseDetails

The details model that describes the database

Returns:

  • (OCI::Database::Models::CreateDatabaseDetails)


48
49
50
# File 'lib/kitchen/driver/oci/models/dbaas.rb', line 48

def database_details
  @database_details
end

#db_home_detailsOCI::Database::Models::CreateDbHomeDetails

The details model that describes the database home

Returns:

  • (OCI::Database::Models::CreateDbHomeDetails)


55
56
57
# File 'lib/kitchen/driver/oci/models/dbaas.rb', line 55

def db_home_details
  @db_home_details
end

#launch_detailsOCI::Database::Models::LaunchDbSystemDetails

The details model that describes the db system

Returns:

  • (OCI::Database::Models::LaunchDbSystemDetails)


41
42
43
# File 'lib/kitchen/driver/oci/models/dbaas.rb', line 41

def launch_details
  @launch_details
end

Instance Method Details

#launchObject



57
58
59
60
61
62
63
64
# File 'lib/kitchen/driver/oci/models/dbaas.rb', line 57

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

#rebootObject



72
73
74
75
76
# File 'lib/kitchen/driver/oci/models/dbaas.rb', line 72

def reboot
  db_node_id = dbaas_node(state[:server_id]).first.id
  api.dbaas.db_node_action(db_node_id, "SOFTRESET")
  api.dbaas.get_db_node(db_node_id).wait_until(:lifecycle_state, OCI::Database::Models::DbNode::LIFECYCLE_STATE_AVAILABLE)
end

#terminateObject



66
67
68
69
70
# File 'lib/kitchen/driver/oci/models/dbaas.rb', line 66

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