# 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 'date'
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
create_database_tools_connection_response =
  database_tools_client.create_database_tools_connection(
    OCI::DatabaseTools::Models::CreateDatabaseToolsConnectionGenericJdbcDetails
      .new(
      type: 'GENERIC_JDBC',
      display_name: 'EXAMPLE-displayName-Value',
      compartment_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value',
      url: 'EXAMPLE-url-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'
        ),
      defined_tags: {
        'EXAMPLE_KEY_lgNJZ' => { 'EXAMPLE_KEY_vdHku' => 'EXAMPLE--Value' }
      },
      freeform_tags: {
        'EXAMPLE_KEY_YBZl8' => 'EXAMPLE_VALUE_Ca60xbt3NkQBcsP24foM'
      },
      locks: [
        OCI::DatabaseTools::Models::ResourceLock.new(
          type: 'DELETE',
          related_resource_id:
            'ocid1.test.oc1..<unique_ID>EXAMPLE-relatedResourceId-Value',
          message: 'EXAMPLE-message-Value',
          time_created: DateTime.parse('2048-09-18T08:05:23.674Z')
        )
      ],
      runtime_support: 'SUPPORTED',
      runtime_identity: 'RESOURCE_PRINCIPAL',
      advanced_properties: {
        'EXAMPLE_KEY_f5qjM' => 'EXAMPLE_VALUE_ymWbgCw8gTUZCx9qghyu'
      },
      key_stores: [
        OCI::DatabaseTools::Models::DatabaseToolsKeyStoreGenericJdbcDetails.new(
          key_store_type: 'CA_CERTIFICATE_PEM',
          key_store_content:
            OCI::DatabaseTools::Models::DatabaseToolsKeyStoreContentSecretIdGenericJdbcDetails
              .new(
              value_type: 'SECRETID',
              secret_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value'
            ),
          key_store_password:
            OCI::DatabaseTools::Models::DatabaseToolsKeyStorePasswordSecretIdGenericJdbcDetails
              .new(
              value_type: 'SECRETID',
              secret_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value'
            )
        )
      ]
    )
  )

# Get the data from response
puts "#{create_database_tools_connection_response.data}"