// 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 UpdateMigrationExample
{
public static async Task Main()
{
// Create a request and dependent object(s).
var updateMigrationDetails = new Oci.DatabasemigrationService.Models.UpdateMySqlMigrationDetails
{
DataTransferMediumDetails = new Oci.DatabasemigrationService.Models.UpdateMySqlObjectStorageDataTransferMediumDetails
{
ObjectStorageBucket = new Oci.DatabasemigrationService.Models.UpdateObjectStoreBucket
{
NamespaceName = "EXAMPLE-namespaceName-Value",
BucketName = "EXAMPLE-bucketName-Value"
}
},
InitialLoadSettings = new Oci.DatabasemigrationService.Models.UpdateMySqlInitialLoadSettings
{
IsConsistent = true,
IsTzUtc = false,
Compatibility = new List<Oci.DatabasemigrationService.Models.CompatibilityOption>
{
Oci.DatabasemigrationService.Models.CompatibilityOption.ForceInnodb,
Oci.DatabasemigrationService.Models.CompatibilityOption.SkipInvalidAccounts,
Oci.DatabasemigrationService.Models.CompatibilityOption.StripDefiners,
Oci.DatabasemigrationService.Models.CompatibilityOption.StripRestrictedGrants,
Oci.DatabasemigrationService.Models.CompatibilityOption.StripTablespaces,
Oci.DatabasemigrationService.Models.CompatibilityOption.IgnoreWildcardGrants,
Oci.DatabasemigrationService.Models.CompatibilityOption.StripInvalidGrants
},
PrimaryKeyCompatibility = Oci.DatabasemigrationService.Models.PrimaryKeyCompatibility.CreateInvisiblePks,
IsIgnoreExistingObjects = true,
HandleGrantErrors = Oci.DatabasemigrationService.Models.HandleGrantErrors.Abort,
JobMode = Oci.DatabasemigrationService.Models.JobModeMySql.Schema
},
AdvisorSettings = new Oci.DatabasemigrationService.Models.UpdateMySqlAdvisorSettings
{
IsSkipAdvisor = true,
IsIgnoreErrors = false
},
HubDetails = new Oci.DatabasemigrationService.Models.UpdateGoldenGateHubDetails
{
RestAdminCredentials = new Oci.DatabasemigrationService.Models.UpdateAdminCredentials
{
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.UpdateExtract
{
PerformanceProfile = Oci.DatabasemigrationService.Models.ExtractPerformanceProfile.Low,
LongTransDuration = 875
},
Replicat = new Oci.DatabasemigrationService.Models.UpdateReplicat
{
PerformanceProfile = Oci.DatabasemigrationService.Models.ReplicatPerformanceProfile.Low
},
AcceptableLag = 23
},
GgsDetails = new Oci.DatabasemigrationService.Models.UpdateMySqlGgsDeploymentDetails
{
Replicat = new Oci.DatabasemigrationService.Models.UpdateReplicat
{
PerformanceProfile = Oci.DatabasemigrationService.Models.ReplicatPerformanceProfile.Low
},
AcceptableLag = 16
},
Description = "EXAMPLE-description-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_HPext",
"EXAMPLE_VALUE_hdzRBHrqUvL3gBT47I2j"
}
},
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_2FnrA",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_0tK76",
"EXAMPLE--Value"
}
}
}
}
};
var updateMigrationRequest = new Oci.DatabasemigrationService.Requests.UpdateMigrationRequest
{
MigrationId = "ocid1.test.oc1..<unique_ID>EXAMPLE-migrationId-Value",
UpdateMigrationDetails = updateMigrationDetails,
OpcRequestId = "VXQMIDIRIUXBGNRUWMBY<unique_ID>",
IfMatch = "EXAMPLE-ifMatch-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 DatabaseMigrationClient(provider, new ClientConfiguration()))
{
var response = await client.UpdateMigration(updateMigrationRequest);
// Retrieve value from the response.
var versionValue = response.httpResponseMessage.Version;
}
}
catch (Exception e)
{
Console.WriteLine($"UpdateMigration Failed with {e.Message}");
throw e;
}
}
}
}