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

namespace Oci.Sdk.DotNet.Example.Databasemigration
{
    public class CreateMigrationExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var createMigrationDetails = new Oci.DatabasemigrationService.Models.CreateOracleMigrationDetails
			{
				MigrationSettings = new Oci.DatabasemigrationService.Models.CreateOracleOnlineLogicalMigrationSettings
				{
					DataTransferMediumDetails = new Oci.DatabasemigrationService.Models.CreateOracleDbLinkDataTransferMediumDetails
					{
						ObjectStorageBucket = new Oci.DatabasemigrationService.Models.CreateObjectStoreBucket
						{
							NamespaceName = "EXAMPLE-namespaceName-Value",
							BucketName = "EXAMPLE-bucketName-Value"
						},
						Name = "EXAMPLE-name-Value"
					},
					InitialLoadSettings = new Oci.DatabasemigrationService.Models.CreateOracleInitialLoadSettings
					{
						DataPumpParameters = new Oci.DatabasemigrationService.Models.CreateDataPumpParameters
						{
							IsCluster = true,
							Estimate = Oci.DatabasemigrationService.Models.DataPumpEstimate.Statistics,
							TableExistsAction = Oci.DatabasemigrationService.Models.DataPumpTableExistsAction.Append,
							ExcludeParameters = new List<Oci.DatabasemigrationService.Models.DataPumpExcludeParameters>
							{
								Oci.DatabasemigrationService.Models.DataPumpExcludeParameters.Index,
								Oci.DatabasemigrationService.Models.DataPumpExcludeParameters.MaterializedView,
								Oci.DatabasemigrationService.Models.DataPumpExcludeParameters.MaterializedViewLog
							},
							ImportParallelismDegree = 35,
							ExportParallelismDegree = 91
						},
						TablespaceDetails = new Oci.DatabasemigrationService.Models.CreateNonADBRemapTablespaceDetails
						{
							RemapTarget = "EXAMPLE-remapTarget-Value"
						},
						ExportDirectoryObject = new Oci.DatabasemigrationService.Models.CreateDirectoryObject
						{
							Name = "EXAMPLE-name-Value",
							Path = "EXAMPLE-path-Value"
						},
						ImportDirectoryObject = new Oci.DatabasemigrationService.Models.CreateDirectoryObject
						{
							Name = "EXAMPLE-name-Value",
							Path = "EXAMPLE-path-Value"
						},
						JobMode = Oci.DatabasemigrationService.Models.JobModeOracle.Full,
						MetadataRemaps = new List<Oci.DatabasemigrationService.Models.MetadataRemap>
						{
							new Oci.DatabasemigrationService.Models.MetadataRemap
							{
								Type = Oci.DatabasemigrationService.Models.MetadataRemap.TypeEnum.Tablespace,
								OldValue = "EXAMPLE-oldValue-Value",
								NewValue = "EXAMPLE-newValue-Value"
							}
						}
					},
					AdvisorSettings = new Oci.DatabasemigrationService.Models.CreateOracleAdvisorSettings
					{
						IsSkipAdvisor = false,
						IsIgnoreErrors = true
					},
					HubDetails = new Oci.DatabasemigrationService.Models.CreateGoldenGateHubDetails
					{
						RestAdminCredentials = new Oci.DatabasemigrationService.Models.CreateAdminCredentials
						{
							Username = "EXAMPLE-username-Value",
							Password = "EXAMPLE-password-Value"
						},
						Url = "EXAMPLE-url-Value",
						ComputeId = "ocid1.test.oc1..<unique_ID>EXAMPLE-computeId-Value",
						VaultId = "ocid1.test.oc1..<unique_ID>EXAMPLE-vaultId-Value",
						KeyId = "ocid1.test.oc1..<unique_ID>EXAMPLE-keyId-Value",
						Extract = new Oci.DatabasemigrationService.Models.CreateExtract
						{
							PerformanceProfile = Oci.DatabasemigrationService.Models.ExtractPerformanceProfile.Low,
							LongTransDuration = 585
						},
						Replicat = new Oci.DatabasemigrationService.Models.CreateReplicat
						{
							PerformanceProfile = Oci.DatabasemigrationService.Models.ReplicatPerformanceProfile.High
						},
						AcceptableLag = 19
					},
					GgsDetails = new Oci.DatabasemigrationService.Models.CreateOracleGgsDeploymentDetails
					{
						Extract = new Oci.DatabasemigrationService.Models.CreateExtract
						{
							PerformanceProfile = Oci.DatabasemigrationService.Models.ExtractPerformanceProfile.Medium,
							LongTransDuration = 911
						},
						Replicat = new Oci.DatabasemigrationService.Models.CreateReplicat
						{
							PerformanceProfile = Oci.DatabasemigrationService.Models.ReplicatPerformanceProfile.High
						},
						AcceptableLag = 4
					},
					AdvancedParameters = new List<Oci.DatabasemigrationService.Models.MigrationParameterDetails>
					{
						new Oci.DatabasemigrationService.Models.MigrationParameterDetails
						{
							Value = "EXAMPLE-value-Value",
							Name = "EXAMPLE-name-Value",
							DataType = Oci.DatabasemigrationService.Models.AdvancedParameterDataTypes.Boolean
						}
					},
					SourceContainerDatabaseConnectionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-sourceContainerDatabaseConnectionId-Value",
					ExcludeObjects = new List<Oci.DatabasemigrationService.Models.OracleDatabaseObject>
					{
						new Oci.DatabasemigrationService.Models.OracleDatabaseObject
						{
							Owner = "EXAMPLE-owner-Value",
							ObjectName = "EXAMPLE-objectName-Value",
							Type = "EXAMPLE-type-Value",
							IsOmitExcludedTableFromReplication = true
						}
					},
					IncludeObjects = new List<Oci.DatabasemigrationService.Models.OracleDatabaseObject>
					{
						new Oci.DatabasemigrationService.Models.OracleDatabaseObject
						{
							Owner = "EXAMPLE-owner-Value",
							ObjectName = "EXAMPLE-objectName-Value",
							Type = "EXAMPLE-type-Value",
							IsOmitExcludedTableFromReplication = true
						}
					},
					BulkIncludeExcludeData = "EXAMPLE-bulkIncludeExcludeData-Value"
				},
				DataTransferMediumDetails = new Oci.DatabasemigrationService.Models.CreateOracleObjectStorageDataTransferMediumDetails
				{
					ObjectStorageBucket = new Oci.DatabasemigrationService.Models.CreateObjectStoreBucket
					{
						NamespaceName = "EXAMPLE-namespaceName-Value",
						BucketName = "EXAMPLE-bucketName-Value"
					},
					Source = new Oci.DatabasemigrationService.Models.CurlTransferDetails
					{
						WalletLocation = "EXAMPLE-walletLocation-Value"
					},
					Target = new Oci.DatabasemigrationService.Models.CurlTransferDetails
					{
						WalletLocation = "EXAMPLE-walletLocation-Value"
					}
				},
				InitialLoadSettings = new Oci.DatabasemigrationService.Models.CreateOracleInitialLoadSettings
				{
					DataPumpParameters = new Oci.DatabasemigrationService.Models.CreateDataPumpParameters
					{
						IsCluster = false,
						Estimate = Oci.DatabasemigrationService.Models.DataPumpEstimate.Statistics,
						TableExistsAction = Oci.DatabasemigrationService.Models.DataPumpTableExistsAction.Truncate,
						ExcludeParameters = new List<Oci.DatabasemigrationService.Models.DataPumpExcludeParameters>
						{
							Oci.DatabasemigrationService.Models.DataPumpExcludeParameters.Index,
							Oci.DatabasemigrationService.Models.DataPumpExcludeParameters.MaterializedView,
							Oci.DatabasemigrationService.Models.DataPumpExcludeParameters.MaterializedViewLog
						},
						ImportParallelismDegree = 42,
						ExportParallelismDegree = 94
					},
					TablespaceDetails = new Oci.DatabasemigrationService.Models.CreateNonADBAutoCreateTablespaceDetails
					{
						IsAutoCreate = false,
						IsBigFile = false,
						ExtendSizeInMBs = 10593295,
						BlockSizeInKBs = Oci.DatabasemigrationService.Models.DataPumpTablespaceBlockSizesInKb.Size2K
					},
					ExportDirectoryObject = new Oci.DatabasemigrationService.Models.CreateDirectoryObject
					{
						Name = "EXAMPLE-name-Value",
						Path = "EXAMPLE-path-Value"
					},
					ImportDirectoryObject = new Oci.DatabasemigrationService.Models.CreateDirectoryObject
					{
						Name = "EXAMPLE-name-Value",
						Path = "EXAMPLE-path-Value"
					},
					JobMode = Oci.DatabasemigrationService.Models.JobModeOracle.Schema,
					MetadataRemaps = new List<Oci.DatabasemigrationService.Models.MetadataRemap>
					{
						new Oci.DatabasemigrationService.Models.MetadataRemap
						{
							Type = Oci.DatabasemigrationService.Models.MetadataRemap.TypeEnum.Tablespace,
							OldValue = "EXAMPLE-oldValue-Value",
							NewValue = "EXAMPLE-newValue-Value"
						}
					}
				},
				AdvisorSettings = new Oci.DatabasemigrationService.Models.CreateOracleAdvisorSettings
				{
					IsSkipAdvisor = false,
					IsIgnoreErrors = false
				},
				HubDetails = new Oci.DatabasemigrationService.Models.CreateGoldenGateHubDetails
				{
					RestAdminCredentials = new Oci.DatabasemigrationService.Models.CreateAdminCredentials
					{
						Username = "EXAMPLE-username-Value",
						Password = "EXAMPLE-password-Value"
					},
					Url = "EXAMPLE-url-Value",
					ComputeId = "ocid1.test.oc1..<unique_ID>EXAMPLE-computeId-Value",
					VaultId = "ocid1.test.oc1..<unique_ID>EXAMPLE-vaultId-Value",
					KeyId = "ocid1.test.oc1..<unique_ID>EXAMPLE-keyId-Value",
					Extract = new Oci.DatabasemigrationService.Models.CreateExtract
					{
						PerformanceProfile = Oci.DatabasemigrationService.Models.ExtractPerformanceProfile.Low,
						LongTransDuration = 167
					},
					Replicat = new Oci.DatabasemigrationService.Models.CreateReplicat
					{
						PerformanceProfile = Oci.DatabasemigrationService.Models.ReplicatPerformanceProfile.Low
					},
					AcceptableLag = 7
				},
				GgsDetails = new Oci.DatabasemigrationService.Models.CreateOracleGgsDeploymentDetails
				{
					Extract = new Oci.DatabasemigrationService.Models.CreateExtract
					{
						PerformanceProfile = Oci.DatabasemigrationService.Models.ExtractPerformanceProfile.Medium,
						LongTransDuration = 949
					},
					Replicat = new Oci.DatabasemigrationService.Models.CreateReplicat
					{
						PerformanceProfile = Oci.DatabasemigrationService.Models.ReplicatPerformanceProfile.High
					},
					AcceptableLag = 1
				},
				AdvancedParameters = new List<Oci.DatabasemigrationService.Models.MigrationParameterDetails>
				{
					new Oci.DatabasemigrationService.Models.MigrationParameterDetails
					{
						Value = "EXAMPLE-value-Value",
						Name = "EXAMPLE-name-Value",
						DataType = Oci.DatabasemigrationService.Models.AdvancedParameterDataTypes.String
					}
				},
				SourceContainerDatabaseConnectionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-sourceContainerDatabaseConnectionId-Value",
				SourceStandbyDatabaseConnectionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-sourceStandbyDatabaseConnectionId-Value",
				ExcludeObjects = new List<Oci.DatabasemigrationService.Models.OracleDatabaseObject>
				{
					new Oci.DatabasemigrationService.Models.OracleDatabaseObject
					{
						Owner = "EXAMPLE-owner-Value",
						ObjectName = "EXAMPLE-objectName-Value",
						Type = "EXAMPLE-type-Value",
						IsOmitExcludedTableFromReplication = true
					}
				},
				IncludeObjects = new List<Oci.DatabasemigrationService.Models.OracleDatabaseObject>
				{
					new Oci.DatabasemigrationService.Models.OracleDatabaseObject
					{
						Owner = "EXAMPLE-owner-Value",
						ObjectName = "EXAMPLE-objectName-Value",
						Type = "EXAMPLE-type-Value",
						IsOmitExcludedTableFromReplication = true
					}
				},
				BulkIncludeExcludeData = "EXAMPLE-bulkIncludeExcludeData-Value",
				Description = "EXAMPLE-description-Value",
				CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
				Type = Oci.DatabasemigrationService.Models.MigrationTypes.Offline,
				DisplayName = "EXAMPLE-displayName-Value",
				SourceDatabaseConnectionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-sourceDatabaseConnectionId-Value",
				TargetDatabaseConnectionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-targetDatabaseConnectionId-Value",
				FreeformTags = new Dictionary<string, string>()
				{
					{
						"EXAMPLE_KEY_ssDhe", 
						"EXAMPLE_VALUE_BEZfy8TO0oyONGQpohhQ"
					}
				},
				DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
				{
					{
						"EXAMPLE_KEY_Ig2Jl", 
						new Dictionary<string, Object>()
						{
							{
								"EXAMPLE_KEY_DpAqZ", 
								"EXAMPLE--Value"
							}
						}
					}
				},
				AssessmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-assessmentId-Value"
			};
			var createMigrationRequest = new Oci.DatabasemigrationService.Requests.CreateMigrationRequest
			{
				CreateMigrationDetails = createMigrationDetails,
				OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
				OpcRequestId = "LPNFLC1A1AB1QCBN5NKF<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 DatabaseMigrationClient(provider, new ClientConfiguration()))
				{
					var response = await client.CreateMigration(createMigrationRequest);
					// Retrieve value from the response.
					var id = response.Migration.Id;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"CreateMigration Failed with {e.Message}");
                throw e;
            }
        }

    }
}