// 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.DbSystemClient({ authenticationDetailsProvider: provider });

    // Create a request and dependent object(s).
    const updateDbSystemDetails = {
      displayName: "EXAMPLE-displayName-Value",
      description: "EXAMPLE-description-Value",
      subnetId: "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
      isHighlyAvailable: false,
      availabilityDomain: "EXAMPLE-availabilityDomain-Value",
      faultDomain: "EXAMPLE-faultDomain-Value",
      shapeName: "EXAMPLE-shapeName-Value",
      mysqlVersion: "EXAMPLE-mysqlVersion-Value",
      configurationId: "ocid1.test.oc1..<unique_ID>EXAMPLE-configurationId-Value",
      adminUsername: "EXAMPLE-adminUsername-Value",
      adminPassword: "EXAMPLE-adminPassword-Value",
      dataStorageSizeInGBs: 60615,
      hostnameLabel: "EXAMPLE-hostnameLabel-Value",
      ipAddress: "EXAMPLE-ipAddress-Value",
      port: 39406,
      portX: 5345,
      backupPolicy: {
        isEnabled: false,
        windowStartTime: "EXAMPLE-windowStartTime-Value",
        retentionInDays: 18,
        freeformTags: {
          EXAMPLE_KEY_YF6us: "EXAMPLE_VALUE_bvJyI13tKbQ5wwM6QahY"
        },
        definedTags: {
          EXAMPLE_KEY_S3xkU: {
            EXAMPLE_KEY_FiXnU: "EXAMPLE--Value"
          }
        },
        pitrPolicy: {
          isEnabled: false
        }
      },
      maintenance: {
        windowStartTime: "EXAMPLE-windowStartTime-Value"
      },
      freeformTags: {
        EXAMPLE_KEY_PHsXp: "EXAMPLE_VALUE_NPNhxJJfYdRxBo6ZU56G"
      },
      definedTags: {
        EXAMPLE_KEY_wgCq9: {
          EXAMPLE_KEY_F7WNf: "EXAMPLE--Value"
        }
      },
      deletionPolicy: {
        automaticBackupRetention:
          mysql.models.UpdateDeletionPolicyDetails.AutomaticBackupRetention.Delete,
        finalBackup: mysql.models.UpdateDeletionPolicyDetails.FinalBackup.SkipFinalBackup,
        isDeleteProtected: true
      },
      crashRecovery: mysql.models.CrashRecoveryStatus.Enabled,
      databaseManagement: mysql.models.DatabaseManagementStatus.Disabled,
      secureConnections: {
        certificateId: "ocid1.test.oc1..<unique_ID>EXAMPLE-certificateId-Value",
        certificateGenerationType: mysql.models.CertificateGenerationType.Byoc
      }
    };

    const updateDbSystemRequest: mysql.requests.UpdateDbSystemRequest = {
      dbSystemId: "ocid1.test.oc1..<unique_ID>EXAMPLE-dbSystemId-Value",
      updateDbSystemDetails: updateDbSystemDetails,
      ifMatch: "EXAMPLE-ifMatch-Value",
      opcRequestId: "ZXM7JQAGZXLZOYW6OL3J<unique_ID>"
    };

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