// 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("KB0LTWISTVN9MNP79TUR<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(786)},
			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.ConnectionFromMySql{ObjectStatus: common.Int(1),
					Username: common.String("EXAMPLE-username-Value"),
					ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
						Value: common.String("EXAMPLE-value-Value")}},
					IsDefault: common.Bool(false),
					KeyMap:    map[string]string{"EXAMPLE_KEY_WpLQ0": "EXAMPLE_VALUE_n0PhPR5nnN21OCACvL1g"},
					Metadata: &dataintegration.ObjectMetadata{TimeUpdated: &common.SDKTime{Time: time.Now()},
						UpdatedBy:     common.String("EXAMPLE-updatedBy-Value"),
						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")},
						AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
						CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
						CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_kGRgN": "EXAMPLE_VALUE_R17gJAD0Q8eR8A9N9G9W"},
						IsFavorite:      common.Bool(true),
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(258),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(352),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset}}},
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						TimeCreated:    &common.SDKTime{Time: time.Now()}},
					Name:          common.String("EXAMPLE-name-Value"),
					ObjectVersion: common.Int(642),
					ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
					PrimarySchema: &dataintegration.Schema{ResourceName: common.String("EXAMPLE-resourceName-Value"),
						DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
						Identifier:        common.String("EXAMPLE-identifier-Value"),
						IsHasContainers:   common.Bool(true),
						Key:               common.String("EXAMPLE-key-Value"),
						Metadata: &dataintegration.ObjectMetadata{CreatedByName: common.String("EXAMPLE-createdByName-Value"),
							InfoFields:      map[string]string{"EXAMPLE_KEY_f64RS": "EXAMPLE_VALUE_bTMlgflJQF28DRRmqWrM"},
							Labels:          []string{"EXAMPLE--Value"},
							RegistryVersion: common.Int(576),
							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(607),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeProject}}},
							CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
							IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
							IsFavorite:     common.Bool(true),
							UpdatedBy:      common.String("EXAMPLE-updatedBy-Value"),
							UpdatedByName:  common.String("EXAMPLE-updatedByName-Value"),
							AggregatorKey:  common.String("EXAMPLE-aggregatorKey-Value")},
						ObjectStatus: common.Int(745),
						ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
							Parent: common.String("EXAMPLE-parent-Value")},
						Description:   common.String("EXAMPLE-description-Value"),
						ExternalKey:   common.String("EXAMPLE-externalKey-Value"),
						ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
						Name:          common.String("EXAMPLE-name-Value"),
						ObjectVersion: common.Int(801)},
					Description: common.String("EXAMPLE-description-Value"),
					Identifier:  common.String("EXAMPLE-identifier-Value"),
					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")}},
				DataAsset: dataintegration.DataAssetFromHdfsDetails{Host: common.String("EXAMPLE-host-Value"),
					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(729),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeConnection}}},
						CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
						CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_qs9uv": "EXAMPLE_VALUE_HKOAIXklxEUxKuXNGzFI"},
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(941),
						AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
						IsFavorite:      common.Bool(false),
						TimeCreated:     &common.SDKTime{Time: time.Now()},
						TimeUpdated:     &common.SDKTime{Time: time.Now()},
						UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
						UpdatedByName:   common.String("EXAMPLE-updatedByName-Value")},
					ObjectVersion: common.Int(127),
					KeyMap:        map[string]string{"EXAMPLE_KEY_0exRB": "EXAMPLE_VALUE_PgUSNVc2BpqgvQRtkcJa"},
					Name:          common.String("EXAMPLE-name-Value"),
					NativeTypeSystem: &dataintegration.TypeSystem{Description: common.String("EXAMPLE-description-Value"),
						Key:           common.String("EXAMPLE-key-Value"),
						Name:          common.String("EXAMPLE-name-Value"),
						ObjectVersion: common.Int(877),
						ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
							RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
						Types: []dataintegration.DataType{dataintegration.DataType{ConfigDefinition: &dataintegration.ConfigDefinition{IsContained: common.Bool(false),
							Key:          common.String("EXAMPLE-key-Value"),
							ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
							Name:         common.String("EXAMPLE-name-Value"),
							ObjectStatus: common.Int(271),
							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_Wt1Ym": dataintegration.ConfigParameterDefinition{DefaultValue: &defaultValue,
								Description:       common.String("EXAMPLE-description-Value"),
								IsClassFieldValue: common.Bool(true),
								IsStatic:          common.Bool(false),
								ParameterName:     common.String("EXAMPLE-parameterName-Value"),
								ClassFieldName:    common.String("EXAMPLE-classFieldName-Value")}}},
							Description:  common.String("EXAMPLE-description-Value"),
							DtType:       dataintegration.DataTypeDtTypeStructured,
							Key:          common.String("EXAMPLE-key-Value"),
							ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
							ObjectStatus: common.Int(807),
							Name:         common.String("EXAMPLE-name-Value"),
							ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
								Parent: common.String("EXAMPLE-parent-Value")},
							TypeSystemName: common.String("EXAMPLE-typeSystemName-Value")}},
						Identifier:      common.String("EXAMPLE-identifier-Value"),
						ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
						ObjectStatus:    common.Int(228),
						TypeMappingFrom: map[string]string{"EXAMPLE_KEY_JR2lE": "EXAMPLE_VALUE_IPr5FLicYTUml1RF6ft6"},
						TypeMappingTo:   map[string]string{"EXAMPLE_KEY_hVzlt": "EXAMPLE_VALUE_mizp63BBTABeHhU9yoVh"}},
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					ValidateCertificate: common.Bool(true),
					ObjectStatus:        common.Int(8),
					DefaultConnection: &dataintegration.ConnectionFromHdfsDetails{KeyDistributionCenter: common.String("EXAMPLE-keyDistributionCenter-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{IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
							IsFavorite:      common.Bool(true),
							Labels:          []string{"EXAMPLE--Value"},
							RegistryVersion: common.Int(493),
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(122),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset}}},
							InfoFields:    map[string]string{"EXAMPLE_KEY_DgLmk": "EXAMPLE_VALUE_tHmultOfqzhepqtW59Rc"},
							TimeCreated:   &common.SDKTime{Time: time.Now()},
							TimeUpdated:   &common.SDKTime{Time: time.Now()},
							UpdatedBy:     common.String("EXAMPLE-updatedBy-Value"),
							UpdatedByName: common.String("EXAMPLE-updatedByName-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"),
							CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
							CreatedByName: common.String("EXAMPLE-createdByName-Value")},
						NameNodePrincipal: common.String("EXAMPLE-nameNodePrincipal-Value"),
						Description:       common.String("EXAMPLE-description-Value"),
						HdfsPrincipal:     common.String("EXAMPLE-hdfsPrincipal-Value"),
						Name:              common.String("EXAMPLE-name-Value"),
						Key:               common.String("EXAMPLE-key-Value"),
						ObjectStatus:      common.Int(807),
						PrimarySchema: &dataintegration.Schema{Description: common.String("EXAMPLE-description-Value"),
							ExternalKey: common.String("EXAMPLE-externalKey-Value"),
							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"),
								IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
								RegistryVersion: common.Int(721),
								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(321),
									ObjectType: dataintegration.CountStatisticSummaryObjectTypeProject}}},
								CreatedByName: common.String("EXAMPLE-createdByName-Value"),
								InfoFields:    map[string]string{"EXAMPLE_KEY_gcbwG": "EXAMPLE_VALUE_JjRVYBkIOLcQu5wtBuno"},
								IsFavorite:    common.Bool(false),
								Labels:        []string{"EXAMPLE--Value"},
								TimeCreated:   &common.SDKTime{Time: time.Now()}},
							ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
							Name:              common.String("EXAMPLE-name-Value"),
							ObjectStatus:      common.Int(268),
							DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
							Identifier:        common.String("EXAMPLE-identifier-Value"),
							IsHasContainers:   common.Bool(true),
							Key:               common.String("EXAMPLE-key-Value"),
							ObjectVersion:     common.Int(564),
							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")},
						ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Value: common.String("EXAMPLE-value-Value"),
							Name: common.String("EXAMPLE-name-Value")}},
						IsDefault:     common.Bool(false),
						ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
						ObjectVersion: common.Int(654),
						ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
							RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
						Realm:             common.String("EXAMPLE-realm-Value"),
						DataNodePrincipal: common.String("EXAMPLE-dataNodePrincipal-Value"),
						Identifier:        common.String("EXAMPLE-identifier-Value")},
					Description:     common.String("EXAMPLE-description-Value"),
					Identifier:      common.String("EXAMPLE-identifier-Value"),
					Key:             common.String("EXAMPLE-key-Value"),
					ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
					Port:            common.String("EXAMPLE-port-Value"),
					AssetProperties: map[string]string{"EXAMPLE_KEY_uXPEx": "EXAMPLE_VALUE_S4JDO0N6sgyf49GoTPls"},
					ExternalKey:     common.String("EXAMPLE-externalKey-Value"),
					Protocol:        common.String("EXAMPLE-protocol-Value")},
				Schema: &dataintegration.Schema{ObjectVersion: common.Int(154),
					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"),
					IsHasContainers:   common.Bool(false),
					ModelType:         common.String("EXAMPLE-modelType-Value"),
					Name:              common.String("EXAMPLE-name-Value"),
					ResourceName:      common.String("EXAMPLE-resourceName-Value"),
					DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
					ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
					Key:               common.String("EXAMPLE-key-Value"),
					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"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectType: dataintegration.CountStatisticSummaryObjectTypeApplication,
							ObjectCount: common.Int64(155)}}},
						CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						RegistryVersion: common.Int(960),
						TimeCreated:     &common.SDKTime{Time: time.Now()},
						UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
						CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_QaK4D": "EXAMPLE_VALUE_CKXu5KMosejPt3nCMOnR"},
						IsFavorite:      common.Bool(true),
						Labels:          []string{"EXAMPLE--Value"},
						TimeUpdated:     &common.SDKTime{Time: time.Now()},
						UpdatedByName:   common.String("EXAMPLE-updatedByName-Value")},
					ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					ObjectStatus: common.Int(413)}},
			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)
}