// 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 UpdateExternalPublicationExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var updateExternalPublicationDetails = new Oci.DataintegrationService.Models.UpdateExternalPublicationDetails
			{
				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 = 535
				},
				ConfigurationDetails = new Oci.DataintegrationService.Models.ConfigurationDetails
				{
					DataAsset = new Oci.DataintegrationService.Models.DataAssetFromMySQL
					{
						Host = "EXAMPLE-host-Value",
						Port = "EXAMPLE-port-Value",
						ServiceName = "EXAMPLE-serviceName-Value",
						DefaultConnection = new Oci.DataintegrationService.Models.ConnectionFromMySQLDetails
						{
							Username = "EXAMPLE-username-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 = 36,
							ObjectStatus = 951,
							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 = 695,
								ExternalKey = "EXAMPLE-externalKey-Value",
								IsHasContainers = false,
								DefaultConnection = "EXAMPLE-defaultConnection-Value",
								ObjectStatus = 721,
								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("03/07/2049 08:15:00"),
									TimeUpdated = DateTime.Parse("04/18/2016 14:10:53"),
									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_SVWxU", 
											"EXAMPLE_VALUE_EIZqu1d0BbxGy2l9HDDD"
										}
									},
									RegistryVersion = 222,
									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.Task,
												ObjectCount = 629
											}
										}
									}
								}
							},
							ConnectionProperties = new List<Oci.DataintegrationService.Models.ConnectionProperty>
							{
								new Oci.DataintegrationService.Models.ConnectionProperty
								{
									Name = "EXAMPLE-name-Value",
									Value = "EXAMPLE-value-Value"
								}
							},
							IsDefault = true,
							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("08/20/2003 06:07:42"),
								TimeUpdated = DateTime.Parse("03/13/2007 05:17: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_huaGm", 
										"EXAMPLE_VALUE_iKxgEurNd8dC7EZjXGeH"
									}
								},
								RegistryVersion = 877,
								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.Connection,
											ObjectCount = 265
										}
									}
								}
							}
						},
						Key = "EXAMPLE-key-Value",
						ModelVersion = "EXAMPLE-modelVersion-Value",
						Name = "EXAMPLE-name-Value",
						Description = "EXAMPLE-description-Value",
						ObjectStatus = 599,
						Identifier = "EXAMPLE-identifier-Value",
						ExternalKey = "EXAMPLE-externalKey-Value",
						AssetProperties = new Dictionary<string, string>()
						{
							{
								"EXAMPLE_KEY_ebD1i", 
								"EXAMPLE_VALUE_DdCI3N1FyVWheyKLYTtm"
							}
						},
						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 = 38,
							TypeMappingTo = new Dictionary<string, string>()
							{
								{
									"EXAMPLE_KEY_Oe4vQ", 
									"EXAMPLE_VALUE_JcDMrhMVmeGmq6HqgWM3"
								}
							},
							TypeMappingFrom = new Dictionary<string, string>()
							{
								{
									"EXAMPLE_KEY_jzYZs", 
									"EXAMPLE_VALUE_vQymzpLOR3WCxLVFoMA0"
								}
							},
							ObjectStatus = 949,
							Identifier = "EXAMPLE-identifier-Value",
							Types = new List<Oci.DataintegrationService.Models.DataType>
							{
								new Oci.DataintegrationService.Models.DataType
								{
									DtType = Oci.DataintegrationService.Models.DataType.DtTypeEnum.Structured,
									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 = true,
										ObjectStatus = 121,
										ConfigParameterDefinitions = new Dictionary<string, Oci.DataintegrationService.Models.ConfigParameterDefinition>()
										{
											{
												"EXAMPLE_KEY_LD5EP", 
												new Oci.DataintegrationService.Models.ConfigParameterDefinition
												{
													ParameterType = new Oci.DataintegrationService.Models.JavaType
													{
														JavaTypeName = "EXAMPLE-javaTypeName-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 = 766,
														Description = "EXAMPLE-description-Value"
													},
													ParameterName = "EXAMPLE-parameterName-Value",
													Description = "EXAMPLE-description-Value",
													DefaultValue = "EXAMPLE-defaultValue-Value",
													ClassFieldName = "EXAMPLE-classFieldName-Value",
													IsStatic = true,
													IsClassFieldValue = true
												}
											}
										}
									},
									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 = 515,
									Description = "EXAMPLE-description-Value"
								}
							}
						},
						ObjectVersion = 209,
						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("05/11/2000 15:07:14"),
							TimeUpdated = DateTime.Parse("07/02/2046 09:23:25"),
							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_CswCz", 
									"EXAMPLE_VALUE_6XTECdnsoDuwg9tToLd7"
								}
							},
							RegistryVersion = 957,
							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.Connection,
										ObjectCount = 160
									}
								}
							}
						},
						KeyMap = new Dictionary<string, string>()
						{
							{
								"EXAMPLE_KEY_jq8HL", 
								"EXAMPLE_VALUE_WHSAjMSJNVWJiooxpoSY"
							}
						}
					},
					Connection = new Oci.DataintegrationService.Models.ConnectionFromAtp
					{
						TnsAlias = "EXAMPLE-tnsAlias-Value",
						TnsNames = new List<string>
						{
							"EXAMPLE--Value"
						},
						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 = 624,
						ObjectStatus = 265,
						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 = 957,
							ExternalKey = "EXAMPLE-externalKey-Value",
							IsHasContainers = true,
							DefaultConnection = "EXAMPLE-defaultConnection-Value",
							ObjectStatus = 64,
							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/28/2024 02:21:44"),
								TimeUpdated = DateTime.Parse("12/26/2035 17:11:26"),
								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_tqkBc", 
										"EXAMPLE_VALUE_PUosbTQHtv9no8VKkf0s"
									}
								},
								RegistryVersion = 513,
								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.DataFlow,
											ObjectCount = 102
										}
									}
								}
							}
						},
						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("12/17/2030 16:55:37"),
							TimeUpdated = DateTime.Parse("11/12/2018 05:00:42"),
							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_7F2VR", 
									"EXAMPLE_VALUE_DRgiqQkxb0tP7RPuXlek"
								}
							},
							RegistryVersion = 980,
							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 = 35
									}
								}
							}
						},
						KeyMap = new Dictionary<string, string>()
						{
							{
								"EXAMPLE_KEY_NvsYj", 
								"EXAMPLE_VALUE_qg5pdrjFJ3oWIUxDGVkA"
							}
						}
					},
					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 = 822,
						ExternalKey = "EXAMPLE-externalKey-Value",
						IsHasContainers = false,
						DefaultConnection = "EXAMPLE-defaultConnection-Value",
						ObjectStatus = 989,
						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/02/2027 19:12:53"),
							TimeUpdated = DateTime.Parse("03/16/2000 14:49:56"),
							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_AEd8Y", 
									"EXAMPLE_VALUE_aoodFsAvaCtS7GTvKhHK"
								}
							},
							RegistryVersion = 239,
							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.Application,
										ObjectCount = 435
									}
								}
							}
						}
					}
				}
			};
			var updateExternalPublicationRequest = new Oci.DataintegrationService.Requests.UpdateExternalPublicationRequest
			{
				WorkspaceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-workspaceId-Value",
				TaskKey = "EXAMPLE-taskKey-Value",
				ExternalPublicationsKey = "EXAMPLE-externalPublicationsKey-Value",
				UpdateExternalPublicationDetails = updateExternalPublicationDetails,
				OpcRequestId = "0MRPTVCDVPXUVATT0KP2<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 DataIntegrationClient(provider, new ClientConfiguration()))
				{
					var response = await client.UpdateExternalPublication(updateExternalPublicationRequest);
					// Retrieve value from the response.
					var applicationIdValue = response.ExternalPublication.ApplicationId;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"UpdateExternalPublication Failed with {e.Message}");
                throw e;
            }
        }

    }
}