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

namespace Oci.Sdk.DotNet.Example.Mysql
{
    public class UpdateDbSystemExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var updateDbSystemDetails = new Oci.MysqlService.Models.UpdateDbSystemDetails
			{
				DisplayName = "EXAMPLE-displayName-Value",
				Description = "EXAMPLE-description-Value",
				SubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
				NsgIds = new List<string>
				{
					"EXAMPLE--Value"
				},
				SecurityAttributes = new Dictionary<string, Dictionary<string, Object>>()
				{
					{
						"EXAMPLE_KEY_ErHG4", 
						new Dictionary<string, Object>()
						{
							{
								"EXAMPLE_KEY_yKZuu", 
								"EXAMPLE--Value"
							}
						}
					}
				},
				DatabaseMode = Oci.MysqlService.Models.DbSystem.DatabaseModeEnum.ReadWrite,
				AccessMode = Oci.MysqlService.Models.DbSystem.AccessModeEnum.Unrestricted,
				Rest = new Oci.MysqlService.Models.UpdateRestDetails
				{
					Configuration = Oci.MysqlService.Models.RestConfigurationType.DbsystemOnly,
					Port = 24752
				},
				DatabaseConsole = new Oci.MysqlService.Models.UpdateDatabaseConsoleDetails
				{
					Status = Oci.MysqlService.Models.DatabaseConsoleStatus.Enabled,
					Port = 31087
				},
				IsHighlyAvailable = true,
				AvailabilityDomain = "EXAMPLE-availabilityDomain-Value",
				FaultDomain = "EXAMPLE-faultDomain-Value",
				ShapeName = "EXAMPLE-shapeName-Value",
				MysqlVersion = "EXAMPLE-mysqlVersion-Value",
				ConfigurationId = "ocid1.test.oc1..<unique_ID>EXAMPLE-configurationId-Value",
				AdminUsername = "EXAMPLE-adminUsername-Value",
				AdminPassword = "EXAMPLE-adminPassword-Value",
				DataStorageSizeInGBs = 15399,
				DataStorage = new Oci.MysqlService.Models.DataStorageDetails
				{
					IsAutoExpandStorageEnabled = false,
					MaxStorageSizeInGBs = 104204
				},
				HostnameLabel = "EXAMPLE-hostnameLabel-Value",
				IpAddress = "EXAMPLE-ipAddress-Value",
				IsIpv6Enabled = false,
				Ipv6AddressIpv6SubnetCidrPairDetails = new Oci.MysqlService.Models.Ipv6AddressIpv6SubnetCidrPairDetails
				{
					Ipv6SubnetCidr = "EXAMPLE-ipv6SubnetCidr-Value",
					Ipv6Address = "EXAMPLE-ipv6Address-Value"
				},
				Port = 56668,
				PortX = 34123,
				BackupPolicy = new Oci.MysqlService.Models.UpdateBackupPolicyDetails
				{
					IsEnabled = false,
					SoftDelete = Oci.MysqlService.Models.SoftDelete.Enabled,
					CopyPolicies = new List<Oci.MysqlService.Models.CopyPolicy>
					{
						new Oci.MysqlService.Models.CopyPolicy
						{
							CopyToRegion = "EXAMPLE-copyToRegion-Value",
							BackupCopyRetentionInDays = 11
						}
					},
					WindowStartTime = "EXAMPLE-windowStartTime-Value",
					RetentionInDays = 6,
					FreeformTags = new Dictionary<string, string>()
					{
						{
							"EXAMPLE_KEY_2zv35", 
							"EXAMPLE_VALUE_1ft8Wme3SdDuuZ32C8J7"
						}
					},
					DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
					{
						{
							"EXAMPLE_KEY_gNhNk", 
							new Dictionary<string, Object>()
							{
								{
									"EXAMPLE_KEY_HNfTg", 
									"EXAMPLE--Value"
								}
							}
						}
					},
					PitrPolicy = new Oci.MysqlService.Models.PitrPolicy
					{
						IsEnabled = false
					}
				},
				Maintenance = new Oci.MysqlService.Models.UpdateMaintenanceDetails
				{
					WindowStartTime = "EXAMPLE-windowStartTime-Value",
					VersionPreference = Oci.MysqlService.Models.VersionPreference.SecondNewest,
					VersionTrackPreference = Oci.MysqlService.Models.VersionTrackPreference.LongTermSupport,
					MaintenanceScheduleType = Oci.MysqlService.Models.MaintenanceScheduleType.Early,
					MaintenanceDisabledWindows = new List<Oci.MysqlService.Models.MaintenanceDisabledWindow>
					{
						new Oci.MysqlService.Models.MaintenanceDisabledWindow
						{
							TimeStart = DateTime.Parse("04/03/2004 07:40:25"),
							TimeEnd = DateTime.Parse("07/22/2022 19:20:12")
						}
					}
				},
				FreeformTags = new Dictionary<string, string>()
				{
					{
						"EXAMPLE_KEY_bEqvg", 
						"EXAMPLE_VALUE_CyWaoMeTVQK3TkPndzOE"
					}
				},
				DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
				{
					{
						"EXAMPLE_KEY_WjUkQ", 
						new Dictionary<string, Object>()
						{
							{
								"EXAMPLE_KEY_qSCHH", 
								"EXAMPLE--Value"
							}
						}
					}
				},
				DeletionPolicy = new Oci.MysqlService.Models.UpdateDeletionPolicyDetails
				{
					AutomaticBackupRetention = Oci.MysqlService.Models.UpdateDeletionPolicyDetails.AutomaticBackupRetentionEnum.Delete,
					FinalBackup = Oci.MysqlService.Models.UpdateDeletionPolicyDetails.FinalBackupEnum.RequireFinalBackup,
					IsDeleteProtected = false
				},
				CrashRecovery = Oci.MysqlService.Models.CrashRecoveryStatus.Disabled,
				DatabaseManagement = Oci.MysqlService.Models.DatabaseManagementStatus.Disabled,
				SecureConnections = new Oci.MysqlService.Models.SecureConnectionDetails
				{
					CertificateId = "ocid1.test.oc1..<unique_ID>EXAMPLE-certificateId-Value",
					CertificateGenerationType = Oci.MysqlService.Models.CertificateGenerationType.System
				},
				EncryptData = new Oci.MysqlService.Models.EncryptDataDetails
				{
					KeyId = "ocid1.test.oc1..<unique_ID>EXAMPLE-keyId-Value",
					KeyGenerationType = Oci.MysqlService.Models.KeyGenerationType.Byok
				},
				CustomerContacts = new List<Oci.MysqlService.Models.CustomerContact>
				{
					new Oci.MysqlService.Models.CustomerContact
					{
						Email = "EXAMPLE-email-Value"
					}
				},
				ReadEndpoint = new Oci.MysqlService.Models.UpdateReadEndpointDetails
				{
					IsEnabled = false,
					ReadEndpointIpAddress = "EXAMPLE-readEndpointIpAddress-Value",
					ReadEndpointIpv6AddressIpv6SubnetCidrPairDetails = new Oci.MysqlService.Models.Ipv6AddressIpv6SubnetCidrPairDetails
					{
						Ipv6SubnetCidr = "EXAMPLE-ipv6SubnetCidr-Value",
						Ipv6Address = "EXAMPLE-ipv6Address-Value"
					},
					ReadEndpointHostnameLabel = "EXAMPLE-readEndpointHostnameLabel-Value",
					ExcludeIps = new List<string>
					{
						"EXAMPLE--Value"
					}
				},
				TelemetryConfiguration = new Oci.MysqlService.Models.UpdateTelemetryConfigurationDetails
				{
					Logs = new List<Oci.MysqlService.Models.LoggingDestinationConfiguration>
					{
						new Oci.MysqlService.Models.LoggingDestinationConfiguration
						{
							Destination = Oci.MysqlService.Models.LoggingDestinationConfiguration.DestinationEnum.OpenTelemetry,
							DestinationConfigurations = new List<Oci.MysqlService.Models.DestinationConfiguration>
							{
								new Oci.MysqlService.Models.DestinationConfiguration
								{
									Key = "EXAMPLE-key-Value",
									Value = "EXAMPLE-value-Value"
								}
							},
							LogTypes = new List<Oci.MysqlService.Models.LoggingDestinationConfiguration.LogTypesEnum>
							{
								Oci.MysqlService.Models.LoggingDestinationConfiguration.LogTypesEnum.GeneralLog
							}
						}
					}
				}
			};
			var updateDbSystemRequest = new Oci.MysqlService.Requests.UpdateDbSystemRequest
			{
				DbSystemId = "ocid1.test.oc1..<unique_ID>EXAMPLE-dbSystemId-Value",
				UpdateDbSystemDetails = updateDbSystemDetails,
				IfMatch = "EXAMPLE-ifMatch-Value",
				OpcRequestId = "L9BAQPECKJYS52Z8GQPW<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 DbSystemClient(provider, new ClientConfiguration()))
				{
					var response = await client.UpdateDbSystem(updateDbSystemRequest);
					// Retrieve value from the response.
					var versionValue = response.httpResponseMessage.Version;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"UpdateDbSystem Failed with {e.Message}");
                throw e;
            }
        }

    }
}