// 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 ExampleIngestSqlPlanLines() {
	// 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.IngestSqlPlanLinesRequest{CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-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"),
		IngestSqlPlanLinesDetails: opsi.IngestSqlPlanLinesDetails{Items: []opsi.SqlPlanLine{opsi.SqlPlanLine{ElapsedTimeInSec: common.Float32(5135.446),
			Projection:             common.String("EXAMPLE-projection-Value"),
			TempSpace:              common.Int64(205),
			AccessPredicates:       common.String("EXAMPLE-accessPredicates-Value"),
			Bytes:                  common.Int64(901),
			FilterPredicates:       common.String("EXAMPLE-filterPredicates-Value"),
			ObjectInstance:         common.Int64(481),
			ObjectName:             common.String("EXAMPLE-objectName-Value"),
			Operation:              common.String("EXAMPLE-operation-Value"),
			PlanHash:               common.Int64(861),
			TimeCollected:          &common.SDKTime{Time: time.Now()},
			Optimizer:              common.String("EXAMPLE-optimizer-Value"),
			Remark:                 common.String("EXAMPLE-remark-Value"),
			TimeGenerated:          &common.SDKTime{Time: time.Now()},
			Cost:                   common.Int64(634),
			CpuCost:                common.Int64(417),
			Distribution:           common.String("EXAMPLE-distribution-Value"),
			ObjectNode:             common.String("EXAMPLE-objectNode-Value"),
			ObjectType:             common.String("EXAMPLE-objectType-Value"),
			Position:               common.Int64(60),
			QblockName:             common.String("EXAMPLE-qblockName-Value"),
			ForceMatchingSignature: common.String("EXAMPLE-forceMatchingSignature-Value"),
			Identifier:             common.Int64(860),
			OtherTag:               common.String("EXAMPLE-otherTag-Value"),
			OtherXML:               common.String("EXAMPLE-otherXML-Value"),
			Cardinality:            common.Int64(186),
			Options:                common.String("EXAMPLE-options-Value"),
			PartitionIdentifier:    common.Int64(428),
			PartitionStart:         common.String("EXAMPLE-partitionStart-Value"),
			SearchColumns:          common.Int64(557),
			Version:                common.Float32(7098.937),
			IoCost:                 common.Int64(531),
			ParentIdentifier:       common.Int64(897),
			Depth:                  common.Int64(386),
			ObjectAlias:            common.String("EXAMPLE-objectAlias-Value"),
			ObjectOwner:            common.String("EXAMPLE-objectOwner-Value"),
			Other:                  common.String("EXAMPLE-other-Value"),
			PartitionStop:          common.String("EXAMPLE-partitionStop-Value"),
			SqlIdentifier:          common.String("EXAMPLE-sqlIdentifier-Value")}}},
		OpcRequestId:  common.String("WP0UPULMVHKS3IU49W5M<unique_ID>"),
		OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value")}

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

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