// 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{IfMatch: common.String("EXAMPLE-ifMatch-Value"),
		IngestMySqlSqlStatsDetails: opsi.IngestMySqlSqlStatsDetails{Items: []opsi.MySqlSqlStats{opsi.MySqlSqlStats{CpuLatencyInPs: common.Int64(708),
			NoIndexUsedCount:           common.Int64(540),
			RowsSent:                   common.Int64(568),
			SelectFullRangeJoin:        common.Int64(704),
			SelectRange:                common.Int64(423),
			TmpDiskTables:              common.Int64(358),
			RowsAffected:               common.Int64(444),
			WarnCount:                  common.Int64(846),
			Digest:                     common.String("EXAMPLE-digest-Value"),
			NoGoodIndexUsedCount:       common.Int64(172),
			RowsSorted:                 common.Int64(78),
			SelectFullJoin:             common.Int64(117),
			SelectRangeCheck:           common.Int64(21),
			SortMergePasses:            common.Int64(81),
			SortScan:                   common.Int64(477),
			TmpTables:                  common.Int64(849),
			RowsExamined:               common.Int64(435),
			SortRange:                  common.Int64(383),
			CommandType:                common.String("EXAMPLE-commandType-Value"),
			ExecCount:                  common.Int64(88),
			MaxControlledMemoryInBytes: common.Int64(581),
			PerfSchemaUsedPercent:      common.Int64(664),
			SchemaName:                 common.String("EXAMPLE-schemaName-Value"),
			TotalLatencyInPs:           common.Int64(797),
			TotalRows:                  common.Int64(807),
			ExecCountSecondary:         common.Int64(710),
			MaxTotalMemoryInBytes:      common.Int64(473),
			SelectScan:                 common.Int64(293),
			ErrCount:                   common.Int64(498),
			LockLatencyInPs:            common.Int64(284),
			TimeFirstSeen:              &common.SDKTime{Time: time.Now()},
			TimeCollected:              &common.SDKTime{Time: time.Now()},
			TimeLastSeen:               &common.SDKTime{Time: time.Now()}}}},
		OpcRequestId:  common.String("IVGSDQPZ6ZOUNWX7MC96<unique_ID>"),
		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")}

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