// 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).
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Oci.DatabasetoolsruntimeService;
using Oci.Common;
using Oci.Common.Auth;
namespace Oci.Sdk.DotNet.Example.Databasetoolsruntime
{
public class ExecuteSqlDatabaseToolsConnectionExample
{
public static async Task Main()
{
// Create a request and dependent object(s).
var executeSqlDatabaseToolsConnectionDetails = new Oci.DatabasetoolsruntimeService.Models.ExecuteSqlDatabaseToolsConnectionAsynchronousDetails
{
TimeoutInSeconds = 20974,
Input = new Oci.DatabasetoolsruntimeService.Models.ExecuteSqlAsynchronousInputInlineDetails
{
Content = new Oci.DatabasetoolsruntimeService.Models.ExecuteSqlInputStandardDetails
{
StatementText = "EXAMPLE-statementText-Value",
Limit = 0,
Offset = 471,
Binds = new List<Oci.DatabasetoolsruntimeService.Models.ExecuteSqlBind>
{
new Oci.DatabasetoolsruntimeService.Models.ExecuteSqlBind
{
DataType = "EXAMPLE-dataType-Value",
Name = "EXAMPLE-name-Value",
Index = 94,
Mode = Oci.DatabasetoolsruntimeService.Models.ExecuteSqlBind.ModeEnum.In,
Values = new List<Object>
{
"EXAMPLE-values-Value"
},
Results = new List<Object>
{
"EXAMPLE-results-Value"
},
PlsqlTableTypeDetails = new Oci.DatabasetoolsruntimeService.Models.ExecuteSqlBindPlsqlTable
{
TypeName = "EXAMPLE-typeName-Value",
TypeSubname = "EXAMPLE-typeSubname-Value",
TypeComponents = new List<Oci.DatabasetoolsruntimeService.Models.ExecuteSqlBindTypeComponent>
{
new Oci.DatabasetoolsruntimeService.Models.ExecuteSqlBindTypeComponent
{
DataType = "EXAMPLE-dataType-Value"
}
}
}
}
},
ResponseFormat = new Oci.DatabasetoolsruntimeService.Models.ExecuteSqlResponseFormat
{
ResultSetMetaData = false,
StatementInformation = false,
StatementText = true,
Binds = true,
Result = false,
Response = false
},
Properties = "EXAMPLE-properties-Value"
}
},
Output = new Oci.DatabasetoolsruntimeService.Models.ExecuteSqlOutputObjectStorageDetails
{
TimeOfDeletion = DateTime.Parse("05/09/2041 04:09:06"),
Object = new Oci.DatabasetoolsruntimeService.Models.ExecuteSqlObjectStorageLocation
{
Namespace = "EXAMPLE-namespace-Value",
BucketName = "EXAMPLE-bucketName-Value",
ObjectName = "EXAMPLE-objectName-Value"
},
ResultDispositionTemplates = new List<Oci.DatabasetoolsruntimeService.Models.ExecuteSqlOutputResultDispositionTemplate>
{
new Oci.DatabasetoolsruntimeService.Models.ExecuteSqlOutputResultDispositionTemplate
{
StatementType = Oci.DatabasetoolsruntimeService.Models.StatementType.SystemControl,
ObjectTemplate = new Oci.DatabasetoolsruntimeService.Models.ExecuteSqlOutputDispositionObjectStorageDetails
{
Namespace = "EXAMPLE-namespace-Value",
BucketName = "EXAMPLE-bucketName-Value",
ObjectName = "EXAMPLE-objectName-Value",
ContentType = "EXAMPLE-contentType-Value",
ContentDisposition = "EXAMPLE-contentDisposition-Value",
ContentEncoding = "EXAMPLE-contentEncoding-Value",
CacheControl = "EXAMPLE-cacheControl-Value",
ContentLanguage = "EXAMPLE-contentLanguage-Value",
OpcSseCustomerAlgorithm = "EXAMPLE-opcSseCustomerAlgorithm-Value",
OpcSseCustomerKey = "EXAMPLE-opcSseCustomerKey-Value",
OpcSseCustomerKeySha256 = "EXAMPLE-opcSseCustomerKeySha256-Value",
OpcSseKmsKeyId = "ocid1.test.oc1..<unique_ID>EXAMPLE-opcSseKmsKeyId-Value",
StorageTier = Oci.DatabasetoolsruntimeService.Models.ExecuteSqlOutputDispositionObjectStorageDetails.StorageTierEnum.Archive
}
}
}
}
};
var executeSqlDatabaseToolsConnectionRequest = new Oci.DatabasetoolsruntimeService.Requests.ExecuteSqlDatabaseToolsConnectionRequest
{
DatabaseToolsConnectionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-databaseToolsConnectionId-Value",
ExecuteSqlDatabaseToolsConnectionDetails = executeSqlDatabaseToolsConnectionDetails,
OpcRequestId = "AMJ1KKNJ2ATZA5ECL2SI<unique_ID>",
IfMatch = "EXAMPLE-ifMatch-Value"
};
// Create a default authentication provider that uses the DEFAULT
// profile in the configuration file.
// Refer to <see href="https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File>the public documentation</see> on how to prepare a configuration file.
var provider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");
try
{
// Create a service client and send the request.
using (var client = new DatabaseToolsRuntimeClient(provider, new ClientConfiguration()))
{
var response = await client.ExecuteSqlDatabaseToolsConnection(executeSqlDatabaseToolsConnectionRequest);
// Retrieve value from the response.
var envValue = response.ExecuteSqlResponse.Env;
}
}
catch (Exception e)
{
Console.WriteLine($"ExecuteSqlDatabaseToolsConnection Failed with {e.Message}");
throw e;
}
}
}
}