// 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.ExecuteSqlDatabaseToolsConnectionSynchronousDetails
			{
				Input = new Oci.DatabasetoolsruntimeService.Models.ExecuteSqlInputStandardDetails
				{
					StatementText = "EXAMPLE-statementText-Value",
					Limit = 0,
					Offset = 779,
					Binds = new List<Oci.DatabasetoolsruntimeService.Models.ExecuteSqlBind>
					{
						new Oci.DatabasetoolsruntimeService.Models.ExecuteSqlBind
						{
							DataType = "EXAMPLE-dataType-Value",
							Name = "EXAMPLE-name-Value",
							Index = 358,
							Mode = Oci.DatabasetoolsruntimeService.Models.ExecuteSqlBind.ModeEnum.Inout,
							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 = false,
						Binds = true,
						Result = false,
						Response = false
					},
					Properties = "EXAMPLE-properties-Value"
				},
				Output = new Oci.DatabasetoolsruntimeService.Models.ExecuteSqlOutputObjectStorageDetails
				{
					TimeOfDeletion = DateTime.Parse("05/10/2034 13:32:01"),
					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.Dml,
							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.InfrequentAccess
							}
						}
					}
				}
			};
			var executeSqlDatabaseToolsConnectionRequest = new Oci.DatabasetoolsruntimeService.Requests.ExecuteSqlDatabaseToolsConnectionRequest
			{
				DatabaseToolsConnectionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-databaseToolsConnectionId-Value",
				ExecuteSqlDatabaseToolsConnectionDetails = executeSqlDatabaseToolsConnectionDetails,
				OpcRequestId = "YFVA8ECWQE7MK9CJRK7S<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;
            }
        }

    }
}