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

    // Create a request and dependent object(s).
    const launchDbSystemBase = {
      source: "DB_SYSTEM",
      sourceDbSystemId: "ocid1.test.oc1..<unique_ID>EXAMPLE-sourceDbSystemId-Value",
      dbHome: {
        displayName: "EXAMPLE-displayName-Value",
        database: {
          adminPassword: "EXAMPLE-adminPassword-Value",
          dbName: "EXAMPLE-dbName-Value",
          dbDomain: "EXAMPLE-dbDomain-Value",
          dbUniqueName: "EXAMPLE-dbUniqueName-Value",
          dbBackupConfig: {
            autoBackupEnabled: true,
            recoveryWindowInDays: 54,
            autoBackupWindow: database.models.DbBackupConfig.AutoBackupWindow.SlotFour,
            autoFullBackupWindow: database.models.DbBackupConfig.AutoFullBackupWindow.SlotSix,
            autoFullBackupDay: database.models.DbBackupConfig.AutoFullBackupDay.Monday,
            runImmediateFullBackup: true,
            backupDestinationDetails: [
              {
                type: database.models.BackupDestinationDetails.Type.Nfs,
                id: "ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value",
                vpcUser: "EXAMPLE-vpcUser-Value",
                vpcPassword: "EXAMPLE-vpcPassword-Value",
                internetProxy: "EXAMPLE-internetProxy-Value",
                dbrsPolicyId: "ocid1.test.oc1..<unique_ID>EXAMPLE-dbrsPolicyId-Value"
              }
            ],
            backupDeletionPolicy:
              database.models.DbBackupConfig.BackupDeletionPolicy.DeleteImmediately
          },
          freeformTags: {
            EXAMPLE_KEY_hSons: "EXAMPLE_VALUE_6gopmPNRJXOENL35My2W"
          },
          definedTags: {
            EXAMPLE_KEY_9qsLF: {
              EXAMPLE_KEY_bOcmB: "EXAMPLE--Value"
            }
          }
        },
        freeformTags: {
          EXAMPLE_KEY_PYd1U: "EXAMPLE_VALUE_EKXqPiZpEje1sqjfAhN3"
        },
        definedTags: {
          EXAMPLE_KEY_5dILi: {
            EXAMPLE_KEY_W7s7J: "EXAMPLE--Value"
          }
        }
      },
      licenseModel:
        database.models.LaunchDbSystemFromDbSystemDetails.LicenseModel.BringYourOwnLicense,
      compartmentId: "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
      faultDomains: ["EXAMPLE--Value"],
      displayName: "EXAMPLE-displayName-Value",
      availabilityDomain: "EXAMPLE-availabilityDomain-Value",
      subnetId: "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
      backupSubnetId: "ocid1.test.oc1..<unique_ID>EXAMPLE-backupSubnetId-Value",
      nsgIds: ["EXAMPLE--Value"],
      backupNetworkNsgIds: ["EXAMPLE--Value"],
      shape: "EXAMPLE-shape-Value",
      timeZone: "EXAMPLE-timeZone-Value",
      dbSystemOptions: {
        storageManagement: database.models.DbSystemOptions.StorageManagement.Asm
      },
      storageVolumePerformanceMode:
        database.models.LaunchDbSystemBase.StorageVolumePerformanceMode.Balanced,
      sparseDiskgroup: false,
      sshPublicKeys: ["EXAMPLE--Value"],
      hostname: "EXAMPLE-hostname-Value",
      domain: "EXAMPLE-domain-Value",
      cpuCoreCount: 546,
      clusterName: "EXAMPLE-clusterName-Value",
      dataStoragePercentage: 212,
      initialDataStorageSizeInGB: 804,
      kmsKeyId: "ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value",
      kmsKeyVersionId: "ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyVersionId-Value",
      nodeCount: 900,
      freeformTags: {
        EXAMPLE_KEY_EiGMO: "EXAMPLE_VALUE_Nitr2CMq3chg1FbHEnxM"
      },
      definedTags: {
        EXAMPLE_KEY_qdXy8: {
          EXAMPLE_KEY_me1ml: "EXAMPLE--Value"
        }
      },
      privateIp: "EXAMPLE-privateIp-Value",
      dataCollectionOptions: {
        isDiagnosticsEventsEnabled: true,
        isHealthMonitoringEnabled: true,
        isIncidentLogsEnabled: true
      }
    };

    const launchDbSystemRequest: database.requests.LaunchDbSystemRequest = {
      launchDbSystemDetails: launchDbSystemBase,
      opcRetryToken: "EXAMPLE-opcRetryToken-Value"
    };

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