# 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
database_tools_client =
  OCI::DatabaseTools::DatabaseToolsClient.new(config: config)

# Send the request to service, some parameters are not required, see API doc for more info
update_database_tools_connection_response =
  database_tools_client.update_database_tools_connection(
    'ocid1.test.oc1..<unique_ID>EXAMPLE-databaseToolsConnectionId-Value',
    OCI::DatabaseTools::Models::UpdateDatabaseToolsConnectionMySqlDetails.new(
      type: 'MYSQL',
      display_name: 'EXAMPLE-displayName-Value',
      defined_tags: {
        'EXAMPLE_KEY_Kwthl' => { 'EXAMPLE_KEY_8TsKC' => 'EXAMPLE--Value' }
      },
      freeform_tags: {
        'EXAMPLE_KEY_cGKUC' => 'EXAMPLE_VALUE_Ys3ybGh1tbjhGY3IoRdN'
      },
      related_resource:
        OCI::DatabaseTools::Models::UpdateDatabaseToolsRelatedResourceMySqlDetails
          .new(
          entity_type: 'MYSQLDBSYSTEM', identifier: 'EXAMPLE-identifier-Value'
        ),
      connection_string: 'EXAMPLE-connectionString-Value',
      user_name: 'EXAMPLE-userName-Value',
      user_password:
        OCI::DatabaseTools::Models::DatabaseToolsUserPasswordSecretIdDetails
          .new(
          value_type: 'SECRETID',
          secret_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value'
        ),
      advanced_properties: {
        'EXAMPLE_KEY_co0rg' => 'EXAMPLE_VALUE_G0Zs9YdEVBub53bBZlun'
      },
      key_stores: [
        OCI::DatabaseTools::Models::DatabaseToolsKeyStoreMySqlDetails.new(
          key_store_type: 'CLIENT_PRIVATE_KEY_PEM',
          key_store_content:
            OCI::DatabaseTools::Models::DatabaseToolsKeyStoreContentSecretIdMySqlDetails
              .new(
              value_type: 'SECRETID',
              secret_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value'
            ),
          key_store_password:
            OCI::DatabaseTools::Models::DatabaseToolsKeyStorePasswordSecretIdMySqlDetails
              .new(
              value_type: 'SECRETID',
              secret_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value'
            )
        )
      ],
      private_endpoint_id:
        'ocid1.test.oc1..<unique_ID>EXAMPLE-privateEndpointId-Value'
    )
  )

# Get the data from response
puts "#{update_database_tools_connection_response.headers}"