// 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{ExternalPublicationsKey: common.String("EXAMPLE-externalPublicationsKey-Value"),
		IfMatch:      common.String("EXAMPLE-ifMatch-Value"),
		OpcRequestId: common.String("MYSGGEFA9PZO9J1CSZET<unique_ID>"),
		TaskKey:      common.String("EXAMPLE-taskKey-Value"),
		UpdateExternalPublicationDetails: dataintegration.UpdateExternalPublicationDetails{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(243)},
			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.ConnectionFromMySqlHeatWave{Username: common.String("EXAMPLE-username-Value"),
					IsDefault: common.Bool(false),
					Key:       common.String("EXAMPLE-key-Value"),
					Password:  common.String("EXAMPLE-password-Value"),
					PasswordSecret: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
						Value: common.String("EXAMPLE-value-Value")},
					Identifier: common.String("EXAMPLE-identifier-Value"),
					Name:       common.String("EXAMPLE-name-Value"),
					PrimarySchema: &dataintegration.Schema{Description: common.String("EXAMPLE-description-Value"),
						ObjectVersion: common.Int(153),
						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"),
						Metadata: &dataintegration.ObjectMetadata{AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(127),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeTask}}},
							InfoFields:      map[string]string{"EXAMPLE_KEY_EZI5D": "EXAMPLE_VALUE_st9ovncLPfPedsr9r2qJ"},
							TimeCreated:     &common.SDKTime{Time: time.Now()},
							UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
							CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
							CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
							RegistryVersion: common.Int(690),
							TimeUpdated:     &common.SDKTime{Time: time.Now()},
							IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
							IsFavorite:      common.Bool(true),
							Labels:          []string{"EXAMPLE--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")},
							UpdatedBy: common.String("EXAMPLE-updatedBy-Value")},
						DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
						ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
						ObjectStatus:      common.Int(612),
						Identifier:        common.String("EXAMPLE-identifier-Value"),
						IsHasContainers:   common.Bool(true),
						Key:               common.String("EXAMPLE-key-Value"),
						ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
						Name:              common.String("EXAMPLE-name-Value")},
					ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
						Value: common.String("EXAMPLE-value-Value")}},
					KeyMap:       map[string]string{"EXAMPLE_KEY_1UTpx": "EXAMPLE_VALUE_8wHGG04QsGVEfKDidxAV"},
					ModelVersion: common.String("EXAMPLE-modelVersion-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"),
					Metadata: &dataintegration.ObjectMetadata{CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(290),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeTask}}},
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						RegistryVersion: common.Int(912),
						TimeUpdated:     &common.SDKTime{Time: time.Now()},
						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")},
						CreatedByName: common.String("EXAMPLE-createdByName-Value"),
						CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
						Labels:        []string{"EXAMPLE--Value"},
						InfoFields:    map[string]string{"EXAMPLE_KEY_G6y1D": "EXAMPLE_VALUE_XjDRgdulBobIZW415xbs"},
						IsFavorite:    common.Bool(true),
						TimeCreated:   &common.SDKTime{Time: time.Now()},
						UpdatedBy:     common.String("EXAMPLE-updatedBy-Value"),
						UpdatedByName: common.String("EXAMPLE-updatedByName-Value"),
						AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value")},
					ObjectStatus:  common.Int(845),
					ObjectVersion: common.Int(647)},
				DataAsset: dataintegration.DataAssetFromJdbc{Host: common.String("EXAMPLE-host-Value"),
					Key:           common.String("EXAMPLE-key-Value"),
					ObjectStatus:  common.Int(951),
					DataAssetType: common.String("EXAMPLE-dataAssetType-Value"),
					Description:   common.String("EXAMPLE-description-Value"),
					ExternalKey:   common.String("EXAMPLE-externalKey-Value"),
					Identifier:    common.String("EXAMPLE-identifier-Value"),
					KeyMap:        map[string]string{"EXAMPLE_KEY_co7uZ": "EXAMPLE_VALUE_ACcvMXuw1MbkrateoqBJ"},
					Metadata: &dataintegration.ObjectMetadata{CreatedBy: common.String("EXAMPLE-createdBy-Value"),
						Labels:    []string{"EXAMPLE--Value"},
						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(389),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataFlow}}},
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						TimeCreated:     &common.SDKTime{Time: time.Now()},
						TimeUpdated:     &common.SDKTime{Time: time.Now()},
						UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
						AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_MrYxN": "EXAMPLE_VALUE_SPcGAdl52LPg4hYqjBGu"},
						RegistryVersion: common.Int(509),
						CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
						IsFavorite:      common.Bool(false)},
					Name: common.String("EXAMPLE-name-Value"),
					NativeTypeSystem: &dataintegration.TypeSystem{Identifier: common.String("EXAMPLE-identifier-Value"),
						Key:           common.String("EXAMPLE-key-Value"),
						Name:          common.String("EXAMPLE-name-Value"),
						ObjectStatus:  common.Int(964),
						ObjectVersion: common.Int(883),
						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"),
						TypeMappingTo:   map[string]string{"EXAMPLE_KEY_3DQ51": "EXAMPLE_VALUE_qTuV4Tuix5RdWKPdOw84"},
						TypeMappingFrom: map[string]string{"EXAMPLE_KEY_T6qhn": "EXAMPLE_VALUE_0abt87jqgvgXR7Ccr4vJ"},
						Types: []dataintegration.DataType{dataintegration.DataType{Name: common.String("EXAMPLE-name-Value"),
							ObjectStatus: common.Int(920),
							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"),
							Key:            common.String("EXAMPLE-key-Value"),
							ModelVersion:   common.String("EXAMPLE-modelVersion-Value"),
							TypeSystemName: common.String("EXAMPLE-typeSystemName-Value"),
							ConfigDefinition: &dataintegration.ConfigDefinition{Name: common.String("EXAMPLE-name-Value"),
								ObjectStatus: common.Int(645),
								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_htdr4": dataintegration.ConfigParameterDefinition{ClassFieldName: common.String("EXAMPLE-classFieldName-Value"),
									DefaultValue:      &defaultValue,
									Description:       common.String("EXAMPLE-description-Value"),
									IsClassFieldValue: common.Bool(false),
									IsStatic:          common.Bool(false),
									ParameterName:     common.String("EXAMPLE-parameterName-Value"),
									ParameterType: dataintegration.CompositeType{Key: common.String("EXAMPLE-key-Value"),
										ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
										Name:         common.String("EXAMPLE-name-Value"),
										ObjectStatus: common.Int(587),
										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"),
										Elements: []dataintegration.TypedObject{dataintegration.DecisionOutputPort{Name: common.String("EXAMPLE-name-Value"),
											ConfigValues: &dataintegration.ConfigValues{ConfigParamValues: map[string]dataintegration.ConfigParameterValue{"EXAMPLE_KEY_uhMuh": dataintegration.ConfigParameterValue{IntValue: common.Int(312),
												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")}},
											DecisionOutputPortType: dataintegration.DecisionOutputPortDecisionOutputPortTypeError,
											Description:            common.String("EXAMPLE-description-Value"),
											Key:                    common.String("EXAMPLE-key-Value"),
											ModelVersion:           common.String("EXAMPLE-modelVersion-Value"),
											ObjectStatus:           common.Int(892),
											ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
												RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
											PortType: dataintegration.DecisionOutputPortPortTypeData}}}}},
								IsContained:  common.Bool(false),
								Key:          common.String("EXAMPLE-key-Value"),
								ModelVersion: common.String("EXAMPLE-modelVersion-Value")},
							DtType: dataintegration.DataTypeDtTypePrimitive}},
						ModelVersion: common.String("EXAMPLE-modelVersion-Value")},
					AssetProperties: map[string]string{"EXAMPLE_KEY_stoCM": "EXAMPLE_VALUE_FqXxZ3k7q0TCu7GwVtoX"},
					DefaultConnection: &dataintegration.ConnectionFromJdbcDetails{Identifier: common.String("EXAMPLE-identifier-Value"),
						ObjectStatus: common.Int(529),
						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"),
						ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
						ObjectVersion: common.Int(844),
						ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
							Value: common.String("EXAMPLE-value-Value")}},
						IsDefault: common.Bool(true),
						Key:       common.String("EXAMPLE-key-Value"),
						Metadata: &dataintegration.ObjectMetadata{IsFavorite: common.Bool(true),
							UpdatedByName: common.String("EXAMPLE-updatedByName-Value"),
							CreatedByName: common.String("EXAMPLE-createdByName-Value"),
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(748),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeUserDefinedFunction}}},
							IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
							Labels:         []string{"EXAMPLE--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")},
							AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
							CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
							InfoFields:      map[string]string{"EXAMPLE_KEY_MnxCb": "EXAMPLE_VALUE_ErcqKqs3QuyvFVyAoMQF"},
							RegistryVersion: common.Int(705),
							UpdatedBy:       common.String("EXAMPLE-updatedBy-Value")},
						Name: common.String("EXAMPLE-name-Value"),
						PrimarySchema: &dataintegration.Schema{DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
							Identifier:      common.String("EXAMPLE-identifier-Value"),
							ObjectStatus:    common.Int(808),
							ObjectVersion:   common.Int(726),
							ResourceName:    common.String("EXAMPLE-resourceName-Value"),
							Description:     common.String("EXAMPLE-description-Value"),
							IsHasContainers: common.Bool(true),
							Metadata: &dataintegration.ObjectMetadata{IsFavorite: common.Bool(true),
								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"),
								InfoFields:      map[string]string{"EXAMPLE_KEY_ykDf8": "EXAMPLE_VALUE_vxFB9DzQT7acwDW2XZKl"},
								Labels:          []string{"EXAMPLE--Value"},
								RegistryVersion: common.Int(379),
								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(470),
									ObjectType: dataintegration.CountStatisticSummaryObjectTypeFunctionLibrary}}},
								CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
								CreatedByName: common.String("EXAMPLE-createdByName-Value"),
								AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
								TimeCreated:   &common.SDKTime{Time: time.Now()}},
							ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
								RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
							Key:          common.String("EXAMPLE-key-Value"),
							Name:         common.String("EXAMPLE-name-Value"),
							ExternalKey:  common.String("EXAMPLE-externalKey-Value"),
							ModelVersion: common.String("EXAMPLE-modelVersion-Value")},
						Username: common.String("EXAMPLE-username-Value")},
					Port:          common.String("EXAMPLE-port-Value"),
					ObjectVersion: common.Int(769),
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					ModelVersion: common.String("EXAMPLE-modelVersion-Value")},
				Schema: &dataintegration.Schema{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					ObjectVersion: common.Int(50),
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					Key: common.String("EXAMPLE-key-Value"),
					Metadata: &dataintegration.ObjectMetadata{CreatedBy: common.String("EXAMPLE-createdBy-Value"),
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						IsFavorite:      common.Bool(true),
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(799),
						UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
						AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
						CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
						UpdatedBy:       common.String("EXAMPLE-updatedBy-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")},
						TimeCreated: &common.SDKTime{Time: time.Now()},
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectType: dataintegration.CountStatisticSummaryObjectTypeFolder,
							ObjectCount: common.Int64(704)}}},
						InfoFields:  map[string]string{"EXAMPLE_KEY_ATS3C": "EXAMPLE_VALUE_q7EyOIWIoDZPPVci7i6g"},
						TimeUpdated: &common.SDKTime{Time: time.Now()}},
					ModelType:         common.String("EXAMPLE-modelType-Value"),
					IsHasContainers:   common.Bool(true),
					Name:              common.String("EXAMPLE-name-Value"),
					ObjectStatus:      common.Int(399),
					ResourceName:      common.String("EXAMPLE-resourceName-Value"),
					DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
					Description:       common.String("EXAMPLE-description-Value"),
					ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
					Identifier:        common.String("EXAMPLE-identifier-Value")}},
			Description: common.String("EXAMPLE-description-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)
}