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

namespace Oci.Sdk.DotNet.Example.Goldengate
{
    public class CreatePipelineExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var createPipelineDetails = new Oci.GoldengateService.Models.CreateZeroEtlPipelineDetails
			{
				ProcessOptions = new Oci.GoldengateService.Models.ProcessOptions
				{
					InitialDataLoad = new Oci.GoldengateService.Models.InitialDataLoad
					{
						IsInitialLoad = Oci.GoldengateService.Models.InitialDataLoad.IsInitialLoadEnum.Disabled,
						ActionOnExistingTable = Oci.GoldengateService.Models.InitialLoadAction.Append,
						InitialLoadType = Oci.GoldengateService.Models.InitialDataLoad.InitialLoadTypeEnum.ObjectStorage,
						AdbWalletPath = "EXAMPLE-adbWalletPath-Value",
						SourceWalletPath = "EXAMPLE-sourceWalletPath-Value",
						TargetWalletPath = "EXAMPLE-targetWalletPath-Value",
						NamespaceName = "EXAMPLE-namespaceName-Value",
						BucketName = "EXAMPLE-bucketName-Value"
					},
					ReplicateSchemaChange = new Oci.GoldengateService.Models.ReplicateSchemaChange
					{
						CanReplicateSchemaChange = Oci.GoldengateService.Models.ReplicateSchemaChange.CanReplicateSchemaChangeEnum.Enabled,
						ActionOnDdlError = Oci.GoldengateService.Models.ReplicateDdlErrorAction.Terminate,
						ActionOnDmlError = Oci.GoldengateService.Models.ReplicateDmlErrorAction.Discard
					},
					ShouldRestartOnFailure = Oci.GoldengateService.Models.ProcessOptions.ShouldRestartOnFailureEnum.Enabled,
					StartUsingDefaultMapping = Oci.GoldengateService.Models.ProcessOptions.StartUsingDefaultMappingEnum.Enabled
				},
				DisplayName = "EXAMPLE-displayName-Value",
				Description = "EXAMPLE-description-Value",
				CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
				LicenseModel = Oci.GoldengateService.Models.LicenseModel.BringYourOwnLicense,
				FreeformTags = new Dictionary<string, string>()
				{
					{
						"EXAMPLE_KEY_jRBDu", 
						"EXAMPLE_VALUE_5W4Y8FrDw5JFXlEZ5ICn"
					}
				},
				DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
				{
					{
						"EXAMPLE_KEY_rKgjj", 
						new Dictionary<string, Object>()
						{
							{
								"EXAMPLE_KEY_RMRI5", 
								"EXAMPLE--Value"
							}
						}
					}
				},
				Locks = new List<Oci.GoldengateService.Models.ResourceLock>
				{
					new Oci.GoldengateService.Models.ResourceLock
					{
						Type = Oci.GoldengateService.Models.ResourceLock.TypeEnum.Delete,
						RelatedResourceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-relatedResourceId-Value",
						Message = "EXAMPLE-message-Value",
						TimeCreated = DateTime.Parse("04/14/2005 16:09:46")
					}
				},
				SourceConnectionDetails = new Oci.GoldengateService.Models.SourcePipelineConnectionDetails
				{
					ConnectionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-connectionId-Value"
				},
				TargetConnectionDetails = new Oci.GoldengateService.Models.TargetPipelineConnectionDetails
				{
					ConnectionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-connectionId-Value"
				},
				SubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
				CpuCoreCount = 6,
				IsAutoScalingEnabled = true
			};
			var createPipelineRequest = new Oci.GoldengateService.Requests.CreatePipelineRequest
			{
				CreatePipelineDetails = createPipelineDetails,
				OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
				OpcRequestId = "NQ2N6ZWGBHESVR5Y8ES8<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 GoldenGateClient(provider, new ClientConfiguration()))
				{
					var response = await client.CreatePipeline(createPipelineRequest);
					// Retrieve value from the response.
					var id = response.Pipeline.Id;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"CreatePipeline Failed with {e.Message}");
                throw e;
            }
        }

    }
}