# 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
update_db_system_response =
  mysql_client.update_db_system(
    'ocid1.test.oc1..<unique_ID>EXAMPLE-dbSystemId-Value',
    OCI::Mysql::Models::UpdateDbSystemDetails.new(
      display_name: 'EXAMPLE-displayName-Value',
      description: 'EXAMPLE-description-Value',
      subnet_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value',
      nsg_ids: %w[EXAMPLE--Value],
      database_mode: 'READ_ONLY',
      access_mode: 'UNRESTRICTED',
      rest:
        OCI::Mysql::Models::UpdateRestDetails.new(
          configuration: 'DISABLED', port: 45_689
        ),
      is_highly_available: false,
      availability_domain: 'EXAMPLE-availabilityDomain-Value',
      fault_domain: 'EXAMPLE-faultDomain-Value',
      shape_name: 'EXAMPLE-shapeName-Value',
      mysql_version: 'EXAMPLE-mysqlVersion-Value',
      configuration_id:
        'ocid1.test.oc1..<unique_ID>EXAMPLE-configurationId-Value',
      admin_username: 'EXAMPLE-adminUsername-Value',
      admin_password: 'EXAMPLE-adminPassword-Value',
      data_storage_size_in_gbs: 45_275,
      data_storage:
        OCI::Mysql::Models::DataStorageDetails.new(
          is_auto_expand_storage_enabled: true, max_storage_size_in_gbs: 69_573
        ),
      hostname_label: 'EXAMPLE-hostnameLabel-Value',
      ip_address: 'EXAMPLE-ipAddress-Value',
      port: 32_386,
      port_x: 13_143,
      backup_policy:
        OCI::Mysql::Models::UpdateBackupPolicyDetails.new(
          is_enabled: false,
          copy_policies: [
            OCI::Mysql::Models::CopyPolicy.new(
              copy_to_region: 'EXAMPLE-copyToRegion-Value',
              backup_copy_retention_in_days: 9
            )
          ],
          window_start_time: 'EXAMPLE-windowStartTime-Value',
          retention_in_days: 8,
          freeform_tags: {
            'EXAMPLE_KEY_Ip7l1' => 'EXAMPLE_VALUE_AEeUnMNRI6jHborTQUi3'
          },
          defined_tags: {
            'EXAMPLE_KEY_JRYgn' => { 'EXAMPLE_KEY_hqtCA' => 'EXAMPLE--Value' }
          },
          pitr_policy: OCI::Mysql::Models::PitrPolicy.new(is_enabled: false)
        ),
      maintenance:
        OCI::Mysql::Models::UpdateMaintenanceDetails.new(
          window_start_time: 'EXAMPLE-windowStartTime-Value'
        ),
      freeform_tags: {
        'EXAMPLE_KEY_AzTGH' => 'EXAMPLE_VALUE_bGLVgyTQBj3h2ycld8z0'
      },
      defined_tags: {
        'EXAMPLE_KEY_BlGFL' => { 'EXAMPLE_KEY_AIp8B' => 'EXAMPLE--Value' }
      },
      deletion_policy:
        OCI::Mysql::Models::UpdateDeletionPolicyDetails.new(
          automatic_backup_retention: 'DELETE',
          final_backup: 'SKIP_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'
        ),
      customer_contacts: [
        OCI::Mysql::Models::CustomerContact.new(email: 'EXAMPLE-email-Value')
      ],
      read_endpoint:
        OCI::Mysql::Models::UpdateReadEndpointDetails.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 "#{update_db_system_response.headers}"

Was this article helpful?