// 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",
nsgIds: ["EXAMPLE--Value" ],
securityAttributes: {
EXAMPLE_KEY_rgFk8 :{
EXAMPLE_KEY_5rQq8 :"EXAMPLE--Value"
}
},
databaseMode: mysql.models.DbSystem.DatabaseMode.ReadWrite,
accessMode: mysql.models.DbSystem.AccessMode.Unrestricted,
rest: {
configuration: mysql.models.RestConfigurationType.DbsystemOnly,
port: 58997,
}
,
databaseConsole: {
status: mysql.models.DatabaseConsoleStatus.Disabled,
port: 12862,
}
,
isHighlyAvailable: true,
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: 78105,
dataStorage: {
isAutoExpandStorageEnabled: true,
maxStorageSizeInGBs: 60928,
}
,
hostnameLabel: "EXAMPLE-hostnameLabel-Value",
ipAddress: "EXAMPLE-ipAddress-Value",
port: 57394,
portX: 58488,
backupPolicy: {
isEnabled: true,
softDelete: mysql.models.SoftDelete.Disabled,
copyPolicies: [{
copyToRegion: "EXAMPLE-copyToRegion-Value",
backupCopyRetentionInDays: 8,
}
],
windowStartTime: "EXAMPLE-windowStartTime-Value",
retentionInDays: 4,
freeformTags: {
EXAMPLE_KEY_yDuOG :"EXAMPLE_VALUE_LgrhtayEYHkqP3Y53u0X"
},
definedTags: {
EXAMPLE_KEY_fbUnO :{
EXAMPLE_KEY_DzY9i :"EXAMPLE--Value"
}
},
pitrPolicy: {
isEnabled: true,
}
,
}
,
maintenance: {
windowStartTime: "EXAMPLE-windowStartTime-Value",
versionPreference: mysql.models.VersionPreference.Newest,
versionTrackPreference: mysql.models.VersionTrackPreference.LongTermSupport,
maintenanceScheduleType: mysql.models.MaintenanceScheduleType.Regular,
maintenanceDisabledWindows: [{
timeStart: new Date("Fri Mar 23 16:23:30 UTC 2040"),
timeEnd: new Date("Sun Oct 24 01:35:39 UTC 2049"),
}
],
}
,
freeformTags: {
EXAMPLE_KEY_3N3xV :"EXAMPLE_VALUE_BTwxUJpCZQCr0nDHgsLF"
},
definedTags: {
EXAMPLE_KEY_dymHE :{
EXAMPLE_KEY_FHczD :"EXAMPLE--Value"
}
},
deletionPolicy: {
automaticBackupRetention: mysql.models.UpdateDeletionPolicyDetails.AutomaticBackupRetention.Retain,
finalBackup: mysql.models.UpdateDeletionPolicyDetails.FinalBackup.SkipFinalBackup,
isDeleteProtected: false,
}
,
crashRecovery: mysql.models.CrashRecoveryStatus.Enabled,
databaseManagement: mysql.models.DatabaseManagementStatus.Enabled,
secureConnections: {
certificateId: "ocid1.test.oc1..<unique_ID>EXAMPLE-certificateId-Value",
certificateGenerationType: mysql.models.CertificateGenerationType.Byoc,
}
,
encryptData: {
keyId: "ocid1.test.oc1..<unique_ID>EXAMPLE-keyId-Value",
keyGenerationType: mysql.models.KeyGenerationType.Byok,
}
,
customerContacts: [{
email: "EXAMPLE-email-Value",
}
],
readEndpoint: {
isEnabled: true,
readEndpointIpAddress: "EXAMPLE-readEndpointIpAddress-Value",
readEndpointHostnameLabel: "EXAMPLE-readEndpointHostnameLabel-Value",
excludeIps: ["EXAMPLE--Value" ],
}
,
telemetryConfiguration: {
logs: [{
destination: mysql.models.LoggingDestinationConfiguration.Destination.OpenTelemetry,
destinationConfigurations: [{
key: "EXAMPLE-key-Value",
value: "EXAMPLE-value-Value",
}
],
logTypes: [mysql.models.LoggingDestinationConfiguration.LogTypes.SlowQueryLog ],
}
],
}
,
}
const updateDbSystemRequest: mysql.requests.UpdateDbSystemRequest = {
dbSystemId: "ocid1.test.oc1..<unique_ID>EXAMPLE-dbSystemId-Value",
updateDbSystemDetails: updateDbSystemDetails,
ifMatch: "EXAMPLE-ifMatch-Value",
opcRequestId: "DIDWU4VF7QDFGTGUOKBN<unique_ID>",
};
// Send request to the Client.
const updateDbSystemResponse = await client.updateDbSystem(updateDbSystemRequest);
}
catch (error) {
console.log("updateDbSystem Failed with error " + error);
}
})();