// 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 mysql from "oci-mysql";
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 mysql.MysqlaasClient({ authenticationDetailsProvider: provider });

    // Create a request and dependent object(s).
    const createConfigurationDetails = {
      compartmentId: "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
      description: "EXAMPLE-description-Value",
      displayName: "EXAMPLE-displayName-Value",
      shapeName: "EXAMPLE-shapeName-Value",
      initVariables: {
        lowerCaseTableNames:
          mysql.models.InitializationVariables.LowerCaseTableNames.CaseInsensitiveLowercase
      },
      variables: {
        completionType: mysql.models.ConfigurationVariables.CompletionType.NoChain,
        bigTables: false,
        connectionMemoryChunkSize: 264656567,
        connectionMemoryLimit: 5082413452996207616,
        defaultAuthenticationPlugin:
          mysql.models.ConfigurationVariables.DefaultAuthenticationPlugin.Sha256Password,
        globalConnectionMemoryLimit: 5848263798121863168,
        globalConnectionMemoryTracking: false,
        transactionIsolation:
          mysql.models.ConfigurationVariables.TransactionIsolation.ReadCommitted,
        innodbFtServerStopwordTable: "EXAMPLE-innodbFtServerStopwordTable-Value",
        mandatoryRoles: "EXAMPLE-mandatoryRoles-Value",
        autocommit: false,
        foreignKeyChecks: true,
        groupReplicationConsistency:
          mysql.models.ConfigurationVariables.GroupReplicationConsistency.Eventual,
        innodbFtEnableStopword: false,
        innodbLogWriterThreads: true,
        localInfile: true,
        mysqlFirewallMode: false,
        mysqlxEnableHelloNotice: true,
        sqlRequirePrimaryKey: false,
        sqlWarnings: true,
        binlogExpireLogsSeconds: 755,
        binlogRowMetadata: mysql.models.ConfigurationVariables.BinlogRowMetadata.Minimal,
        binlogRowValueOptions: "EXAMPLE-binlogRowValueOptions-Value",
        binlogTransactionCompression: true,
        innodbBufferPoolSize: 8960721187112890368,
        innodbFtResultCacheLimit: 2804949353,
        maxBinlogCacheSize: 65657598380079,
        maxConnectErrors: 6055925199060217857,
        maxHeapTableSize: 6459870808769727488,
        maxConnections: 35742,
        maxPreparedStmtCount: 2382156,
        connectTimeout: 22150952,
        cteMaxRecursionDepth: 2861293450,
        generatedRandomPasswordLength: 101,
        informationSchemaStatsExpiry: 19092921,
        innodbBufferPoolDumpPct: 99,
        innodbBufferPoolInstances: 11,
        innodbDdlBufferSize: 600391474,
        innodbDdlThreads: 4,
        innodbFtMaxTokenSize: 72,
        innodbFtMinTokenSize: 12,
        innodbFtNumWordOptimize: 607,
        innodbLockWaitTimeout: 701613807,
        innodbMaxPurgeLag: 4249995245,
        innodbMaxPurgeLagDelay: 97434,
        interactiveTimeout: 3669345,
        innodbStatsPersistentSamplePages: 2889306246261959681,
        innodbStatsTransientSamplePages: 5548173996507821057,
        maxAllowedPacket: 353657050,
        maxExecutionTime: 1775319325852203008,
        mysqlxConnectTimeout: 455362753,
        mysqlxDocumentIdUniquePrefix: 41339,
        mysqlxIdleWorkerThreadTimeout: 2578,
        mysqlxInteractiveTimeout: 2129559,
        mysqlxMaxAllowedPacket: 955788917,
        mysqlxMinWorkerThreads: 17,
        mysqlxReadTimeout: 1303861,
        mysqlxWaitTimeout: 431757,
        mysqlxWriteTimeout: 218352,
        netReadTimeout: 30864174,
        netWriteTimeout: 20578789,
        parserMaxMemSize: 998391481485091328,
        queryAllocBlockSize: 4152372630,
        queryPreallocSize: 8712992094385236992,
        regexpTimeLimit: 1556007583,
        sqlMode: "EXAMPLE-sqlMode-Value",
        tmpTableSize: 6098776025655454720,
        mysqlxDeflateDefaultCompressionLevel: 1,
        mysqlxDeflateMaxClientCompressionLevel: 4,
        mysqlxLz4MaxClientCompressionLevel: 14,
        mysqlxLz4DefaultCompressionLevel: 3,
        mysqlxZstdMaxClientCompressionLevel: 3,
        mysqlxZstdDefaultCompressionLevel: 7,
        mysqlZstdDefaultCompressionLevel: 17,
        sortBufferSize: 658425459337262848,
        waitTimeout: 559867,
        threadPoolDedicatedListeners: true,
        threadPoolMaxTransactionsLimit: 20139,
        timeZone: "EXAMPLE-timeZone-Value"
      },
      parentConfigurationId: "ocid1.test.oc1..<unique_ID>EXAMPLE-parentConfigurationId-Value",
      freeformTags: {
        EXAMPLE_KEY_LmtkX: "EXAMPLE_VALUE_oBLrbPg8WPZN7tJ8VUCA"
      },
      definedTags: {
        EXAMPLE_KEY_tkEjg: {
          EXAMPLE_KEY_LP0GB: "EXAMPLE--Value"
        }
      }
    };

    const createConfigurationRequest: mysql.requests.CreateConfigurationRequest = {
      createConfigurationDetails: createConfigurationDetails,
      opcRequestId: "SGTICKNNBZHXZYUN5XVM<unique_ID>",
      opcRetryToken: "EXAMPLE-opcRetryToken-Value"
    };

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