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.

Author:

  • Justin Steele <justin.steele@oracle.com>

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

Adds the cluster_name property to the launch_details. 11 character limit for cluster_name in DBaaS.



102
103
104
105
106
107
108
109
110
111
# File 'lib/kitchen/driver/oci/instance/dbaas.rb', line 102

def cluster_name
  prefix = config[:hostname_prefix].split("-")[0]

  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

Adds the cpu_core_count property to the launch_details.



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

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

#database_editionObject

Adds the database_edition property to the launch_details.



95
96
97
98
# File 'lib/kitchen/driver/oci/instance/dbaas.rb', line 95

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

Adds the db_home property to the launch_details.



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

def db_home
  launch_details.db_home = db_home_details
end

#display_nameObject

Adds the display_name property to the launch details. The user-friendly name for the DB system. The name does not have to be unique.



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

def display_name
  launch_details.display_name = [config[:hostname_prefix], random_string(4), random_number(2)].compact.join("-")
end

#hostnameObject

Adds the hostname property to the launch_details. The hostname must begin with an alphabetic character, and can contain alphanumeric characters and hyphens (-). The maximum length of the hostname is 16 characters.



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

def hostname
  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

Adds the initial_data_size_in_gb property to the launch_details.



90
91
92
# File 'lib/kitchen/driver/oci/instance/dbaas.rb', line 90

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

Adds the license_model property to the launch_details.



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

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

Adds the node_count property to the launch_details.



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

def node_count
  launch_details.node_count = 1
end

#nsg_idsObject

Adds the nsg_ids property to the launch_details.



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

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

#ssh_public_keysObject

Adds the ssh_public_keys property to the launch_details.



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

def ssh_public_keys
  result = []
  result << read_public_key
  launch_details.ssh_public_keys = result
end

#subnet_idObject

Adds the subnet_id property to the launch_details.



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

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