// 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 globallydistributeddatabase from "oci-globallydistributeddatabase";
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 globallydistributeddatabase.ShardedDatabaseServiceClient({
authenticationDetailsProvider: provider
});
// Create a request and dependent object(s).
const createShardedDatabaseDetails = {
dbDeploymentType: "DEDICATED",
clusterCertificateCommonName: "EXAMPLE-clusterCertificateCommonName-Value",
chunks: 542,
dbWorkload: globallydistributeddatabase.models.CreateDedicatedShardedDatabase.DbWorkload.Oltp,
shardingMethod:
globallydistributeddatabase.models.CreateDedicatedShardedDatabase.ShardingMethod.User,
dbVersion: "EXAMPLE-dbVersion-Value",
characterSet: "EXAMPLE-characterSet-Value",
ncharacterSet: "EXAMPLE-ncharacterSet-Value",
listenerPort: 62108,
listenerPortTls: 18646,
onsPortLocal: 51880,
onsPortRemote: 62334,
prefix: "Xcg",
shardDetails: [
{
encryptionKeyDetails: {
vaultId: "ocid1.test.oc1..<unique_ID>EXAMPLE-vaultId-Value",
kmsKeyId: "ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value",
kmsKeyVersionId: "ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyVersionId-Value"
},
adminPassword: "EXAMPLE-adminPassword-Value",
computeCount: 8518.397,
dataStorageSizeInGbs: 2460.2217,
shardSpace: "EXAMPLE-shardSpace-Value",
isAutoScalingEnabled: false,
cloudAutonomousVmClusterId:
"ocid1.test.oc1..<unique_ID>EXAMPLE-cloudAutonomousVmClusterId-Value",
peerCloudAutonomousVmClusterId:
"ocid1.test.oc1..<unique_ID>EXAMPLE-peerCloudAutonomousVmClusterId-Value"
}
],
catalogDetails: [
{
encryptionKeyDetails: {
vaultId: "ocid1.test.oc1..<unique_ID>EXAMPLE-vaultId-Value",
kmsKeyId: "ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value",
kmsKeyVersionId: "ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyVersionId-Value"
},
adminPassword: "EXAMPLE-adminPassword-Value",
computeCount: 4387.8813,
dataStorageSizeInGbs: 3617.9263,
isAutoScalingEnabled: true,
cloudAutonomousVmClusterId:
"ocid1.test.oc1..<unique_ID>EXAMPLE-cloudAutonomousVmClusterId-Value",
peerCloudAutonomousVmClusterId:
"ocid1.test.oc1..<unique_ID>EXAMPLE-peerCloudAutonomousVmClusterId-Value"
}
],
compartmentId: "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
displayName: "EXAMPLE-displayName-Value",
freeformTags: {
EXAMPLE_KEY_zSVSd: "EXAMPLE_VALUE_XwYRxeQdJRb16O7I9ho2"
},
definedTags: {
EXAMPLE_KEY_qTUUE: {
EXAMPLE_KEY_qHAl2: "EXAMPLE--Value"
}
}
};
const createShardedDatabaseRequest: globallydistributeddatabase.requests.CreateShardedDatabaseRequest = {
createShardedDatabaseDetails: createShardedDatabaseDetails,
opcRetryToken: "EXAMPLE-opcRetryToken-Value",
opcRequestId: "FCXOONUU2QXDFTOIPPLM<unique_ID>"
};
// Send request to the Client.
const createShardedDatabaseResponse = await client.createShardedDatabase(
createShardedDatabaseRequest
);
} catch (error) {
console.log("createShardedDatabase Failed with error " + error);
}
})();