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_display_name, #db_version

Methods included from DatabaseDetails

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

Instance Method Details

#cluster_nameObject



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

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



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

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

#database_editionObject



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

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

add support for #database_software_image_id property


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

def db_home
  launch_details.db_home = db_home_details
end

#display_nameObject



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

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



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

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



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

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



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

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



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

def node_count
  launch_details.node_count = 1
end

#nsg_idsObject



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

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

#pubkeyObject



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

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

#subnet_idObject



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

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