// 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.OpsiService;
using Oci.Common;
using Oci.Common.Auth;

namespace Oci.Sdk.DotNet.Example.Opsi
{
    public class IngestSqlStatsExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var ingestSqlStatsDetails = new Oci.OpsiService.Models.IngestSqlStatsDetails
			{
				Items = new List<Oci.OpsiService.Models.SqlStats>
				{
					new Oci.OpsiService.Models.SqlStats
					{
						SqlIdentifier = "EXAMPLE-sqlIdentifier-Value",
						PlanHashValue = 608,
						TimeCollected = DateTime.Parse("02/25/2035 01:24:11"),
						InstanceName = "EXAMPLE-instanceName-Value",
						LastActiveTime = "EXAMPLE-lastActiveTime-Value",
						ParseCalls = 214,
						DiskReads = 206,
						DirectReads = 342,
						DirectWrites = 130,
						BufferGets = 813,
						RowsProcessed = 886,
						SerializableAborts = 278,
						Fetches = 959,
						Executions = 871,
						AvoidedExecutions = 628,
						EndOfFetchCount = 671,
						Loads = 606,
						VersionCount = 575,
						Invalidations = 232,
						ObsoleteCount = 637,
						PxServersExecutions = 16,
						CpuTimeInUs = 237,
						ElapsedTimeInUs = 376,
						AvgHardParseTimeInUs = 853,
						ConcurrencyWaitTimeInUs = 20,
						ApplicationWaitTimeInUs = 816,
						ClusterWaitTimeInUs = 386,
						UserIoWaitTimeInUs = 928,
						PlsqlExecTimeInUs = 289,
						JavaExecTimeInUs = 310,
						Sorts = 572,
						SharableMem = 615,
						TotalSharableMem = 230,
						TypeCheckMem = 839,
						IoCellOffloadEligibleBytes = 668,
						IoInterconnectBytes = 251,
						PhysicalReadRequests = 356,
						PhysicalReadBytes = 544,
						PhysicalWriteRequests = 835,
						PhysicalWriteBytes = 531,
						ExactMatchingSignature = "EXAMPLE-exactMatchingSignature-Value",
						ForceMatchingSignature = "EXAMPLE-forceMatchingSignature-Value",
						IoCellUncompressedBytes = 628,
						IoCellOffloadReturnedBytes = 730,
						ChildNumber = 972,
						CommandType = 891,
						UsersOpening = 29,
						UsersExecuting = 48,
						OptimizerCost = 549,
						FullPlanHashValue = "EXAMPLE-fullPlanHashValue-Value",
						Module = "EXAMPLE-module-Value",
						Service = "EXAMPLE-service-Value",
						Action = "EXAMPLE-action-Value",
						SqlProfile = "EXAMPLE-sqlProfile-Value",
						SqlPatch = "EXAMPLE-sqlPatch-Value",
						SqlPlanBaseline = "EXAMPLE-sqlPlanBaseline-Value",
						DeltaExecutionCount = 562,
						DeltaCpuTime = 147,
						DeltaIoBytes = 886,
						DeltaCpuRank = 4,
						DeltaExecsRank = 589,
						SharableMemRank = 881,
						DeltaIoRank = 561,
						HarmonicSum = 816,
						WtHarmonicSum = 949,
						TotalSqlCount = 438
					}
				}
			};
			var ingestSqlStatsRequest = new Oci.OpsiService.Requests.IngestSqlStatsRequest
			{
				IngestSqlStatsDetails = ingestSqlStatsDetails,
				DatabaseId = "ocid1.test.oc1..<unique_ID>EXAMPLE-databaseId-Value",
				Id = "ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value",
				OpcRequestId = "PZFO0WHCABFHFC16WMD1<unique_ID>",
				IfMatch = "EXAMPLE-ifMatch-Value",
				OpcRetryToken = "EXAMPLE-opcRetryToken-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 OperationsInsightsClient(provider, new ClientConfiguration()))
				{
					var response = await client.IngestSqlStats(ingestSqlStatsRequest);
					// Retrieve value from the response.
					var messageValue = response.IngestSqlStatsResponseDetails.Message;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"IngestSqlStats Failed with {e.Message}");
                throw e;
            }
        }

    }
}