// 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 CreateReplicaExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var createReplicaDetails = new Oci.MysqlService.Models.CreateReplicaDetails
			{
				DbSystemId = "ocid1.test.oc1..<unique_ID>EXAMPLE-dbSystemId-Value",
				DisplayName = "EXAMPLE-displayName-Value",
				Description = "EXAMPLE-description-Value",
				FreeformTags = new Dictionary<string, string>()
				{
					{
						"EXAMPLE_KEY_5X9m6", 
						"EXAMPLE_VALUE_5yQNMRaRVCXBrjxwq2uY"
					}
				},
				DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
				{
					{
						"EXAMPLE_KEY_QwOPM", 
						new Dictionary<string, Object>()
						{
							{
								"EXAMPLE_KEY_dAgkv", 
								"EXAMPLE--Value"
							}
						}
					}
				},
				IsDeleteProtected = true,
				ReplicaOverrides = new Oci.MysqlService.Models.ReplicaOverrides
				{
					MysqlVersion = "EXAMPLE-mysqlVersion-Value",
					ShapeName = "EXAMPLE-shapeName-Value",
					ConfigurationId = "ocid1.test.oc1..<unique_ID>EXAMPLE-configurationId-Value",
					NsgIds = new List<string>
					{
						"EXAMPLE--Value"
					},
					SecurityAttributes = new Dictionary<string, Dictionary<string, Object>>()
					{
						{
							"EXAMPLE_KEY_YZA2C", 
							new Dictionary<string, Object>()
							{
								{
									"EXAMPLE_KEY_L2VYL", 
									"EXAMPLE--Value"
								}
							}
						}
					},
					TelemetryConfiguration = new Oci.MysqlService.Models.TelemetryConfigurationDetails
					{
						Logs = new List<Oci.MysqlService.Models.LoggingDestinationConfiguration>
						{
							new Oci.MysqlService.Models.LoggingDestinationConfiguration
							{
								Destination = Oci.MysqlService.Models.LoggingDestinationConfiguration.DestinationEnum.LogAnalytics,
								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.ErrorLog
								}
							}
						}
					}
				}
			};
			var createReplicaRequest = new Oci.MysqlService.Requests.CreateReplicaRequest
			{
				CreateReplicaDetails = createReplicaDetails,
				OpcRequestId = "7PISYOAAFAIF7QM9RAKS<unique_ID>",
				OpcRetryToken = "EXAMPLE-opcRetryToken-Value"
			};

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

    }
}