// 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.Dg,
		replicationFactor: 5,
		replicationUnit: 959,
		clusterCertificateCommonName: "EXAMPLE-clusterCertificateCommonName-Value",
		chunks: 796,
		dbWorkload: globallydistributeddatabase.models.CreateDedicatedShardedDatabase.DbWorkload.Oltp,
		shardingMethod: globallydistributeddatabase.models.CreateDedicatedShardedDatabase.ShardingMethod.System,
		dbVersion: "EXAMPLE-dbVersion-Value",
		characterSet: "EXAMPLE-characterSet-Value",
		ncharacterSet: "EXAMPLE-ncharacterSet-Value",
		listenerPort: 12881,
		listenerPortTls: 9256,
		onsPortLocal: 46996,
		onsPortRemote: 8140,
		prefix: "9rz",
		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: 6416.2075,
				dataStorageSizeInGbs: 3922.7866,
				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: 6694.38,
				dataStorageSizeInGbs: 2142.765,
				isAutoScalingEnabled: false,
				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_yMH5a :"EXAMPLE_VALUE_0wvACNZkwF43YyEMdNEp"
			},
		definedTags: {
			EXAMPLE_KEY_3GnsM :{
				EXAMPLE_KEY_brezl :"EXAMPLE--Value"
				}
			}

		}

	const createShardedDatabaseRequest: globallydistributeddatabase.requests.CreateShardedDatabaseRequest = { 
	createShardedDatabaseDetails: createShardedDatabaseDetails,
	opcRetryToken: "EXAMPLE-opcRetryToken-Value",
	opcRequestId: "TQM2VSZDBUWOGMSGZYJ5<unique_ID>",

		}; 


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