// 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.Truncate
},
ReplicateSchemaChange = new Oci.GoldengateService.Models.ReplicateSchemaChange
{
CanReplicateSchemaChange = Oci.GoldengateService.Models.ReplicateSchemaChange.CanReplicateSchemaChangeEnum.Enabled,
ActionOnDdlError = Oci.GoldengateService.Models.ReplicateDdlErrorAction.Ignore,
ActionOnDmlError = Oci.GoldengateService.Models.ReplicateDmlErrorAction.Terminate
},
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.LicenseIncluded,
FreeformTags = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_58RcX",
"EXAMPLE_VALUE_AylHJPrAy25Flg64brfi"
}
},
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_tyBcy",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_dnWS7",
"EXAMPLE--Value"
}
}
}
},
Locks = new List<Oci.GoldengateService.Models.ResourceLock>
{
new Oci.GoldengateService.Models.ResourceLock
{
Type = Oci.GoldengateService.Models.ResourceLock.TypeEnum.Full,
RelatedResourceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-relatedResourceId-Value",
Message = "EXAMPLE-message-Value",
TimeCreated = DateTime.Parse("08/05/2027 17:20:33")
}
},
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"
}
};
var createPipelineRequest = new Oci.GoldengateService.Requests.CreatePipelineRequest
{
CreatePipelineDetails = createPipelineDetails,
OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
OpcRequestId = "HWQD9X8VXKW5SVDCLKL4<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;
}
}
}
}