// 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", replicationMethod: globallydistributeddatabase.models.DedicatedShardedDatabase.ReplicationMethod.Raft,
replicationFactor: 4,
replicationUnit: 367,
clusterCertificateCommonName: "EXAMPLE-clusterCertificateCommonName-Value",
chunks: 789,
dbWorkload: globallydistributeddatabase.models.CreateDedicatedShardedDatabase.DbWorkload.Dw,
shardingMethod: globallydistributeddatabase.models.CreateDedicatedShardedDatabase.ShardingMethod.System,
dbVersion: "EXAMPLE-dbVersion-Value",
characterSet: "EXAMPLE-characterSet-Value",
ncharacterSet: "EXAMPLE-ncharacterSet-Value",
listenerPort: 8509,
listenerPortTls: 10307,
onsPortLocal: 13254,
onsPortRemote: 14020,
prefix: "2VS",
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: 9464.277,
dataStorageSizeInGbs: 2937.1392,
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: 3842.6257,
dataStorageSizeInGbs: 2971.2832,
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_SGzYJ :"EXAMPLE_VALUE_5QocQXIuj1xrwtcBMvOt"
},
definedTags: {
EXAMPLE_KEY_N4mhP :{
EXAMPLE_KEY_N3arV :"EXAMPLE--Value"
}
}
}
const createShardedDatabaseRequest: globallydistributeddatabase.requests.CreateShardedDatabaseRequest = {
createShardedDatabaseDetails: createShardedDatabaseDetails,
opcRetryToken: "EXAMPLE-opcRetryToken-Value",
opcRequestId: "GMMMPV1DRY5CUUXVJKDR<unique_ID>",
};
// Send request to the Client.
const createShardedDatabaseResponse = await client.createShardedDatabase(createShardedDatabaseRequest);
}
catch (error) {
console.log("createShardedDatabase Failed with error " + error);
}
})();