// 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).

package main

import (
	"context"
	"fmt"
	"time"

	"github.com/oracle/oci-go-sdk/v65/common"
	"github.com/oracle/oci-go-sdk/v65/dataintegration"
	"github.com/oracle/oci-go-sdk/v65/example/helpers"
)

func ExampleUpdateExternalPublication() {
	// 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.
	client, err := dataintegration.NewDataIntegrationClientWithConfigurationProvider(common.DefaultConfigProvider())
	helpers.FatalIfError(err)

	// Create a request and dependent object(s).
	var defaultValue interface{}
	defaultValue = "EXAMPLE-defaultValue-Value"
	var objectValue interface{}
	objectValue = "EXAMPLE-objectValue-Value"
	var refValue interface{}
	refValue = "EXAMPLE-refValue-Value"
	var rootObjectValue interface{}
	rootObjectValue = "EXAMPLE-rootObjectValue-Value"
	req := dataintegration.UpdateExternalPublicationRequest{UpdateExternalPublicationDetails: dataintegration.UpdateExternalPublicationDetails{ApplicationCompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-applicationCompartmentId-Value"),
		ApplicationId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-applicationId-Value"),
		ConfigurationDetails: &dataintegration.ConfigurationDetails{CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
			Connection: dataintegration.ConnectionFromJdbc{ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
				Parent: common.String("EXAMPLE-parent-Value")},
				PrimarySchema: &dataintegration.Schema{Key: common.String("EXAMPLE-key-Value"),
					ObjectStatus:      common.Int(369),
					DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					ExternalKey: common.String("EXAMPLE-externalKey-Value"),
					Identifier:  common.String("EXAMPLE-identifier-Value"),
					Metadata: &dataintegration.ObjectMetadata{AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
						CreatedBy: common.String("EXAMPLE-createdBy-Value"),
						Aggregator: &dataintegration.AggregatorSummary{Description: common.String("EXAMPLE-description-Value"),
							Identifier: common.String("EXAMPLE-identifier-Value"),
							Key:        common.String("EXAMPLE-key-Value"),
							Name:       common.String("EXAMPLE-name-Value"),
							Type:       common.String("EXAMPLE-type-Value")},
						TimeCreated:     &common.SDKTime{Time: time.Now()},
						Labels:          []string{"EXAMPLE--Value"},
						UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_khkvr": "EXAMPLE_VALUE_IlsnNRZ74HFSgmw3MNIt"},
						IsFavorite:      common.Bool(false),
						RegistryVersion: common.Int(144),
						TimeUpdated:     &common.SDKTime{Time: time.Now()},
						UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(176),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeFunctionLibrary}}}},
					ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
					Name:            common.String("EXAMPLE-name-Value"),
					ObjectVersion:   common.Int(123),
					ResourceName:    common.String("EXAMPLE-resourceName-Value"),
					Description:     common.String("EXAMPLE-description-Value"),
					IsHasContainers: common.Bool(true)},
				Username:     common.String("EXAMPLE-username-Value"),
				Identifier:   common.String("EXAMPLE-identifier-Value"),
				Name:         common.String("EXAMPLE-name-Value"),
				ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
				IsDefault:    common.Bool(false),
				Description:  common.String("EXAMPLE-description-Value"),
				KeyMap:       map[string]string{"EXAMPLE_KEY_bGCXc": "EXAMPLE_VALUE_BeRlos81Mb8fsDw76i15"},
				Metadata: &dataintegration.ObjectMetadata{CreatedByName: common.String("EXAMPLE-createdByName-Value"),
					IsFavorite:    common.Bool(true),
					UpdatedBy:     common.String("EXAMPLE-updatedBy-Value"),
					AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(576),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeApplication}}},
					InfoFields:    map[string]string{"EXAMPLE_KEY_q2nur": "EXAMPLE_VALUE_8QOXpzvRONj7QTxgGElC"},
					UpdatedByName: common.String("EXAMPLE-updatedByName-Value"),
					Aggregator: &dataintegration.AggregatorSummary{Key: common.String("EXAMPLE-key-Value"),
						Name:        common.String("EXAMPLE-name-Value"),
						Type:        common.String("EXAMPLE-type-Value"),
						Description: common.String("EXAMPLE-description-Value"),
						Identifier:  common.String("EXAMPLE-identifier-Value")},
					IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
					RegistryVersion: common.Int(701),
					TimeCreated:     &common.SDKTime{Time: time.Now()},
					CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
					Labels:          []string{"EXAMPLE--Value"},
					TimeUpdated:     &common.SDKTime{Time: time.Now()}},
				ObjectStatus:  common.Int(790),
				ObjectVersion: common.Int(411),
				ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
					Value: common.String("EXAMPLE-value-Value")}},
				Key: common.String("EXAMPLE-key-Value")},
			DataAsset: dataintegration.DataAssetFromObjectStorageDetails{Name: common.String("EXAMPLE-name-Value"),
				NativeTypeSystem: &dataintegration.TypeSystem{TypeMappingFrom: map[string]string{"EXAMPLE_KEY_IAYGD": "EXAMPLE_VALUE_F1l51IJMgeJerKekomME"},
					Types: []dataintegration.DataType{dataintegration.DataType{ConfigDefinition: &dataintegration.ConfigDefinition{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
						Name:         common.String("EXAMPLE-name-Value"),
						ObjectStatus: common.Int(378),
						ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
							Parent: common.String("EXAMPLE-parent-Value")},
						ConfigParameterDefinitions: map[string]dataintegration.ConfigParameterDefinition{"EXAMPLE_KEY_ESqYb": dataintegration.ConfigParameterDefinition{ClassFieldName: common.String("EXAMPLE-classFieldName-Value"),
							DefaultValue:      &defaultValue,
							Description:       common.String("EXAMPLE-description-Value"),
							IsClassFieldValue: common.Bool(true),
							IsStatic:          common.Bool(true),
							ParameterName:     common.String("EXAMPLE-parameterName-Value"),
							ParameterType: dataintegration.DynamicType{Description: common.String("EXAMPLE-description-Value"),
								Key:          common.String("EXAMPLE-key-Value"),
								ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
								Name:         common.String("EXAMPLE-name-Value"),
								ObjectStatus: common.Int(227),
								ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
									RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
								TypeHandler: dataintegration.FlattenTypeHandler{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
									ObjectStatus: common.Int(44),
									ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
										RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
									Scope: common.String("EXAMPLE-scope-Value"),
									ConfigValues: &dataintegration.ConfigValues{ConfigParamValues: map[string]dataintegration.ConfigParameterValue{"EXAMPLE_KEY_zSYDD": dataintegration.ConfigParameterValue{IntValue: common.Int(167),
										ObjectValue:     &objectValue,
										ParameterValue:  common.String("EXAMPLE-parameterValue-Value"),
										RefValue:        &refValue,
										RootObjectValue: &rootObjectValue,
										StringValue:     common.String("EXAMPLE-stringValue-Value")}},
										ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
											RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")}},
									FlattenDetails: common.String("EXAMPLE-flattenDetails-Value"),
									Key:            common.String("EXAMPLE-key-Value")}}}},
						IsContained: common.Bool(true),
						Key:         common.String("EXAMPLE-key-Value")},
						Name: common.String("EXAMPLE-name-Value"),
						ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
							RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
						TypeSystemName: common.String("EXAMPLE-typeSystemName-Value"),
						Description:    common.String("EXAMPLE-description-Value"),
						DtType:         dataintegration.DataTypeDtTypePrimitive,
						Key:            common.String("EXAMPLE-key-Value"),
						ModelVersion:   common.String("EXAMPLE-modelVersion-Value"),
						ObjectStatus:   common.Int(722)}},
					Description:   common.String("EXAMPLE-description-Value"),
					Key:           common.String("EXAMPLE-key-Value"),
					ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
					ObjectStatus:  common.Int(315),
					ObjectVersion: common.Int(75),
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					TypeMappingTo: map[string]string{"EXAMPLE_KEY_ll7qc": "EXAMPLE_VALUE_qlsIkQd0Dh77DQLKWuEv"},
					Identifier:    common.String("EXAMPLE-identifier-Value"),
					Name:          common.String("EXAMPLE-name-Value")},
				ObjectVersion: common.Int(431),
				OciRegion:     common.String("EXAMPLE-ociRegion-Value"),
				KeyMap:        map[string]string{"EXAMPLE_KEY_AMACy": "EXAMPLE_VALUE_9bWch9gN0QCRRPF7L11R"},
				Metadata: &dataintegration.ObjectMetadata{Labels: []string{"EXAMPLE--Value"},
					UpdatedByName:  common.String("EXAMPLE-updatedByName-Value"),
					AggregatorKey:  common.String("EXAMPLE-aggregatorKey-Value"),
					CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
					IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
					TimeCreated:    &common.SDKTime{Time: time.Now()},
					TimeUpdated:    &common.SDKTime{Time: time.Now()},
					Aggregator: &dataintegration.AggregatorSummary{Description: common.String("EXAMPLE-description-Value"),
						Identifier: common.String("EXAMPLE-identifier-Value"),
						Key:        common.String("EXAMPLE-key-Value"),
						Name:       common.String("EXAMPLE-name-Value"),
						Type:       common.String("EXAMPLE-type-Value")},
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(100),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataFlow}}},
					CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
					InfoFields:      map[string]string{"EXAMPLE_KEY_89BXn": "EXAMPLE_VALUE_JdGFKqgrLz6QuI0YavBI"},
					RegistryVersion: common.Int(922),
					IsFavorite:      common.Bool(false),
					UpdatedBy:       common.String("EXAMPLE-updatedBy-Value")},
				ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
				AssetProperties: map[string]string{"EXAMPLE_KEY_8Af1W": "EXAMPLE_VALUE_uLc03oJ0TifHe6nnR4II"},
				DefaultConnection: &dataintegration.ConnectionFromObjectStorageDetails{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					Name: common.String("EXAMPLE-name-Value"),
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					CredentialFileContent: common.String("EXAMPLE-credentialFileContent-Value"),
					FingerPrint:           common.String("EXAMPLE-fingerPrint-Value"),
					Identifier:            common.String("EXAMPLE-identifier-Value"),
					Key:                   common.String("EXAMPLE-key-Value"),
					Metadata: &dataintegration.ObjectMetadata{CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(562),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeFunctionLibrary}}},
						RegistryVersion: common.Int(847),
						Labels:          []string{"EXAMPLE--Value"},
						TimeCreated:     &common.SDKTime{Time: time.Now()},
						UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
						CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						IsFavorite:      common.Bool(false),
						UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
						Aggregator: &dataintegration.AggregatorSummary{Name: common.String("EXAMPLE-name-Value"),
							Type:        common.String("EXAMPLE-type-Value"),
							Description: common.String("EXAMPLE-description-Value"),
							Identifier:  common.String("EXAMPLE-identifier-Value"),
							Key:         common.String("EXAMPLE-key-Value")},
						AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
						CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
						InfoFields:    map[string]string{"EXAMPLE_KEY_7Ot2K": "EXAMPLE_VALUE_E48sPtnjNGwJznWTgS5T"},
						TimeUpdated:   &common.SDKTime{Time: time.Now()}},
					ObjectVersion: common.Int(999),
					Description:   common.String("EXAMPLE-description-Value"),
					IsDefault:     common.Bool(true),
					PrimarySchema: &dataintegration.Schema{Metadata: &dataintegration.ObjectMetadata{CreatedBy: common.String("EXAMPLE-createdBy-Value"),
						CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						InfoFields:     map[string]string{"EXAMPLE_KEY_YPqtD": "EXAMPLE_VALUE_7keXRLS6mXNQmG8P2xf6"},
						IsFavorite:     common.Bool(false),
						TimeUpdated:    &common.SDKTime{Time: time.Now()},
						UpdatedBy:      common.String("EXAMPLE-updatedBy-Value"),
						Aggregator: &dataintegration.AggregatorSummary{Identifier: common.String("EXAMPLE-identifier-Value"),
							Key:         common.String("EXAMPLE-key-Value"),
							Name:        common.String("EXAMPLE-name-Value"),
							Type:        common.String("EXAMPLE-type-Value"),
							Description: common.String("EXAMPLE-description-Value")},
						AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
						RegistryVersion: common.Int(881),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(32),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset}}},
						Labels:        []string{"EXAMPLE--Value"},
						TimeCreated:   &common.SDKTime{Time: time.Now()},
						UpdatedByName: common.String("EXAMPLE-updatedByName-Value")},
						ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
						ObjectStatus:  common.Int(883),
						ObjectVersion: common.Int(188),
						Description:   common.String("EXAMPLE-description-Value"),
						ExternalKey:   common.String("EXAMPLE-externalKey-Value"),
						ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
							RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
						ResourceName:      common.String("EXAMPLE-resourceName-Value"),
						DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
						Identifier:        common.String("EXAMPLE-identifier-Value"),
						IsHasContainers:   common.Bool(false),
						Key:               common.String("EXAMPLE-key-Value"),
						Name:              common.String("EXAMPLE-name-Value")},
					UserId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-userId-Value"),
					ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
						Value: common.String("EXAMPLE-value-Value")}},
					ObjectStatus: common.Int(153),
					PassPhrase:   common.String("EXAMPLE-passPhrase-Value")},
				Description:  common.String("EXAMPLE-description-Value"),
				ExternalKey:  common.String("EXAMPLE-externalKey-Value"),
				Identifier:   common.String("EXAMPLE-identifier-Value"),
				ObjectStatus: common.Int(59),
				ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
					RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
				TenancyId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-tenancyId-Value"),
				Key:       common.String("EXAMPLE-key-Value"),
				Namespace: common.String("EXAMPLE-namespace-Value"),
				Url:       common.String("EXAMPLE-url-Value")},
			Schema: &dataintegration.Schema{Description: common.String("EXAMPLE-description-Value"),
				ExternalKey: common.String("EXAMPLE-externalKey-Value"),
				Key:         common.String("EXAMPLE-key-Value"),
				ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
					Parent: common.String("EXAMPLE-parent-Value")},
				DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
				Identifier:        common.String("EXAMPLE-identifier-Value"),
				Name:              common.String("EXAMPLE-name-Value"),
				ObjectVersion:     common.Int(223),
				ResourceName:      common.String("EXAMPLE-resourceName-Value"),
				IsHasContainers:   common.Bool(false),
				Metadata: &dataintegration.ObjectMetadata{Labels: []string{"EXAMPLE--Value"},
					UpdatedByName: common.String("EXAMPLE-updatedByName-Value"),
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(780),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeApplication}}},
					IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
					CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
					TimeCreated:     &common.SDKTime{Time: time.Now()},
					InfoFields:      map[string]string{"EXAMPLE_KEY_SiBfj": "EXAMPLE_VALUE_jEAbL04Dyp7aEMslSI2x"},
					RegistryVersion: common.Int(428),
					AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
					CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
					TimeUpdated:     &common.SDKTime{Time: time.Now()},
					UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
					Aggregator: &dataintegration.AggregatorSummary{Description: common.String("EXAMPLE-description-Value"),
						Identifier: common.String("EXAMPLE-identifier-Value"),
						Key:        common.String("EXAMPLE-key-Value"),
						Name:       common.String("EXAMPLE-name-Value"),
						Type:       common.String("EXAMPLE-type-Value")},
					IsFavorite: common.Bool(false)},
				ModelType:    common.String("EXAMPLE-modelType-Value"),
				ObjectStatus: common.Int(488),
				ModelVersion: common.String("EXAMPLE-modelVersion-Value")}},
		Description: common.String("EXAMPLE-description-Value"),
		DisplayName: common.String("EXAMPLE-displayName-Value"),
		ResourceConfiguration: &dataintegration.ResourceConfiguration{DriverShape: common.String("EXAMPLE-driverShape-Value"),
			ExecutorShape:  common.String("EXAMPLE-executorShape-Value"),
			SparkVersion:   common.String("EXAMPLE-sparkVersion-Value"),
			TotalExecutors: common.Int(312)}},
		WorkspaceId:             common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-workspaceId-Value"),
		ExternalPublicationsKey: common.String("EXAMPLE-externalPublicationsKey-Value"),
		IfMatch:                 common.String("EXAMPLE-ifMatch-Value"),
		OpcRequestId:            common.String("UDSBFSX7IPCGRQKEEPQQ<unique_ID>"),
		TaskKey:                 common.String("EXAMPLE-taskKey-Value")}

	// Send the request using the service client
	resp, err := client.UpdateExternalPublication(context.Background(), req)
	helpers.FatalIfError(err)

	// Retrieve value from the response.
	fmt.Println(resp)
}