# 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_runtime_client =
  OCI::DatabaseToolsRuntime::DatabaseToolsRuntimeClient.new(config: config)

# Send the request to service, some parameters are not required, see API doc for more info
execute_sql_database_tools_connection_response =
  database_tools_runtime_client.execute_sql_database_tools_connection(
    'ocid1.test.oc1..<unique_ID>EXAMPLE-databaseToolsConnectionId-Value',
    OCI::DatabaseToolsRuntime::Models::ExecuteSqlDatabaseToolsConnectionSynchronousDetails
      .new(
      type: 'SYNCHRONOUS',
      input:
        OCI::DatabaseToolsRuntime::Models::ExecuteSqlInputScriptDetails.new(
          type: 'SCRIPT',
          scripts: [
            OCI::DatabaseToolsRuntime::Models::ExecuteSqlInputScriptSqlRequestDetails
              .new(properties: 'EXAMPLE-properties-Value')
          ],
          version: 'EXAMPLE-version-Value',
          properties: []
        ),
      output:
        OCI::DatabaseToolsRuntime::Models::ExecuteSqlOutputObjectStorageDetails
          .new(
          type: 'OBJECT_STORAGE',
          object:
            OCI::DatabaseToolsRuntime::Models::ExecuteSqlObjectStorageLocation
              .new(
              namespace: 'EXAMPLE-namespace-Value',
              bucket_name: 'EXAMPLE-bucketName-Value',
              object_name: 'EXAMPLE-objectName-Value'
            ),
          result_disposition_templates: [
            OCI::DatabaseToolsRuntime::Models::ExecuteSqlOutputResultDispositionTemplate
              .new(
              statement_type: 'OTHER',
              object_template:
                OCI::DatabaseToolsRuntime::Models::ExecuteSqlOutputDispositionObjectStorageDetails
                  .new(
                  type: 'OBJECT_STORAGE',
                  namespace: 'EXAMPLE-namespace-Value',
                  bucket_name: 'EXAMPLE-bucketName-Value',
                  object_name: 'EXAMPLE-objectName-Value',
                  content_type: 'EXAMPLE-contentType-Value',
                  content_disposition: 'EXAMPLE-contentDisposition-Value',
                  content_encoding: 'EXAMPLE-contentEncoding-Value',
                  cache_control: 'EXAMPLE-cacheControl-Value',
                  content_language: 'EXAMPLE-contentLanguage-Value',
                  opc_meta: {
                    'EXAMPLE_KEY_AHq1A' => 'EXAMPLE_VALUE_pc5NYfl2LCCy3blE2vbl'
                  },
                  opc_sse_customer_algorithm:
                    'EXAMPLE-opcSseCustomerAlgorithm-Value',
                  opc_sse_customer_key: 'EXAMPLE-opcSseCustomerKey-Value',
                  opc_sse_customer_key_sha256:
                    'EXAMPLE-opcSseCustomerKeySha256-Value',
                  opc_sse_kms_key_id:
                    'ocid1.test.oc1..<unique_ID>EXAMPLE-opcSseKmsKeyId-Value',
                  storage_tier: 'INFREQUENT_ACCESS'
                )
            )
          ],
          time_of_deletion: DateTime.parse('2046-02-04T07:26:15.095Z')
        )
    )
  )

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