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

import * as opsi from "oci-opsi";
import common = require("oci-common");

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

const provider: common.ConfigFileAuthenticationDetailsProvider = new common.ConfigFileAuthenticationDetailsProvider();

(async () => {
  try {
    // Create a service client
    const client = new opsi.OperationsInsightsClient({ authenticationDetailsProvider: provider });

    // Create a request and dependent object(s).
    const ingestSqlPlanLinesDetails = {
      items: [
        {
          version: 7651.434,
          sqlIdentifier: "EXAMPLE-sqlIdentifier-Value",
          planHash: 713,
          timeCollected: new Date("Mon Dec 26 16:43:08 UTC 2016"),
          operation: "EXAMPLE-operation-Value",
          remark: "EXAMPLE-remark-Value",
          options: "EXAMPLE-options-Value",
          objectNode: "EXAMPLE-objectNode-Value",
          objectOwner: "EXAMPLE-objectOwner-Value",
          objectName: "EXAMPLE-objectName-Value",
          objectAlias: "EXAMPLE-objectAlias-Value",
          objectInstance: 928,
          objectType: "EXAMPLE-objectType-Value",
          optimizer: "EXAMPLE-optimizer-Value",
          searchColumns: 894,
          identifier: 22,
          parentIdentifier: 766,
          depth: 229,
          position: 532,
          cost: 333,
          cardinality: 76,
          bytes: 738,
          other: "EXAMPLE-other-Value",
          otherTag: "EXAMPLE-otherTag-Value",
          partitionStart: "EXAMPLE-partitionStart-Value",
          partitionStop: "EXAMPLE-partitionStop-Value",
          partitionIdentifier: 283,
          distribution: "EXAMPLE-distribution-Value",
          cpuCost: 156,
          ioCost: 151,
          tempSpace: 813,
          accessPredicates: "EXAMPLE-accessPredicates-Value",
          filterPredicates: "EXAMPLE-filterPredicates-Value",
          projection: "EXAMPLE-projection-Value",
          qblockName: "EXAMPLE-qblockName-Value",
          elapsedTimeInSec: 253.6881,
          otherXML: "EXAMPLE-otherXML-Value"
        }
      ]
    };

    const ingestSqlPlanLinesRequest: opsi.requests.IngestSqlPlanLinesRequest = {
      ingestSqlPlanLinesDetails: ingestSqlPlanLinesDetails,
      compartmentId: "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
      databaseId: "ocid1.test.oc1..<unique_ID>EXAMPLE-databaseId-Value",
      id: "ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value",
      opcRequestId: "RXFTFYCO0CPRAYX1K41K<unique_ID>",
      ifMatch: "EXAMPLE-ifMatch-Value",
      opcRetryToken: "EXAMPLE-opcRetryToken-Value"
    };

    // Send request to the Client.
    const ingestSqlPlanLinesResponse = await client.ingestSqlPlanLines(ingestSqlPlanLinesRequest);
  } catch (error) {
    console.log("ingestSqlPlanLines Failed with error  " + error);
  }
})();