// 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.DatabaseService;
using Oci.Common;
using Oci.Common.Auth;

namespace Oci.Sdk.DotNet.Example.Database
{
    public class LaunchDbSystemExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var launchDbSystemBase = new Oci.DatabaseService.Models.LaunchDbSystemDetails
			{
				DbHome = new Oci.DatabaseService.Models.CreateDbHomeDetails
				{
					DisplayName = "EXAMPLE-displayName-Value",
					DbVersion = "EXAMPLE-dbVersion-Value",
					DatabaseSoftwareImageId = "ocid1.test.oc1..<unique_ID>EXAMPLE-databaseSoftwareImageId-Value",
					Database = new Oci.DatabaseService.Models.CreateDatabaseDetails
					{
						DbName = "EXAMPLE-dbName-Value",
						DbUniqueName = "EXAMPLE-dbUniqueName-Value",
						DatabaseSoftwareImageId = "ocid1.test.oc1..<unique_ID>EXAMPLE-databaseSoftwareImageId-Value",
						PdbName = "EXAMPLE-pdbName-Value",
						AdminPassword = "EXAMPLE-adminPassword-Value",
						TdeWalletPassword = "EXAMPLE-tdeWalletPassword-Value",
						CharacterSet = "EXAMPLE-characterSet-Value",
						NcharacterSet = "EXAMPLE-ncharacterSet-Value",
						DbWorkload = Oci.DatabaseService.Models.CreateDatabaseDetails.DbWorkloadEnum.Oltp,
						DbBackupConfig = new Oci.DatabaseService.Models.DbBackupConfig
						{
							AutoBackupEnabled = false,
							RecoveryWindowInDays = 54,
							AutoBackupWindow = Oci.DatabaseService.Models.DbBackupConfig.AutoBackupWindowEnum.SlotFour,
							AutoFullBackupWindow = Oci.DatabaseService.Models.DbBackupConfig.AutoFullBackupWindowEnum.SlotSeven,
							AutoFullBackupDay = Oci.DatabaseService.Models.DbBackupConfig.AutoFullBackupDayEnum.Saturday,
							RunImmediateFullBackup = true,
							BackupDestinationDetails = new List<Oci.DatabaseService.Models.BackupDestinationDetails>
							{
								new Oci.DatabaseService.Models.BackupDestinationDetails
								{
									Type = Oci.DatabaseService.Models.BackupDestinationDetails.TypeEnum.Local,
									Id = "ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value",
									VpcUser = "EXAMPLE-vpcUser-Value",
									VpcPassword = "EXAMPLE-vpcPassword-Value",
									IsZeroDataLossEnabled = true,
									InternetProxy = "EXAMPLE-internetProxy-Value",
									DbrsPolicyId = "ocid1.test.oc1..<unique_ID>EXAMPLE-dbrsPolicyId-Value",
									IsRetentionLockEnabled = false,
									BackupRetentionPolicyOnTerminate = Oci.DatabaseService.Models.BackupDestinationDetails.BackupRetentionPolicyOnTerminateEnum.RetainPerRetentionWindow,
									IsRemote = false,
									RemoteRegion = "EXAMPLE-remoteRegion-Value"
								}
							},
							BackupDeletionPolicy = Oci.DatabaseService.Models.DbBackupConfig.BackupDeletionPolicyEnum.DeleteImmediately
						},
						FreeformTags = new Dictionary<string, string>()
						{
							{
								"EXAMPLE_KEY_QWltc", 
								"EXAMPLE_VALUE_DkYTEDeuwPBt2fTR6YG8"
							}
						},
						DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
						{
							{
								"EXAMPLE_KEY_sHNdL", 
								new Dictionary<string, Object>()
								{
									{
										"EXAMPLE_KEY_jIZe7", 
										"EXAMPLE--Value"
									}
								}
							}
						},
						KmsKeyId = "ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value",
						KmsKeyVersionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyVersionId-Value",
						VaultId = "ocid1.test.oc1..<unique_ID>EXAMPLE-vaultId-Value",
						SidPrefix = "EXAMPLE-sidPrefix-Value",
						KeyStoreId = "ocid1.test.oc1..<unique_ID>EXAMPLE-keyStoreId-Value",
						EncryptionKeyLocationDetails = new Oci.DatabaseService.Models.AzureEncryptionKeyDetails
						{
							AzureEncryptionKeyId = "ocid1.test.oc1..<unique_ID>EXAMPLE-azureEncryptionKeyId-Value"
						},
						StorageSizeDetails = new Oci.DatabaseService.Models.DatabaseStorageSizeDetails
						{
							DataStorageSizeInGBs = 661,
							RecoStorageSizeInGBs = 627
						}
					},
					FreeformTags = new Dictionary<string, string>()
					{
						{
							"EXAMPLE_KEY_Jfm4Y", 
							"EXAMPLE_VALUE_8mZeanEwc3Jc1rhhztgI"
						}
					},
					DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
					{
						{
							"EXAMPLE_KEY_TjgIw", 
							new Dictionary<string, Object>()
							{
								{
									"EXAMPLE_KEY_w6ylo", 
									"EXAMPLE--Value"
								}
							}
						}
					},
					IsUnifiedAuditingEnabled = true
				},
				DatabaseEdition = Oci.DatabaseService.Models.LaunchDbSystemDetails.DatabaseEditionEnum.StandardEdition,
				DiskRedundancy = Oci.DatabaseService.Models.LaunchDbSystemDetails.DiskRedundancyEnum.Normal,
				LicenseModel = Oci.DatabaseService.Models.LaunchDbSystemDetails.LicenseModelEnum.BringYourOwnLicense,
				MaintenanceWindowDetails = new Oci.DatabaseService.Models.MaintenanceWindow
				{
					Preference = Oci.DatabaseService.Models.MaintenanceWindow.PreferenceEnum.CustomPreference,
					PatchingMode = Oci.DatabaseService.Models.MaintenanceWindow.PatchingModeEnum.Rolling,
					IsCustomActionTimeoutEnabled = false,
					CustomActionTimeoutInMins = 85,
					IsMonthlyPatchingEnabled = true,
					Months = new List<Oci.DatabaseService.Models.Month>
					{
						new Oci.DatabaseService.Models.Month
						{
							Name = Oci.DatabaseService.Models.Month.NameEnum.January
						}
					},
					WeeksOfMonth = new List<Int32>
					{
						2
					},
					DaysOfWeek = new List<Oci.DatabaseService.Models.DayOfWeek>
					{
						new Oci.DatabaseService.Models.DayOfWeek
						{
							Name = Oci.DatabaseService.Models.DayOfWeek.NameEnum.Sunday
						}
					},
					HoursOfDay = new List<Int32>
					{
						16
					},
					LeadTimeInWeeks = 2,
					SkipRu = new List<Boolean>
					{
						true,
						false
					}
				},
				CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
				FaultDomains = new List<string>
				{
					"EXAMPLE--Value"
				},
				DisplayName = "EXAMPLE-displayName-Value",
				AvailabilityDomain = "EXAMPLE-availabilityDomain-Value",
				SubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
				BackupSubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-backupSubnetId-Value",
				NsgIds = new List<string>
				{
					"EXAMPLE--Value"
				},
				BackupNetworkNsgIds = new List<string>
				{
					"EXAMPLE--Value"
				},
				Shape = "EXAMPLE-shape-Value",
				TimeZone = "EXAMPLE-timeZone-Value",
				DbSystemOptions = new Oci.DatabaseService.Models.DbSystemOptions
				{
					StorageManagement = Oci.DatabaseService.Models.DbSystemOptions.StorageManagementEnum.Lvm
				},
				StorageVolumePerformanceMode = Oci.DatabaseService.Models.LaunchDbSystemBase.StorageVolumePerformanceModeEnum.Balanced,
				SparseDiskgroup = true,
				SshPublicKeys = new List<string>
				{
					"EXAMPLE--Value"
				},
				Hostname = "EXAMPLE-hostname-Value",
				Domain = "EXAMPLE-domain-Value",
				CpuCoreCount = 251,
				ClusterName = "EXAMPLE-clusterName-Value",
				DataStoragePercentage = 926,
				InitialDataStorageSizeInGB = 85,
				KmsKeyId = "ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value",
				KmsKeyVersionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyVersionId-Value",
				NodeCount = 311,
				FreeformTags = new Dictionary<string, string>()
				{
					{
						"EXAMPLE_KEY_AB8tH", 
						"EXAMPLE_VALUE_mWkVSxK0LCGg9KOW70fP"
					}
				},
				DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
				{
					{
						"EXAMPLE_KEY_oec0G", 
						new Dictionary<string, Object>()
						{
							{
								"EXAMPLE_KEY_qzUXA", 
								"EXAMPLE--Value"
							}
						}
					}
				},
				SecurityAttributes = new Dictionary<string, Dictionary<string, Object>>()
				{
					{
						"EXAMPLE_KEY_z7oRf", 
						new Dictionary<string, Object>()
						{
							{
								"EXAMPLE_KEY_WTL74", 
								"EXAMPLE--Value"
							}
						}
					}
				},
				PrivateIp = "EXAMPLE-privateIp-Value",
				PrivateIpV6 = "EXAMPLE-privateIpV6-Value",
				ClusterPlacementGroupId = "ocid1.test.oc1..<unique_ID>EXAMPLE-clusterPlacementGroupId-Value",
				SubscriptionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subscriptionId-Value",
				DataCollectionOptions = new Oci.DatabaseService.Models.DataCollectionOptions
				{
					IsDiagnosticsEventsEnabled = true,
					IsHealthMonitoringEnabled = true,
					IsIncidentLogsEnabled = false
				},
				ComputeModel = Oci.DatabaseService.Models.LaunchDbSystemBase.ComputeModelEnum.Ecpu,
				ComputeCount = 476
			};
			var launchDbSystemRequest = new Oci.DatabaseService.Requests.LaunchDbSystemRequest
			{
				LaunchDbSystemDetails = launchDbSystemBase,
				OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
				OpcDryRun = false
			};

            // 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 DatabaseClient(provider, new ClientConfiguration()))
				{
					var response = await client.LaunchDbSystem(launchDbSystemRequest);
					// Retrieve value from the response.
					var id = response.DbSystem.Id;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"LaunchDbSystem Failed with {e.Message}");
                throw e;
            }
        }

    }
}