# 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',
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',
admin_username: 'EXAMPLE-adminUsername-Value',
admin_password: 'EXAMPLE-adminPassword-Value',
data_storage_size_in_gbs: 123_235,
hostname_label: 'EXAMPLE-hostnameLabel-Value',
ip_address: 'EXAMPLE-ipAddress-Value',
port: 56_860,
port_x: 27_956,
backup_policy:
OCI::Mysql::Models::CreateBackupPolicyDetails.new(
is_enabled: false,
window_start_time: 'EXAMPLE-windowStartTime-Value',
retention_in_days: 22,
freeform_tags: {
'EXAMPLE_KEY_H6QHk' => 'EXAMPLE_VALUE_Ib9lfLu9M4Ye1k1VFowe'
},
defined_tags: {
'EXAMPLE_KEY_xOCp2' => { 'EXAMPLE_KEY_W9fN8' => '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_Mt8Cz' => 'EXAMPLE_VALUE_MhcyptM1WuuRBUW4BlTM'
},
defined_tags: {
'EXAMPLE_KEY_dy3pi' => { 'EXAMPLE_KEY_4PTkm' => 'EXAMPLE--Value' }
},
deletion_policy:
OCI::Mysql::Models::CreateDeletionPolicyDetails.new(
automatic_backup_retention: 'RETAIN',
final_backup: 'REQUIRE_FINAL_BACKUP',
is_delete_protected: true
),
crash_recovery: 'ENABLED',
database_management: 'ENABLED'
)
)
# Get the data from response
puts "#{create_db_system_response.data}"