# This is an automatically generated code sample.
# To make this code sample work in your Oracle Cloud tenancy,
# please replace the values for any parameters whose current values do not fit
# your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
# boolean, number, and enum parameters with values not fitting your use case).
require 'oci'
# Create a default config using DEFAULT profile in default location
# Refer to https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File for more info
config = OCI::ConfigFileLoader.load_config
# Initialize service client with default config file
mysql_client = OCI::Mysql::DbSystemClient.new(config: config)
# Send the request to service, some parameters are not required, see API doc for more info
create_db_system_response =
mysql_client.create_db_system(
OCI::Mysql::Models::CreateDbSystemDetails.new(
compartment_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value',
shape_name: 'EXAMPLE-shapeName-Value',
subnet_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value',
display_name: 'EXAMPLE-displayName-Value',
description: 'EXAMPLE-description-Value',
rest:
OCI::Mysql::Models::CreateRestDetails.new(
configuration: 'DISABLED', port: 52_662
),
is_highly_available: false,
availability_domain: 'EXAMPLE-availabilityDomain-Value',
fault_domain: 'EXAMPLE-faultDomain-Value',
configuration_id:
'ocid1.test.oc1..<unique_ID>EXAMPLE-configurationId-Value',
mysql_version: 'EXAMPLE-mysqlVersion-Value',
nsg_ids: %w[EXAMPLE--Value],
admin_username: 'EXAMPLE-adminUsername-Value',
admin_password: 'EXAMPLE-adminPassword-Value',
data_storage_size_in_gbs: 97_341,
data_storage:
OCI::Mysql::Models::DataStorageDetails.new(
is_auto_expand_storage_enabled: false, max_storage_size_in_gbs: 31_642
),
hostname_label: 'EXAMPLE-hostnameLabel-Value',
ip_address: 'EXAMPLE-ipAddress-Value',
port: 47_134,
port_x: 58_108,
backup_policy:
OCI::Mysql::Models::CreateBackupPolicyDetails.new(
is_enabled: false,
copy_policies: [
OCI::Mysql::Models::CopyPolicy.new(
copy_to_region: 'EXAMPLE-copyToRegion-Value',
backup_copy_retention_in_days: 17
)
],
window_start_time: 'EXAMPLE-windowStartTime-Value',
retention_in_days: 31,
freeform_tags: {
'EXAMPLE_KEY_suvdh' => 'EXAMPLE_VALUE_LNE8TJP804q5jYsr6YIj'
},
defined_tags: {
'EXAMPLE_KEY_fMbjP' => { 'EXAMPLE_KEY_ShJUt' => 'EXAMPLE--Value' }
},
pitr_policy: OCI::Mysql::Models::PitrPolicy.new(is_enabled: true)
),
source:
OCI::Mysql::Models::CreateDbSystemSourceImportFromUrlDetails.new(
source_type: 'IMPORTURL', source_url: 'EXAMPLE-sourceUrl-Value'
),
maintenance:
OCI::Mysql::Models::CreateMaintenanceDetails.new(
window_start_time: 'EXAMPLE-windowStartTime-Value'
),
freeform_tags: {
'EXAMPLE_KEY_SilfX' => 'EXAMPLE_VALUE_KL6uhVptXBmbhm3TTcqK'
},
defined_tags: {
'EXAMPLE_KEY_7DDO5' => { 'EXAMPLE_KEY_5CwPR' => 'EXAMPLE--Value' }
},
deletion_policy:
OCI::Mysql::Models::CreateDeletionPolicyDetails.new(
automatic_backup_retention: 'DELETE',
final_backup: 'REQUIRE_FINAL_BACKUP',
is_delete_protected: true
),
crash_recovery: 'DISABLED',
database_management: 'ENABLED',
secure_connections:
OCI::Mysql::Models::SecureConnectionDetails.new(
certificate_generation_type: 'SYSTEM',
certificate_id:
'ocid1.test.oc1..<unique_ID>EXAMPLE-certificateId-Value'
),
database_mode: 'READ_WRITE',
access_mode: 'UNRESTRICTED',
customer_contacts: [
OCI::Mysql::Models::CustomerContact.new(email: 'EXAMPLE-email-Value')
],
read_endpoint:
OCI::Mysql::Models::CreateReadEndpointDetails.new(
is_enabled: true,
read_endpoint_ip_address: 'EXAMPLE-readEndpointIpAddress-Value',
read_endpoint_hostname_label:
'EXAMPLE-readEndpointHostnameLabel-Value',
exclude_ips: %w[EXAMPLE--Value]
)
)
)
# Get the data from response
puts "#{create_db_system_response.data}"