// 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).

package main

import (
	"context"
	"fmt"
	"time"

	"github.com/oracle/oci-go-sdk/v65/common"
	"github.com/oracle/oci-go-sdk/v65/example/helpers"
	"github.com/oracle/oci-go-sdk/v65/opsi"
)

func ExampleIngestMySqlSqlStats() {
	// 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.
	client, err := opsi.NewOperationsInsightsClientWithConfigurationProvider(common.DefaultConfigProvider())
	helpers.FatalIfError(err)

	// Create a request and dependent object(s).

	req := opsi.IngestMySqlSqlStatsRequest{OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value"),
		DatabaseId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-databaseId-Value"),
		Id:         common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value"),
		IfMatch:    common.String("EXAMPLE-ifMatch-Value"),
		IngestMySqlSqlStatsDetails: opsi.IngestMySqlSqlStatsDetails{Items: []opsi.MySqlSqlStats{opsi.MySqlSqlStats{Digest: common.String("EXAMPLE-digest-Value"),
			MaxTotalMemoryInBytes:      common.Int64(676),
			SelectFullJoin:             common.Int64(219),
			TotalRows:                  common.Int64(906),
			CommandType:                common.String("EXAMPLE-commandType-Value"),
			NoGoodIndexUsedCount:       common.Int64(670),
			RowsAffected:               common.Int64(663),
			RowsExamined:               common.Int64(924),
			SchemaName:                 common.String("EXAMPLE-schemaName-Value"),
			TimeFirstSeen:              &common.SDKTime{Time: time.Now()},
			TotalLatencyInPs:           common.Int64(555),
			NoIndexUsedCount:           common.Int64(740),
			RowsSorted:                 common.Int64(225),
			WarnCount:                  common.Int64(14),
			CpuLatencyInPs:             common.Int64(243),
			TimeLastSeen:               &common.SDKTime{Time: time.Now()},
			PerfSchemaUsedPercent:      common.Int64(709),
			SelectRange:                common.Int64(358),
			SelectRangeCheck:           common.Int64(363),
			SortRange:                  common.Int64(105),
			ExecCount:                  common.Int64(696),
			LockLatencyInPs:            common.Int64(966),
			MaxControlledMemoryInBytes: common.Int64(742),
			SortMergePasses:            common.Int64(980),
			TmpDiskTables:              common.Int64(818),
			TmpTables:                  common.Int64(0),
			ErrCount:                   common.Int64(311),
			ExecCountSecondary:         common.Int64(708),
			SelectScan:                 common.Int64(565),
			RowsSent:                   common.Int64(25),
			SelectFullRangeJoin:        common.Int64(211),
			SortScan:                   common.Int64(972),
			TimeCollected:              &common.SDKTime{Time: time.Now()}}}},
		OpcRequestId: common.String("OQNC3ZOGFPKSKEBDQONH<unique_ID>")}

	// Send the request using the service client
	resp, err := client.IngestMySqlSqlStats(context.Background(), req)
	helpers.FatalIfError(err)

	// Retrieve value from the response.
	fmt.Println(resp)
}