Module: Kitchen::Driver::Oci::Instance::DbaasLaunchDetails

Includes:
DatabaseDetails, DbHomeDetails
Defined in:
lib/kitchen/driver/oci/instance/dbaas.rb

Overview

setter methods that populate the details of OCI::Database::Models::LaunchDbSystemDetails

Instance Method Summary collapse

Methods included from DbHomeDetails

#database, #db_home_defined_tags, #db_home_display_name, #db_home_software_image, #db_version

Methods included from DatabaseDetails

#admin_password, #character_set, #database_software_image, #db_backup_config, #db_defined_tags, #db_name, #db_workload, #ncharacter_set, #pdb_name

Instance Method Details

#cluster_nameObject



86
87
88
89
90
91
92
93
94
95
# File 'lib/kitchen/driver/oci/instance/dbaas.rb', line 86

def cluster_name
  prefix = config[:hostname_prefix].split("-")[0]
  # 11 character limit for cluster_name in DBaaS
  cn = if prefix.length >= 11
         prefix[0, 11]
       else
         [prefix, random_string(10 - prefix.length)].compact.join("-")
       end
  launch_details.cluster_name = cn
end

#cpu_core_countObject



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

def cpu_core_count
  launch_details.cpu_core_count = config[:dbaas][:cpu_core_count] ||= 2
end

#database_editionObject



81
82
83
84
# File 'lib/kitchen/driver/oci/instance/dbaas.rb', line 81

def database_edition
  db_edition = config[:dbaas][:database_edition] ||= OCI::Database::Models::DbSystem::DATABASE_EDITION_ENTERPRISE_EDITION
  launch_details.database_edition = db_edition
end

#db_homeObject

TODO: add support for the #domain property



33
34
35
# File 'lib/kitchen/driver/oci/instance/dbaas.rb', line 33

def db_home
  launch_details.db_home = db_home_details
end

#display_nameObject



53
54
55
56
# File 'lib/kitchen/driver/oci/instance/dbaas.rb', line 53

def display_name
  # The user-friendly name for the DB system. The name does not have to be unique.
  launch_details.display_name = [config[:hostname_prefix], random_string(4), random_number(2)].compact.join("-")
end

#hostnameObject



45
46
47
48
49
50
51
# File 'lib/kitchen/driver/oci/instance/dbaas.rb', line 45

def hostname
  # The hostname must begin with an alphabetic character, and can contain alphanumeric characters and hyphens (-).
  # The maximum length of the hostname is 16 characters
  long_name = [hostname_prefix, long_hostname_suffix].compact.join("-")
  trimmed_name = [hostname_prefix[0, 12], random_string(3)].compact.join("-")
  launch_details.hostname = [long_name, trimmed_name].min { |l, t| l.size <=> t.size }
end

#initial_data_storage_size_in_gbObject



77
78
79
# File 'lib/kitchen/driver/oci/instance/dbaas.rb', line 77

def initial_data_storage_size_in_gb
  launch_details.initial_data_storage_size_in_gb = config[:dbaas][:initial_data_storage_size_in_gb] ||= 256
end

#license_modelObject



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

def license_model
  license = config[:dbaas][:license_model] ||= OCI::Database::Models::DbSystem::LICENSE_MODEL_BRING_YOUR_OWN_LICENSE
  launch_details.license_model = license
end

#node_countObject



58
59
60
# File 'lib/kitchen/driver/oci/instance/dbaas.rb', line 58

def node_count
  launch_details.node_count = 1
end

#nsg_idsObject



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

def nsg_ids
  launch_details.nsg_ids = config[:nsg_ids]
end

#pubkeyObject



62
63
64
65
66
# File 'lib/kitchen/driver/oci/instance/dbaas.rb', line 62

def pubkey
  result = []
  result << File.readlines(config[:ssh_keypath]).first.chomp
  launch_details.ssh_public_keys = result
end

#subnet_idObject



37
38
39
# File 'lib/kitchen/driver/oci/instance/dbaas.rb', line 37

def subnet_id
  launch_details.subnet_id = config[:subnet_id]
end