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

namespace Oci.Sdk.DotNet.Example.Dataintegration
{
    public class CreateExternalPublicationExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var createExternalPublicationDetails = new Oci.DataintegrationService.Models.CreateExternalPublicationDetails
			{
				ApplicationId = "ocid1.test.oc1..<unique_ID>EXAMPLE-applicationId-Value",
				ApplicationCompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-applicationCompartmentId-Value",
				DisplayName = "EXAMPLE-displayName-Value",
				Description = "EXAMPLE-description-Value",
				ResourceConfiguration = new Oci.DataintegrationService.Models.ResourceConfiguration
				{
					SparkVersion = "EXAMPLE-sparkVersion-Value",
					DriverShape = "EXAMPLE-driverShape-Value",
					ExecutorShape = "EXAMPLE-executorShape-Value",
					TotalExecutors = 239
				},
				ConfigurationDetails = new Oci.DataintegrationService.Models.ConfigurationDetails
				{
					DataAsset = new Oci.DataintegrationService.Models.DataAssetFromMySqlHeatWave
					{
						Host = "EXAMPLE-host-Value",
						Port = "EXAMPLE-port-Value",
						ServiceName = "EXAMPLE-serviceName-Value",
						DefaultConnection = new Oci.DataintegrationService.Models.ConnectionFromMySqlHeatWaveDetails
						{
							Username = "EXAMPLE-username-Value",
							Password = "EXAMPLE-password-Value",
							PasswordSecret = new Oci.DataintegrationService.Models.SensitiveAttribute
							{
								SecretConfig = new Oci.DataintegrationService.Models.OciVaultSecretConfig
								{
									SecretId = "ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value"
								},
								Value = "EXAMPLE-value-Value"
							},
							Key = "EXAMPLE-key-Value",
							ModelVersion = "EXAMPLE-modelVersion-Value",
							ParentRef = new Oci.DataintegrationService.Models.ParentReference
							{
								Parent = "EXAMPLE-parent-Value",
								RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
							},
							Name = "EXAMPLE-name-Value",
							Description = "EXAMPLE-description-Value",
							ObjectVersion = 721,
							ObjectStatus = 274,
							Identifier = "EXAMPLE-identifier-Value",
							PrimarySchema = new Oci.DataintegrationService.Models.Schema
							{
								Key = "EXAMPLE-key-Value",
								ModelType = "EXAMPLE-modelType-Value",
								ModelVersion = "EXAMPLE-modelVersion-Value",
								ParentRef = new Oci.DataintegrationService.Models.ParentReference
								{
									Parent = "EXAMPLE-parent-Value",
									RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
								},
								Name = "EXAMPLE-name-Value",
								ResourceName = "EXAMPLE-resourceName-Value",
								Description = "EXAMPLE-description-Value",
								ObjectVersion = 946,
								ExternalKey = "EXAMPLE-externalKey-Value",
								IsHasContainers = true,
								DefaultConnection = "EXAMPLE-defaultConnection-Value",
								ObjectStatus = 578,
								Identifier = "EXAMPLE-identifier-Value",
								Metadata = new Oci.DataintegrationService.Models.ObjectMetadata
								{
									CreatedBy = "EXAMPLE-createdBy-Value",
									CreatedByName = "EXAMPLE-createdByName-Value",
									UpdatedBy = "EXAMPLE-updatedBy-Value",
									UpdatedByName = "EXAMPLE-updatedByName-Value",
									TimeCreated = DateTime.Parse("12/03/2048 00:26:36"),
									TimeUpdated = DateTime.Parse("06/28/2012 11:57:14"),
									AggregatorKey = "EXAMPLE-aggregatorKey-Value",
									Aggregator = new Oci.DataintegrationService.Models.AggregatorSummary
									{
										Type = "EXAMPLE-type-Value",
										Key = "EXAMPLE-key-Value",
										Name = "EXAMPLE-name-Value",
										Identifier = "EXAMPLE-identifier-Value",
										Description = "EXAMPLE-description-Value"
									},
									IdentifierPath = "EXAMPLE-identifierPath-Value",
									InfoFields = new Dictionary<string, string>()
									{
										{
											"EXAMPLE_KEY_gErdz", 
											"EXAMPLE_VALUE_gvMYPvBEJ2SgdjCSIF7V"
										}
									},
									RegistryVersion = 110,
									Labels = new List<string>
									{
										"EXAMPLE--Value"
									},
									IsFavorite = false,
									CountStatistics = new Oci.DataintegrationService.Models.CountStatistic
									{
										ObjectTypeCountList = new List<Oci.DataintegrationService.Models.CountStatisticSummary>
										{
											new Oci.DataintegrationService.Models.CountStatisticSummary
											{
												ObjectType = Oci.DataintegrationService.Models.CountStatisticSummary.ObjectTypeEnum.UserDefinedFunction,
												ObjectCount = 867
											}
										}
									}
								}
							},
							ConnectionProperties = new List<Oci.DataintegrationService.Models.ConnectionProperty>
							{
								new Oci.DataintegrationService.Models.ConnectionProperty
								{
									Name = "EXAMPLE-name-Value",
									Value = "EXAMPLE-value-Value"
								}
							},
							IsDefault = false,
							Metadata = new Oci.DataintegrationService.Models.ObjectMetadata
							{
								CreatedBy = "EXAMPLE-createdBy-Value",
								CreatedByName = "EXAMPLE-createdByName-Value",
								UpdatedBy = "EXAMPLE-updatedBy-Value",
								UpdatedByName = "EXAMPLE-updatedByName-Value",
								TimeCreated = DateTime.Parse("06/06/2046 23:00:14"),
								TimeUpdated = DateTime.Parse("07/27/2039 05:05:21"),
								AggregatorKey = "EXAMPLE-aggregatorKey-Value",
								Aggregator = new Oci.DataintegrationService.Models.AggregatorSummary
								{
									Type = "EXAMPLE-type-Value",
									Key = "EXAMPLE-key-Value",
									Name = "EXAMPLE-name-Value",
									Identifier = "EXAMPLE-identifier-Value",
									Description = "EXAMPLE-description-Value"
								},
								IdentifierPath = "EXAMPLE-identifierPath-Value",
								InfoFields = new Dictionary<string, string>()
								{
									{
										"EXAMPLE_KEY_R93m2", 
										"EXAMPLE_VALUE_I6wUiqqk4F6ItV5d9jid"
									}
								},
								RegistryVersion = 830,
								Labels = new List<string>
								{
									"EXAMPLE--Value"
								},
								IsFavorite = true,
								CountStatistics = new Oci.DataintegrationService.Models.CountStatistic
								{
									ObjectTypeCountList = new List<Oci.DataintegrationService.Models.CountStatisticSummary>
									{
										new Oci.DataintegrationService.Models.CountStatisticSummary
										{
											ObjectType = Oci.DataintegrationService.Models.CountStatisticSummary.ObjectTypeEnum.DataAsset,
											ObjectCount = 335
										}
									}
								}
							}
						},
						Key = "EXAMPLE-key-Value",
						ModelVersion = "EXAMPLE-modelVersion-Value",
						Name = "EXAMPLE-name-Value",
						Description = "EXAMPLE-description-Value",
						ObjectStatus = 289,
						Identifier = "EXAMPLE-identifier-Value",
						ExternalKey = "EXAMPLE-externalKey-Value",
						AssetProperties = new Dictionary<string, string>()
						{
							{
								"EXAMPLE_KEY_ovMuw", 
								"EXAMPLE_VALUE_zaQ7zOkWGzs36Z4tFUoB"
							}
						},
						NativeTypeSystem = new Oci.DataintegrationService.Models.TypeSystem
						{
							Key = "EXAMPLE-key-Value",
							ModelType = "EXAMPLE-modelType-Value",
							ModelVersion = "EXAMPLE-modelVersion-Value",
							ParentRef = new Oci.DataintegrationService.Models.ParentReference
							{
								Parent = "EXAMPLE-parent-Value",
								RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
							},
							Name = "EXAMPLE-name-Value",
							Description = "EXAMPLE-description-Value",
							ObjectVersion = 783,
							TypeMappingTo = new Dictionary<string, string>()
							{
								{
									"EXAMPLE_KEY_C6hsk", 
									"EXAMPLE_VALUE_CzQhWU2QCUDfv3pd5MYH"
								}
							},
							TypeMappingFrom = new Dictionary<string, string>()
							{
								{
									"EXAMPLE_KEY_RU5Bt", 
									"EXAMPLE_VALUE_1yZCB9JpOQFaXSLbdNke"
								}
							},
							ObjectStatus = 231,
							Identifier = "EXAMPLE-identifier-Value",
							Types = new List<Oci.DataintegrationService.Models.DataType>
							{
								new Oci.DataintegrationService.Models.DataType
								{
									DtType = Oci.DataintegrationService.Models.DataType.DtTypeEnum.Primitive,
									TypeSystemName = "EXAMPLE-typeSystemName-Value",
									ConfigDefinition = new Oci.DataintegrationService.Models.ConfigDefinition
									{
										Key = "EXAMPLE-key-Value",
										ModelType = "EXAMPLE-modelType-Value",
										ModelVersion = "EXAMPLE-modelVersion-Value",
										ParentRef = new Oci.DataintegrationService.Models.ParentReference
										{
											Parent = "EXAMPLE-parent-Value",
											RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
										},
										Name = "EXAMPLE-name-Value",
										IsContained = false,
										ObjectStatus = 684,
										ConfigParameterDefinitions = new Dictionary<string, Oci.DataintegrationService.Models.ConfigParameterDefinition>()
										{
											{
												"EXAMPLE_KEY_94Pk3", 
												new Oci.DataintegrationService.Models.ConfigParameterDefinition
												{
													ParameterType = new Oci.DataintegrationService.Models.MaterializedCompositeType
													{
														Elements = new List<string>
														{
															"EXAMPLE--Value"
														},
														PathNames = new List<string>
														{
															"EXAMPLE--Value"
														},
														Key = "EXAMPLE-key-Value",
														ModelVersion = "EXAMPLE-modelVersion-Value",
														ParentRef = new Oci.DataintegrationService.Models.ParentReference
														{
															Parent = "EXAMPLE-parent-Value",
															RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
														},
														Name = "EXAMPLE-name-Value",
														ObjectStatus = 44,
														Description = "EXAMPLE-description-Value"
													},
													ParameterName = "EXAMPLE-parameterName-Value",
													Description = "EXAMPLE-description-Value",
													DefaultValue = "EXAMPLE-defaultValue-Value",
													ClassFieldName = "EXAMPLE-classFieldName-Value",
													IsStatic = true,
													IsClassFieldValue = false
												}
											}
										}
									},
									Key = "EXAMPLE-key-Value",
									ModelVersion = "EXAMPLE-modelVersion-Value",
									ParentRef = new Oci.DataintegrationService.Models.ParentReference
									{
										Parent = "EXAMPLE-parent-Value",
										RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
									},
									Name = "EXAMPLE-name-Value",
									ObjectStatus = 647,
									Description = "EXAMPLE-description-Value"
								}
							}
						},
						ObjectVersion = 955,
						ParentRef = new Oci.DataintegrationService.Models.ParentReference
						{
							Parent = "EXAMPLE-parent-Value",
							RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
						},
						Metadata = new Oci.DataintegrationService.Models.ObjectMetadata
						{
							CreatedBy = "EXAMPLE-createdBy-Value",
							CreatedByName = "EXAMPLE-createdByName-Value",
							UpdatedBy = "EXAMPLE-updatedBy-Value",
							UpdatedByName = "EXAMPLE-updatedByName-Value",
							TimeCreated = DateTime.Parse("10/11/2015 10:12:44"),
							TimeUpdated = DateTime.Parse("01/01/2007 18:53:34"),
							AggregatorKey = "EXAMPLE-aggregatorKey-Value",
							Aggregator = new Oci.DataintegrationService.Models.AggregatorSummary
							{
								Type = "EXAMPLE-type-Value",
								Key = "EXAMPLE-key-Value",
								Name = "EXAMPLE-name-Value",
								Identifier = "EXAMPLE-identifier-Value",
								Description = "EXAMPLE-description-Value"
							},
							IdentifierPath = "EXAMPLE-identifierPath-Value",
							InfoFields = new Dictionary<string, string>()
							{
								{
									"EXAMPLE_KEY_7u7D7", 
									"EXAMPLE_VALUE_Fape2fPXZPOxP1A9Lonx"
								}
							},
							RegistryVersion = 176,
							Labels = new List<string>
							{
								"EXAMPLE--Value"
							},
							IsFavorite = true,
							CountStatistics = new Oci.DataintegrationService.Models.CountStatistic
							{
								ObjectTypeCountList = new List<Oci.DataintegrationService.Models.CountStatisticSummary>
								{
									new Oci.DataintegrationService.Models.CountStatisticSummary
									{
										ObjectType = Oci.DataintegrationService.Models.CountStatisticSummary.ObjectTypeEnum.Application,
										ObjectCount = 276
									}
								}
							}
						},
						KeyMap = new Dictionary<string, string>()
						{
							{
								"EXAMPLE_KEY_Npu5m", 
								"EXAMPLE_VALUE_B4lgXKCs7naN9DDP1yNz"
							}
						}
					},
					Connection = new Oci.DataintegrationService.Models.ConnectionFromLake
					{
						Key = "EXAMPLE-key-Value",
						ModelVersion = "EXAMPLE-modelVersion-Value",
						ParentRef = new Oci.DataintegrationService.Models.ParentReference
						{
							Parent = "EXAMPLE-parent-Value",
							RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
						},
						Name = "EXAMPLE-name-Value",
						Description = "EXAMPLE-description-Value",
						ObjectVersion = 662,
						ObjectStatus = 404,
						Identifier = "EXAMPLE-identifier-Value",
						PrimarySchema = new Oci.DataintegrationService.Models.Schema
						{
							Key = "EXAMPLE-key-Value",
							ModelType = "EXAMPLE-modelType-Value",
							ModelVersion = "EXAMPLE-modelVersion-Value",
							ParentRef = new Oci.DataintegrationService.Models.ParentReference
							{
								Parent = "EXAMPLE-parent-Value",
								RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
							},
							Name = "EXAMPLE-name-Value",
							ResourceName = "EXAMPLE-resourceName-Value",
							Description = "EXAMPLE-description-Value",
							ObjectVersion = 503,
							ExternalKey = "EXAMPLE-externalKey-Value",
							IsHasContainers = false,
							DefaultConnection = "EXAMPLE-defaultConnection-Value",
							ObjectStatus = 179,
							Identifier = "EXAMPLE-identifier-Value",
							Metadata = new Oci.DataintegrationService.Models.ObjectMetadata
							{
								CreatedBy = "EXAMPLE-createdBy-Value",
								CreatedByName = "EXAMPLE-createdByName-Value",
								UpdatedBy = "EXAMPLE-updatedBy-Value",
								UpdatedByName = "EXAMPLE-updatedByName-Value",
								TimeCreated = DateTime.Parse("06/30/2004 23:07:41"),
								TimeUpdated = DateTime.Parse("04/19/2006 04:06:01"),
								AggregatorKey = "EXAMPLE-aggregatorKey-Value",
								Aggregator = new Oci.DataintegrationService.Models.AggregatorSummary
								{
									Type = "EXAMPLE-type-Value",
									Key = "EXAMPLE-key-Value",
									Name = "EXAMPLE-name-Value",
									Identifier = "EXAMPLE-identifier-Value",
									Description = "EXAMPLE-description-Value"
								},
								IdentifierPath = "EXAMPLE-identifierPath-Value",
								InfoFields = new Dictionary<string, string>()
								{
									{
										"EXAMPLE_KEY_BVo77", 
										"EXAMPLE_VALUE_uw6KcY0irE4f9saE8PsF"
									}
								},
								RegistryVersion = 484,
								Labels = new List<string>
								{
									"EXAMPLE--Value"
								},
								IsFavorite = false,
								CountStatistics = new Oci.DataintegrationService.Models.CountStatistic
								{
									ObjectTypeCountList = new List<Oci.DataintegrationService.Models.CountStatisticSummary>
									{
										new Oci.DataintegrationService.Models.CountStatisticSummary
										{
											ObjectType = Oci.DataintegrationService.Models.CountStatisticSummary.ObjectTypeEnum.UserDefinedFunction,
											ObjectCount = 989
										}
									}
								}
							}
						},
						ConnectionProperties = new List<Oci.DataintegrationService.Models.ConnectionProperty>
						{
							new Oci.DataintegrationService.Models.ConnectionProperty
							{
								Name = "EXAMPLE-name-Value",
								Value = "EXAMPLE-value-Value"
							}
						},
						IsDefault = false,
						Metadata = new Oci.DataintegrationService.Models.ObjectMetadata
						{
							CreatedBy = "EXAMPLE-createdBy-Value",
							CreatedByName = "EXAMPLE-createdByName-Value",
							UpdatedBy = "EXAMPLE-updatedBy-Value",
							UpdatedByName = "EXAMPLE-updatedByName-Value",
							TimeCreated = DateTime.Parse("07/10/2042 08:25:07"),
							TimeUpdated = DateTime.Parse("11/01/2003 11:35:27"),
							AggregatorKey = "EXAMPLE-aggregatorKey-Value",
							Aggregator = new Oci.DataintegrationService.Models.AggregatorSummary
							{
								Type = "EXAMPLE-type-Value",
								Key = "EXAMPLE-key-Value",
								Name = "EXAMPLE-name-Value",
								Identifier = "EXAMPLE-identifier-Value",
								Description = "EXAMPLE-description-Value"
							},
							IdentifierPath = "EXAMPLE-identifierPath-Value",
							InfoFields = new Dictionary<string, string>()
							{
								{
									"EXAMPLE_KEY_QMy5Y", 
									"EXAMPLE_VALUE_DUiBOlP2L2nB5ZTNTqz3"
								}
							},
							RegistryVersion = 773,
							Labels = new List<string>
							{
								"EXAMPLE--Value"
							},
							IsFavorite = true,
							CountStatistics = new Oci.DataintegrationService.Models.CountStatistic
							{
								ObjectTypeCountList = new List<Oci.DataintegrationService.Models.CountStatisticSummary>
								{
									new Oci.DataintegrationService.Models.CountStatisticSummary
									{
										ObjectType = Oci.DataintegrationService.Models.CountStatisticSummary.ObjectTypeEnum.DataAsset,
										ObjectCount = 270
									}
								}
							}
						},
						KeyMap = new Dictionary<string, string>()
						{
							{
								"EXAMPLE_KEY_vdKkE", 
								"EXAMPLE_VALUE_JuVb3jABeedY23SxkJv7"
							}
						}
					},
					CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
					Schema = new Oci.DataintegrationService.Models.Schema
					{
						Key = "EXAMPLE-key-Value",
						ModelType = "EXAMPLE-modelType-Value",
						ModelVersion = "EXAMPLE-modelVersion-Value",
						ParentRef = new Oci.DataintegrationService.Models.ParentReference
						{
							Parent = "EXAMPLE-parent-Value",
							RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
						},
						Name = "EXAMPLE-name-Value",
						ResourceName = "EXAMPLE-resourceName-Value",
						Description = "EXAMPLE-description-Value",
						ObjectVersion = 129,
						ExternalKey = "EXAMPLE-externalKey-Value",
						IsHasContainers = false,
						DefaultConnection = "EXAMPLE-defaultConnection-Value",
						ObjectStatus = 218,
						Identifier = "EXAMPLE-identifier-Value",
						Metadata = new Oci.DataintegrationService.Models.ObjectMetadata
						{
							CreatedBy = "EXAMPLE-createdBy-Value",
							CreatedByName = "EXAMPLE-createdByName-Value",
							UpdatedBy = "EXAMPLE-updatedBy-Value",
							UpdatedByName = "EXAMPLE-updatedByName-Value",
							TimeCreated = DateTime.Parse("04/14/2028 09:46:55"),
							TimeUpdated = DateTime.Parse("07/25/2005 02:54:17"),
							AggregatorKey = "EXAMPLE-aggregatorKey-Value",
							Aggregator = new Oci.DataintegrationService.Models.AggregatorSummary
							{
								Type = "EXAMPLE-type-Value",
								Key = "EXAMPLE-key-Value",
								Name = "EXAMPLE-name-Value",
								Identifier = "EXAMPLE-identifier-Value",
								Description = "EXAMPLE-description-Value"
							},
							IdentifierPath = "EXAMPLE-identifierPath-Value",
							InfoFields = new Dictionary<string, string>()
							{
								{
									"EXAMPLE_KEY_5RMD8", 
									"EXAMPLE_VALUE_kUFDlcIDG3Rr3l0MwK1S"
								}
							},
							RegistryVersion = 2,
							Labels = new List<string>
							{
								"EXAMPLE--Value"
							},
							IsFavorite = true,
							CountStatistics = new Oci.DataintegrationService.Models.CountStatistic
							{
								ObjectTypeCountList = new List<Oci.DataintegrationService.Models.CountStatisticSummary>
								{
									new Oci.DataintegrationService.Models.CountStatisticSummary
									{
										ObjectType = Oci.DataintegrationService.Models.CountStatisticSummary.ObjectTypeEnum.FunctionLibrary,
										ObjectCount = 900
									}
								}
							}
						}
					}
				}
			};
			var createExternalPublicationRequest = new Oci.DataintegrationService.Requests.CreateExternalPublicationRequest
			{
				WorkspaceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-workspaceId-Value",
				TaskKey = "EXAMPLE-taskKey-Value",
				CreateExternalPublicationDetails = createExternalPublicationDetails,
				OpcRequestId = "A05UNGAJIMT4EMSQRDWY<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 DataIntegrationClient(provider, new ClientConfiguration()))
				{
					var response = await client.CreateExternalPublication(createExternalPublicationRequest);
					// Retrieve value from the response.
					var applicationIdValue = response.ExternalPublication.ApplicationId;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"CreateExternalPublication Failed with {e.Message}");
                throw e;
            }
        }

    }
}