// 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).

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Oci.Distributeddatabasev26Service;
using Oci.Common;
using Oci.Common.Auth;

namespace Oci.Sdk.DotNet.Example.Distributeddatabasev26
{
    public class CreateDistributedDatabaseExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var createDistributedDatabaseDetails = new Oci.Distributeddatabasev26Service.Models.CreateDistributedDatabaseDetails
			{
				CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
				DisplayName = "EXAMPLE-displayName-Value",
				DatabaseVersion = "EXAMPLE-databaseVersion-Value",
				Prefix = "vk8",
				PrivateEndpointIds = new List<string>
				{
					"EXAMPLE--Value"
				},
				NotificationTopicIds = new List<string>
				{
					"EXAMPLE--Value"
				},
				CharacterSet = "EXAMPLE-characterSet-Value",
				NcharacterSet = "EXAMPLE-ncharacterSet-Value",
				ListenerPort = 62733,
				ListenerPortTls = 3234,
				OnsPortLocal = 5727,
				OnsPortRemote = 43116,
				ScanListenerPort = 2139,
				SystemChunkCount = 719,
				SystemRaftReplicationUnitCount = 898,
				CompositeRaftShardSpaces = new List<Oci.Distributeddatabasev26Service.Models.CreateCompositeRaftShardSpaceDetails>
				{
					new Oci.Distributeddatabasev26Service.Models.CreateCompositeRaftShardSpaceDetails
					{
						Name = "EXAMPLE-name-Value",
						ChunkCount = 320,
						ReplicationUnitCount = 192,
						RaftClusters = new List<Oci.Distributeddatabasev26Service.Models.CreateCompositeShardSpaceRaftClusterDetails>
						{
							new Oci.Distributeddatabasev26Service.Models.CreateCompositeShardSpaceRaftClusterDetails
							{
								Name = "EXAMPLE-name-Value",
								ReplicationFactor = 460,
								WitnessCount = 142,
								RuMode = Oci.Distributeddatabasev26Service.Models.CreateCompositeShardSpaceRaftClusterDetails.RuModeEnum.ReadOnly,
								Databases = new List<Oci.Distributeddatabasev26Service.Models.CreateDistributedDatabaseShardDatabaseDetails>
								{
									new Oci.Distributeddatabasev26Service.Models.CreateDistributedDatabaseShardDatabaseWithDbHomeDetails
									{
										DbHomeId = "ocid1.test.oc1..<unique_ID>EXAMPLE-dbHomeId-Value",
										AdminPassword = "EXAMPLE-adminPassword-Value",
										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",
										ProtectionMode = Oci.Distributeddatabasev26Service.Models.DistributedDbProtectionMode.MaximumAvailability,
										TransportType = Oci.Distributeddatabasev26Service.Models.DistributedDbTransportType.Fastsync
									}
								}
							}
						}
					}
				},
				CompositeDataGuardShardSpaces = new List<Oci.Distributeddatabasev26Service.Models.CreateCompositeDataGuardShardSpaceDetails>
				{
					new Oci.Distributeddatabasev26Service.Models.CreateCompositeDataGuardShardSpaceDetails
					{
						Name = "EXAMPLE-name-Value",
						ChunkCount = 81,
						OriginalReplica = new Oci.Distributeddatabasev26Service.Models.CreateCompositeDataGuardShardSpaceReplicaDetails
						{
							Name = "EXAMPLE-name-Value",
							Databases = new List<Oci.Distributeddatabasev26Service.Models.CreateDistributedDatabaseShardDatabaseDetails>
							{
								new Oci.Distributeddatabasev26Service.Models.CreateDistributedDatabaseShardDatabaseWithExadbXsDetails
								{
									VmClusterId = "ocid1.test.oc1..<unique_ID>EXAMPLE-vmClusterId-Value",
									AdminPassword = "EXAMPLE-adminPassword-Value",
									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",
									ProtectionMode = Oci.Distributeddatabasev26Service.Models.DistributedDbProtectionMode.MaximumAvailability,
									TransportType = Oci.Distributeddatabasev26Service.Models.DistributedDbTransportType.Sync
								}
							}
						},
					}
				},
				SystemRaftClusters = new List<Oci.Distributeddatabasev26Service.Models.CreateSystemRaftClusterDetails>
				{
					new Oci.Distributeddatabasev26Service.Models.CreateSystemRaftClusterDetails
					{
						Name = "EXAMPLE-name-Value",
						ReplicationFactor = 128,
						WitnessCount = 323,
						RuMode = Oci.Distributeddatabasev26Service.Models.CreateSystemRaftClusterDetails.RuModeEnum.ReadWrite,
						Databases = new List<Oci.Distributeddatabasev26Service.Models.CreateDistributedDatabaseShardDatabaseDetails>
						{
							new Oci.Distributeddatabasev26Service.Models.CreateDistributedDatabaseShardWithExadbXsNewClusterDetails
							{
								AdminPassword = "EXAMPLE-adminPassword-Value",
								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",
								AvailabilityDomain = "EXAMPLE-availabilityDomain-Value",
								ExascaleDbStorageVaultId = "ocid1.test.oc1..<unique_ID>EXAMPLE-exascaleDbStorageVaultId-Value",
								VmClusterDetails = new Oci.Distributeddatabasev26Service.Models.VmClusterDetails
								{
									CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
									SubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
									BackupSubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-backupSubnetId-Value",
									EnabledECpuCount = 51,
									TotalECpuCount = 40,
									VmFileSystemStorageSize = 373,
									SshPublicKeys = new List<string>
									{
										"EXAMPLE--Value"
									},
									LicenseModel = Oci.Distributeddatabasev26Service.Models.VmClusterDetails.LicenseModelEnum.BringYourOwnLicense,
									Domain = "EXAMPLE-domain-Value",
									PrivateZoneId = "ocid1.test.oc1..<unique_ID>EXAMPLE-privateZoneId-Value",
									IsDiagnosticsEventsEnabled = true,
									IsHealthMonitoringEnabled = true,
									IsIncidentLogsEnabled = true,
									NsgIds = new List<string>
									{
										"EXAMPLE--Value"
									},
									BackupNetworkNsgIds = new List<string>
									{
										"EXAMPLE--Value"
									},
									SubscriptionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subscriptionId-Value"
								},
								ProtectionMode = Oci.Distributeddatabasev26Service.Models.DistributedDbProtectionMode.MaximumAvailability,
								TransportType = Oci.Distributeddatabasev26Service.Models.DistributedDbTransportType.Fastsync
							}
						}
					}
				},
				SystemDataGuardDatabases = new Oci.Distributeddatabasev26Service.Models.CreateSystemDataGuardDatabaseDetails
				{
					OriginalReplica = new Oci.Distributeddatabasev26Service.Models.CreateSystemDataGuardReplicaDetails
					{
						Name = "EXAMPLE-name-Value",
						Databases = new List<Oci.Distributeddatabasev26Service.Models.CreateDistributedDatabaseShardDatabaseDetails>
						{
							new Oci.Distributeddatabasev26Service.Models.CreateDistributedDatabaseShardWithExadbXsNewClusterDetails
							{
								AdminPassword = "EXAMPLE-adminPassword-Value",
								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",
								AvailabilityDomain = "EXAMPLE-availabilityDomain-Value",
								ExascaleDbStorageVaultId = "ocid1.test.oc1..<unique_ID>EXAMPLE-exascaleDbStorageVaultId-Value",
								VmClusterDetails = new Oci.Distributeddatabasev26Service.Models.VmClusterDetails
								{
									CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
									SubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
									BackupSubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-backupSubnetId-Value",
									EnabledECpuCount = 258,
									TotalECpuCount = 575,
									VmFileSystemStorageSize = 531,
									SshPublicKeys = new List<string>
									{
										"EXAMPLE--Value"
									},
									LicenseModel = Oci.Distributeddatabasev26Service.Models.VmClusterDetails.LicenseModelEnum.LicenseIncluded,
									Domain = "EXAMPLE-domain-Value",
									PrivateZoneId = "ocid1.test.oc1..<unique_ID>EXAMPLE-privateZoneId-Value",
									IsDiagnosticsEventsEnabled = false,
									IsHealthMonitoringEnabled = true,
									IsIncidentLogsEnabled = true,
									NsgIds = new List<string>
									{
										"EXAMPLE--Value"
									},
									BackupNetworkNsgIds = new List<string>
									{
										"EXAMPLE--Value"
									},
									SubscriptionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subscriptionId-Value"
								},
								ProtectionMode = Oci.Distributeddatabasev26Service.Models.DistributedDbProtectionMode.MaximumAvailability,
								TransportType = Oci.Distributeddatabasev26Service.Models.DistributedDbTransportType.Async
							}
						}
					},
				},
				UserShardSpaces = new List<Oci.Distributeddatabasev26Service.Models.CreateUserShardSpaceDetails>
				{
					new Oci.Distributeddatabasev26Service.Models.CreateUserShardSpaceDetails
					{
						Name = "EXAMPLE-name-Value",
						OriginalReplica = new Oci.Distributeddatabasev26Service.Models.CreateUserShardSpaceReplicaDetails
						{
							Name = "EXAMPLE-name-Value",
							Database = new Oci.Distributeddatabasev26Service.Models.CreateDistributedDatabaseShardWithExadbXsNewClusterDetails
							{
								AdminPassword = "EXAMPLE-adminPassword-Value",
								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",
								AvailabilityDomain = "EXAMPLE-availabilityDomain-Value",
								ExascaleDbStorageVaultId = "ocid1.test.oc1..<unique_ID>EXAMPLE-exascaleDbStorageVaultId-Value",
								VmClusterDetails = new Oci.Distributeddatabasev26Service.Models.VmClusterDetails
								{
									CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
									SubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
									BackupSubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-backupSubnetId-Value",
									EnabledECpuCount = 645,
									TotalECpuCount = 16,
									VmFileSystemStorageSize = 0,
									SshPublicKeys = new List<string>
									{
										"EXAMPLE--Value"
									},
									LicenseModel = Oci.Distributeddatabasev26Service.Models.VmClusterDetails.LicenseModelEnum.BringYourOwnLicense,
									Domain = "EXAMPLE-domain-Value",
									PrivateZoneId = "ocid1.test.oc1..<unique_ID>EXAMPLE-privateZoneId-Value",
									IsDiagnosticsEventsEnabled = true,
									IsHealthMonitoringEnabled = false,
									IsIncidentLogsEnabled = false,
									NsgIds = new List<string>
									{
										"EXAMPLE--Value"
									},
									BackupNetworkNsgIds = new List<string>
									{
										"EXAMPLE--Value"
									},
									SubscriptionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subscriptionId-Value"
								},
								ProtectionMode = Oci.Distributeddatabasev26Service.Models.DistributedDbProtectionMode.MaximumPerformance,
								TransportType = Oci.Distributeddatabasev26Service.Models.DistributedDbTransportType.Fastsync
							}
						},
					}
				},
				CatalogDetails = new List<Oci.Distributeddatabasev26Service.Models.CreateDistributedDatabaseCatalogDetails>
				{
					new Oci.Distributeddatabasev26Service.Models.CreateDistributedDatabaseCatalogDetails
					{
						OriginalReplica = new Oci.Distributeddatabasev26Service.Models.CreateDistributedDatabaseCatalogReplicaDetails
						{
							Name = "EXAMPLE-name-Value",
							Database = new Oci.Distributeddatabasev26Service.Models.CreateDistributedDatabaseCatalogWithExadbXsNewVaultAndClusterDetails
							{
								AdminPassword = "EXAMPLE-adminPassword-Value",
								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",
								AvailabilityDomain = "EXAMPLE-availabilityDomain-Value",
								DbStorageVaultDetails = new Oci.Distributeddatabasev26Service.Models.DbStorageVaultDetails
								{
									CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
									HighCapacityDatabaseStorage = 528,
									AdditionalFlashCacheInPercent = 290,
									SubscriptionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subscriptionId-Value",
									IsAutoscaleEnabled = true,
									AutoscaleLimitInGBs = 26
								},
								VmClusterDetails = new Oci.Distributeddatabasev26Service.Models.VmClusterDetails
								{
									CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
									SubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
									BackupSubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-backupSubnetId-Value",
									EnabledECpuCount = 936,
									TotalECpuCount = 394,
									VmFileSystemStorageSize = 685,
									SshPublicKeys = new List<string>
									{
										"EXAMPLE--Value"
									},
									LicenseModel = Oci.Distributeddatabasev26Service.Models.VmClusterDetails.LicenseModelEnum.BringYourOwnLicense,
									Domain = "EXAMPLE-domain-Value",
									PrivateZoneId = "ocid1.test.oc1..<unique_ID>EXAMPLE-privateZoneId-Value",
									IsDiagnosticsEventsEnabled = true,
									IsHealthMonitoringEnabled = false,
									IsIncidentLogsEnabled = true,
									NsgIds = new List<string>
									{
										"EXAMPLE--Value"
									},
									BackupNetworkNsgIds = new List<string>
									{
										"EXAMPLE--Value"
									},
									SubscriptionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subscriptionId-Value"
								},
								ProtectionMode = Oci.Distributeddatabasev26Service.Models.DistributedDbProtectionMode.MaximumAvailability,
								TransportType = Oci.Distributeddatabasev26Service.Models.DistributedDbTransportType.Fastsync
							}
						},
					}
				},
				GsmSshPublicKey = "EXAMPLE-gsmSshPublicKey-Value",
				DbBackupConfig = new Oci.Distributeddatabasev26Service.Models.DistributedDbBackupConfig
				{
					IsAutoBackupEnabled = true,
					RecoveryWindowInDays = 33,
					AutoBackupWindow = Oci.Distributeddatabasev26Service.Models.DistributedDbBackupConfig.AutoBackupWindowEnum.SlotSeven,
					AutoFullBackupWindow = Oci.Distributeddatabasev26Service.Models.DistributedDbBackupConfig.AutoFullBackupWindowEnum.SlotFive,
					AutoFullBackupDay = Oci.Distributeddatabasev26Service.Models.DistributedDbBackupConfig.AutoFullBackupDayEnum.Tuesday,
					CanRunImmediateFullBackup = false,
					IsRemoteBackupEnabled = false,
					RemoteRegion = "EXAMPLE-remoteRegion-Value",
					BackupDestinationDetails = new List<Oci.Distributeddatabasev26Service.Models.DistributedDbBackupDestination>
					{
						new Oci.Distributeddatabasev26Service.Models.DistributedDbBackupDestination
						{
							Type = Oci.Distributeddatabasev26Service.Models.DistributedDbBackupDestination.TypeEnum.Local,
							Id = "ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value",
							InternetProxy = "EXAMPLE-internetProxy-Value",
							DbrsPolicyId = "ocid1.test.oc1..<unique_ID>EXAMPLE-dbrsPolicyId-Value",
							IsRemote = false,
							RemoteRegion = "EXAMPLE-remoteRegion-Value"
						}
					},
					BackupDeletionPolicy = Oci.Distributeddatabasev26Service.Models.DistributedDbBackupConfig.BackupDeletionPolicyEnum.DeleteImmediately
				},
				VcnNsgIds = new List<Oci.Distributeddatabasev26Service.Models.VcnNsgIdsDetails>
				{
					new Oci.Distributeddatabasev26Service.Models.VcnNsgIdsDetails
					{
						VcnId = "ocid1.test.oc1..<unique_ID>EXAMPLE-vcnId-Value",
						NsgIds = new List<string>
						{
							"EXAMPLE--Value"
						}
					}
				},
				FreeformTags = new Dictionary<string, string>()
				{
					{
						"EXAMPLE_KEY_lGcNw", 
						"EXAMPLE_VALUE_7cQ28PdPAGcu1vJBa7lt"
					}
				},
				DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
				{
					{
						"EXAMPLE_KEY_KqCEp", 
						new Dictionary<string, Object>()
						{
							{
								"EXAMPLE_KEY_3Ee6g", 
								"EXAMPLE--Value"
							}
						}
					}
				}
			};
			var createDistributedDatabaseRequest = new Oci.Distributeddatabasev26Service.Requests.CreateDistributedDatabaseRequest
			{
				CreateDistributedDatabaseDetails = createDistributedDatabaseDetails,
				OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
				OpcRequestId = "VFKVEWXAWVVNUUEAGX5C<unique_ID>"
			};

            // 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. 
            var provider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");
            try
            {
                // Create a service client and send the request.
				using (var client = new DistributedDbServiceClient(provider, new ClientConfiguration()))
				{
					var response = await client.CreateDistributedDatabase(createDistributedDatabaseRequest);
					// Retrieve value from the response.
					var id = response.DistributedDatabase.Id;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"CreateDistributedDatabase Failed with {e.Message}");
                throw e;
            }
        }

    }
}