// 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"
	req := dataintegration.UpdateExternalPublicationRequest{ExternalPublicationsKey: common.String("EXAMPLE-externalPublicationsKey-Value"),
		IfMatch:      common.String("EXAMPLE-ifMatch-Value"),
		OpcRequestId: common.String("WYZDPIJO06DX9BHXFW7D<unique_ID>"),
		TaskKey:      common.String("EXAMPLE-taskKey-Value"),
		UpdateExternalPublicationDetails: dataintegration.UpdateExternalPublicationDetails{ResourceConfiguration: &dataintegration.ResourceConfiguration{DriverShape: common.String("EXAMPLE-driverShape-Value"),
			ExecutorShape:  common.String("EXAMPLE-executorShape-Value"),
			SparkVersion:   common.String("EXAMPLE-sparkVersion-Value"),
			TotalExecutors: common.Int(780)},
			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.ConnectionFromOraclePeopleSoft{KeyMap: map[string]string{"EXAMPLE_KEY_SxI9y": "EXAMPLE_VALUE_oBMU9UOGPo4sor0zvOzl"},
					ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					ObjectStatus: common.Int(166),
					Password:     common.String("EXAMPLE-password-Value"),
					ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Value: common.String("EXAMPLE-value-Value"),
						Name: common.String("EXAMPLE-name-Value")}},
					Description: common.String("EXAMPLE-description-Value"),
					IsDefault:   common.Bool(true),
					Key:         common.String("EXAMPLE-key-Value"),
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					PasswordSecret: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
						Value: common.String("EXAMPLE-value-Value")},
					Username:   common.String("EXAMPLE-username-Value"),
					Identifier: common.String("EXAMPLE-identifier-Value"),
					Metadata: &dataintegration.ObjectMetadata{CreatedByName: common.String("EXAMPLE-createdByName-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_QFGvf": "EXAMPLE_VALUE_xAe4U4FesrDAFLIjAxjK"},
						IsFavorite:      common.Bool(true),
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(61),
						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"),
						CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						TimeCreated:    &common.SDKTime{Time: time.Now()},
						TimeUpdated:    &common.SDKTime{Time: time.Now()},
						UpdatedBy:      common.String("EXAMPLE-updatedBy-Value"),
						UpdatedByName:  common.String("EXAMPLE-updatedByName-Value"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(73),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeUserDefinedFunction}}}},
					Name:          common.String("EXAMPLE-name-Value"),
					ObjectVersion: common.Int(210),
					PrimarySchema: &dataintegration.Schema{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(797),
						DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
						ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
						Identifier:        common.String("EXAMPLE-identifier-Value"),
						IsHasContainers:   common.Bool(true),
						Metadata: &dataintegration.ObjectMetadata{AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(727),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeUserDefinedFunction}}},
							CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
							IsFavorite:    common.Bool(true),
							Labels:        []string{"EXAMPLE--Value"},
							TimeCreated:   &common.SDKTime{Time: time.Now()},
							UpdatedByName: common.String("EXAMPLE-updatedByName-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")},
							CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
							IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
							InfoFields:      map[string]string{"EXAMPLE_KEY_ocWxj": "EXAMPLE_VALUE_puKDrKaWcrj6bvi9ICS5"},
							RegistryVersion: common.Int(731),
							TimeUpdated:     &common.SDKTime{Time: time.Now()},
							UpdatedBy:       common.String("EXAMPLE-updatedBy-Value")},
						ObjectVersion: common.Int(718),
						ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
							Parent: common.String("EXAMPLE-parent-Value")},
						ResourceName: common.String("EXAMPLE-resourceName-Value")}},
				DataAsset: dataintegration.DataAssetFromFusionApp{Description: common.String("EXAMPLE-description-Value"),
					ExternalKey:     common.String("EXAMPLE-externalKey-Value"),
					Key:             common.String("EXAMPLE-key-Value"),
					ServiceUrl:      common.String("EXAMPLE-serviceUrl-Value"),
					ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
					Name:            common.String("EXAMPLE-name-Value"),
					AssetProperties: map[string]string{"EXAMPLE_KEY_obq4u": "EXAMPLE_VALUE_t85guEaJpsFoj8o4h0PR"},
					Identifier:      common.String("EXAMPLE-identifier-Value"),
					KeyMap:          map[string]string{"EXAMPLE_KEY_WZCeb": "EXAMPLE_VALUE_yBeV5iB10oaCpSfoSBG8"},
					Metadata: &dataintegration.ObjectMetadata{CreatedByName: common.String("EXAMPLE-createdByName-Value"),
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						InfoFields:     map[string]string{"EXAMPLE_KEY_JywkQ": "EXAMPLE_VALUE_sti2CttBEDsPpzLpLbsR"},
						TimeCreated:    &common.SDKTime{Time: time.Now()},
						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")},
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(395),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeFolder}}},
						IsFavorite:      common.Bool(true),
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(494),
						UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
						AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
						CreatedBy:       common.String("EXAMPLE-createdBy-Value")},
					NativeTypeSystem: &dataintegration.TypeSystem{TypeMappingTo: map[string]string{"EXAMPLE_KEY_rup8D": "EXAMPLE_VALUE_m7CdYnB8YlJeV0mqo9ks"},
						Description:  common.String("EXAMPLE-description-Value"),
						Identifier:   common.String("EXAMPLE-identifier-Value"),
						ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
						ObjectStatus: common.Int(30),
						ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
							RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
						TypeMappingFrom: map[string]string{"EXAMPLE_KEY_YMBO4": "EXAMPLE_VALUE_Aqv1qrW6MjJR13XU4M5v"},
						Types: []dataintegration.DataType{dataintegration.DataType{ObjectStatus: common.Int(176),
							ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
								RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
							ConfigDefinition: &dataintegration.ConfigDefinition{ObjectStatus: common.Int(43),
								ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
									RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
								ConfigParameterDefinitions: map[string]dataintegration.ConfigParameterDefinition{"EXAMPLE_KEY_JbntL": dataintegration.ConfigParameterDefinition{IsStatic: common.Bool(true),
									ParameterName: common.String("EXAMPLE-parameterName-Value"),
									ParameterType: dataintegration.JavaType{Name: common.String("EXAMPLE-name-Value"),
										ObjectStatus: common.Int(356),
										ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
											RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
										Description:  common.String("EXAMPLE-description-Value"),
										JavaTypeName: common.String("EXAMPLE-javaTypeName-Value"),
										Key:          common.String("EXAMPLE-key-Value"),
										ModelVersion: common.String("EXAMPLE-modelVersion-Value")},
									ClassFieldName:    common.String("EXAMPLE-classFieldName-Value"),
									DefaultValue:      &defaultValue,
									Description:       common.String("EXAMPLE-description-Value"),
									IsClassFieldValue: common.Bool(false)}},
								IsContained:  common.Bool(false),
								Key:          common.String("EXAMPLE-key-Value"),
								ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
								Name:         common.String("EXAMPLE-name-Value")},
							Key:            common.String("EXAMPLE-key-Value"),
							TypeSystemName: common.String("EXAMPLE-typeSystemName-Value"),
							Description:    common.String("EXAMPLE-description-Value"),
							DtType:         dataintegration.DataTypeDtTypePrimitive,
							ModelVersion:   common.String("EXAMPLE-modelVersion-Value"),
							Name:           common.String("EXAMPLE-name-Value")}},
						Key:           common.String("EXAMPLE-key-Value"),
						Name:          common.String("EXAMPLE-name-Value"),
						ObjectVersion: common.Int(838)},
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					ObjectStatus:  common.Int(121),
					ObjectVersion: common.Int(331),
					DefaultConnection: dataintegration.ConnectionFromHdfsDetails{Name: common.String("EXAMPLE-name-Value"),
						NameNodePrincipal: common.String("EXAMPLE-nameNodePrincipal-Value"),
						ObjectStatus:      common.Int(717),
						PrimarySchema: &dataintegration.Schema{ObjectVersion: common.Int(171),
							ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
								RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
							DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
							Description:       common.String("EXAMPLE-description-Value"),
							ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
							Key:               common.String("EXAMPLE-key-Value"),
							ResourceName:      common.String("EXAMPLE-resourceName-Value"),
							Identifier:        common.String("EXAMPLE-identifier-Value"),
							IsHasContainers:   common.Bool(false),
							Metadata: &dataintegration.ObjectMetadata{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(0),
									ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset}}},
								CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
								CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
								InfoFields:      map[string]string{"EXAMPLE_KEY_oszfk": "EXAMPLE_VALUE_k9ousSKug08m7ngvAQbs"},
								TimeUpdated:     &common.SDKTime{Time: time.Now()},
								AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
								IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
								IsFavorite:      common.Bool(true),
								Labels:          []string{"EXAMPLE--Value"},
								RegistryVersion: common.Int(945),
								TimeCreated:     &common.SDKTime{Time: time.Now()},
								UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
								UpdatedByName:   common.String("EXAMPLE-updatedByName-Value")},
							ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
							Name:         common.String("EXAMPLE-name-Value"),
							ObjectStatus: common.Int(424)},
						ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
							Value: common.String("EXAMPLE-value-Value")}},
						DataNodePrincipal: common.String("EXAMPLE-dataNodePrincipal-Value"),
						KeyTabContent: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
							Value: common.String("EXAMPLE-value-Value")},
						Metadata: &dataintegration.ObjectMetadata{InfoFields: map[string]string{"EXAMPLE_KEY_YyI1y": "EXAMPLE_VALUE_RdL0nAz0q4hd7iCp2NsP"},
							Labels:          []string{"EXAMPLE--Value"},
							TimeCreated:     &common.SDKTime{Time: time.Now()},
							UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
							AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
							CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
							IsFavorite:      common.Bool(false),
							RegistryVersion: common.Int(560),
							TimeUpdated:     &common.SDKTime{Time: time.Now()},
							UpdatedBy:       common.String("EXAMPLE-updatedBy-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")},
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(916),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset}}},
							CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
							IdentifierPath: common.String("EXAMPLE-identifierPath-Value")},
						ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
							RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
						Description:           common.String("EXAMPLE-description-Value"),
						Identifier:            common.String("EXAMPLE-identifier-Value"),
						KeyDistributionCenter: common.String("EXAMPLE-keyDistributionCenter-Value"),
						ModelVersion:          common.String("EXAMPLE-modelVersion-Value"),
						ObjectVersion:         common.Int(686),
						HdfsPrincipal:         common.String("EXAMPLE-hdfsPrincipal-Value"),
						IsDefault:             common.Bool(false),
						Key:                   common.String("EXAMPLE-key-Value"),
						Realm:                 common.String("EXAMPLE-realm-Value")}},
				Schema: &dataintegration.Schema{DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
					Description:     common.String("EXAMPLE-description-Value"),
					ExternalKey:     common.String("EXAMPLE-externalKey-Value"),
					Identifier:      common.String("EXAMPLE-identifier-Value"),
					IsHasContainers: common.Bool(true),
					Metadata: &dataintegration.ObjectMetadata{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")},
						AggregatorKey:  common.String("EXAMPLE-aggregatorKey-Value"),
						CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
						CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						InfoFields:     map[string]string{"EXAMPLE_KEY_iZBay": "EXAMPLE_VALUE_kQL7lrkE6nl8xJU2x5Nq"},
						IsFavorite:     common.Bool(false),
						Labels:         []string{"EXAMPLE--Value"},
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(635),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataFlow}}},
						RegistryVersion: common.Int(827),
						TimeCreated:     &common.SDKTime{Time: time.Now()},
						TimeUpdated:     &common.SDKTime{Time: time.Now()},
						UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
						UpdatedByName:   common.String("EXAMPLE-updatedByName-Value")},
					Name:          common.String("EXAMPLE-name-Value"),
					ObjectStatus:  common.Int(889),
					Key:           common.String("EXAMPLE-key-Value"),
					ModelType:     common.String("EXAMPLE-modelType-Value"),
					ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
					ObjectVersion: common.Int(383),
					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")}},
			Description: common.String("EXAMPLE-description-Value"),
			DisplayName: common.String("EXAMPLE-displayName-Value")},
		WorkspaceId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-workspaceId-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)
}