// 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 createDbSystemDetails = {
displayName: "EXAMPLE-displayName-Value",
description: "EXAMPLE-description-Value",
compartmentId: "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
rest: {
configuration: mysql.models.RestConfigurationType.DbsystemOnly,
port: 22321,
}
,
isHighlyAvailable: false,
availabilityDomain: "EXAMPLE-availabilityDomain-Value",
faultDomain: "EXAMPLE-faultDomain-Value",
configurationId: "ocid1.test.oc1..<unique_ID>EXAMPLE-configurationId-Value",
shapeName: "EXAMPLE-shapeName-Value",
mysqlVersion: "EXAMPLE-mysqlVersion-Value",
subnetId: "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
nsgIds: ["EXAMPLE--Value" ],
adminUsername: "EXAMPLE-adminUsername-Value",
adminPassword: "EXAMPLE-adminPassword-Value",
dataStorageSizeInGBs: 113937,
dataStorage: {
isAutoExpandStorageEnabled: true,
maxStorageSizeInGBs: 86177,
}
,
hostnameLabel: "EXAMPLE-hostnameLabel-Value",
ipAddress: "EXAMPLE-ipAddress-Value",
port: 58592,
portX: 49238,
backupPolicy: {
isEnabled: true,
softDelete: mysql.models.SoftDelete.Disabled,
copyPolicies: [{
copyToRegion: "EXAMPLE-copyToRegion-Value",
backupCopyRetentionInDays: 28,
}
],
windowStartTime: "EXAMPLE-windowStartTime-Value",
retentionInDays: 23,
freeformTags: {
EXAMPLE_KEY_M7TX9 :"EXAMPLE_VALUE_avu9JTM4ljmRbzGg0plk"
},
definedTags: {
EXAMPLE_KEY_OZeNl :{
EXAMPLE_KEY_1MSDI :"EXAMPLE--Value"
}
},
pitrPolicy: {
isEnabled: true,
}
,
}
,
source: {
sourceType: "PITR", dbSystemId: "ocid1.test.oc1..<unique_ID>EXAMPLE-dbSystemId-Value",
recoveryPoint: new Date("Sat Jul 28 05:55:28 UTC 2046")
}
,
maintenance: {
windowStartTime: "EXAMPLE-windowStartTime-Value",
}
,
freeformTags: {
EXAMPLE_KEY_N9xOU :"EXAMPLE_VALUE_7X7WkPFir7zktFnyec6p"
},
definedTags: {
EXAMPLE_KEY_7SUDY :{
EXAMPLE_KEY_gAP5D :"EXAMPLE--Value"
}
},
deletionPolicy: {
automaticBackupRetention: mysql.models.CreateDeletionPolicyDetails.AutomaticBackupRetention.Delete,
finalBackup: mysql.models.CreateDeletionPolicyDetails.FinalBackup.RequireFinalBackup,
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,
}
,
encryptData: {
keyId: "ocid1.test.oc1..<unique_ID>EXAMPLE-keyId-Value",
keyGenerationType: mysql.models.KeyGenerationType.Byok,
}
,
databaseMode: mysql.models.DbSystem.DatabaseMode.ReadWrite,
accessMode: mysql.models.DbSystem.AccessMode.Restricted,
customerContacts: [{
email: "EXAMPLE-email-Value",
}
],
readEndpoint: {
isEnabled: false,
readEndpointIpAddress: "EXAMPLE-readEndpointIpAddress-Value",
readEndpointHostnameLabel: "EXAMPLE-readEndpointHostnameLabel-Value",
excludeIps: ["EXAMPLE--Value" ],
}
,
}
const createDbSystemRequest: mysql.requests.CreateDbSystemRequest = {
createDbSystemDetails: createDbSystemDetails,
opcRequestId: "16OMIQ6UC3IEQQHTE3IH<unique_ID>",
opcRetryToken: "EXAMPLE-opcRetryToken-Value",
};
// Send request to the Client.
const createDbSystemResponse = await client.createDbSystem(createDbSystemRequest);
}
catch (error) {
console.log("createDbSystem Failed with error " + error);
}
})();