// 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{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("7D6DTNBYTNWL7PQOVUTS<unique_ID>"),
		TaskKey:                 common.String("EXAMPLE-taskKey-Value"),
		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.ConnectionFromOracleEbs{Description: common.String("EXAMPLE-description-Value"),
					Key:      common.String("EXAMPLE-key-Value"),
					Username: common.String("EXAMPLE-username-Value"),
					ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
						Value: common.String("EXAMPLE-value-Value")}},
					ObjectVersion: common.Int(72),
					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"),
					Metadata: &dataintegration.ObjectMetadata{InfoFields: map[string]string{"EXAMPLE_KEY_TjyQd": "EXAMPLE_VALUE_k43cbVeflzR6GjgZeqYq"},
						IsFavorite:      common.Bool(true),
						RegistryVersion: common.Int(190),
						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")},
						CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
						Labels:        []string{"EXAMPLE--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"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectType: dataintegration.CountStatisticSummaryObjectTypeProject,
							ObjectCount: common.Int64(449)}}},
						CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value")},
					Name:     common.String("EXAMPLE-name-Value"),
					Password: common.String("EXAMPLE-password-Value"),
					PrimarySchema: &dataintegration.Schema{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
						Name:            common.String("EXAMPLE-name-Value"),
						ObjectStatus:    common.Int(575),
						ObjectVersion:   common.Int(710),
						Description:     common.String("EXAMPLE-description-Value"),
						ExternalKey:     common.String("EXAMPLE-externalKey-Value"),
						IsHasContainers: common.Bool(false),
						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"),
						Key:               common.String("EXAMPLE-key-Value"),
						Metadata: &dataintegration.ObjectMetadata{InfoFields: map[string]string{"EXAMPLE_KEY_ShkTM": "EXAMPLE_VALUE_ZjsRJFaqRHnTRvMaOH4k"},
							IsFavorite:      common.Bool(true),
							Labels:          []string{"EXAMPLE--Value"},
							RegistryVersion: common.Int(555),
							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")},
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(967),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeFolder}}},
							CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
							IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
							TimeCreated:    &common.SDKTime{Time: time.Now()},
							UpdatedByName:  common.String("EXAMPLE-updatedByName-Value"),
							AggregatorKey:  common.String("EXAMPLE-aggregatorKey-Value"),
							CreatedByName:  common.String("EXAMPLE-createdByName-Value")}},
					IsDefault:    common.Bool(true),
					KeyMap:       map[string]string{"EXAMPLE_KEY_ptLES": "EXAMPLE_VALUE_NC3twGCDr18neJVgMwcF"},
					ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					ObjectStatus: common.Int(85),
					ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
						Parent: common.String("EXAMPLE-parent-Value")}},
				DataAsset: dataintegration.DataAssetFromLakeDetails{Description: common.String("EXAMPLE-description-Value"),
					ObjectStatus: common.Int(253),
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					DefaultConnection: &dataintegration.ConnectionFromLakeDetails{ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
						Value: common.String("EXAMPLE-value-Value")}},
						Description:  common.String("EXAMPLE-description-Value"),
						Identifier:   common.String("EXAMPLE-identifier-Value"),
						IsDefault:    common.Bool(true),
						Key:          common.String("EXAMPLE-key-Value"),
						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")},
						Metadata: &dataintegration.ObjectMetadata{CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(59),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeConnection}}},
							InfoFields:      map[string]string{"EXAMPLE_KEY_OlP2L": "EXAMPLE_VALUE_2nB5ZTNTqz35i2INBvdK"},
							IsFavorite:      common.Bool(true),
							RegistryVersion: common.Int(296),
							TimeUpdated:     &common.SDKTime{Time: time.Now()},
							UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
							Aggregator: &dataintegration.AggregatorSummary{Type: common.String("EXAMPLE-type-Value"),
								Description: common.String("EXAMPLE-description-Value"),
								Identifier:  common.String("EXAMPLE-identifier-Value"),
								Key:         common.String("EXAMPLE-key-Value"),
								Name:        common.String("EXAMPLE-name-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"),
							Labels:         []string{"EXAMPLE--Value"},
							TimeCreated:    &common.SDKTime{Time: time.Now()},
							UpdatedBy:      common.String("EXAMPLE-updatedBy-Value")},
						Name:          common.String("EXAMPLE-name-Value"),
						ObjectStatus:  common.Int(438),
						ObjectVersion: common.Int(784),
						PrimarySchema: &dataintegration.Schema{DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
							ExternalKey:     common.String("EXAMPLE-externalKey-Value"),
							IsHasContainers: common.Bool(false),
							Metadata: &dataintegration.ObjectMetadata{Labels: []string{"EXAMPLE--Value"},
								RegistryVersion: common.Int(452),
								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(76),
									ObjectType: dataintegration.CountStatisticSummaryObjectTypeConnection}}},
								CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
								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"),
								CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
								IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
								InfoFields:     map[string]string{"EXAMPLE_KEY_Y0irE": "EXAMPLE_VALUE_4f9saE8PsFMFGh6QwhQG"}},
							ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
							ObjectStatus:  common.Int(927),
							Description:   common.String("EXAMPLE-description-Value"),
							Identifier:    common.String("EXAMPLE-identifier-Value"),
							Key:           common.String("EXAMPLE-key-Value"),
							Name:          common.String("EXAMPLE-name-Value"),
							ObjectVersion: common.Int(290),
							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")}},
					Identifier:  common.String("EXAMPLE-identifier-Value"),
					Key:         common.String("EXAMPLE-key-Value"),
					KeyMap:      map[string]string{"EXAMPLE_KEY_UR2Yg": "EXAMPLE_VALUE_TV5aLS3QugZxqZJRwya4"},
					LakeId:      common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-lakeId-Value"),
					MetastoreId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-metastoreId-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(318),
						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_S437T": "EXAMPLE_VALUE_Y7a05ungAjimt4eMsqRd"},
						TypeMappingTo:   map[string]string{"EXAMPLE_KEY_P5RMD": "EXAMPLE_VALUE_8kUFDlcIDG3Rr3l0MwK1"},
						Description:     common.String("EXAMPLE-description-Value"),
						ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
						ObjectVersion:   common.Int(264),
						Types: []dataintegration.DataType{dataintegration.DataType{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
							ObjectStatus: common.Int(322),
							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"),
							Name:           common.String("EXAMPLE-name-Value"),
							ConfigDefinition: &dataintegration.ConfigDefinition{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_lZdQY": dataintegration.ConfigParameterDefinition{IsStatic: common.Bool(true),
									ParameterName:     common.String("EXAMPLE-parameterName-Value"),
									ClassFieldName:    common.String("EXAMPLE-classFieldName-Value"),
									DefaultValue:      &defaultValue,
									Description:       common.String("EXAMPLE-description-Value"),
									IsClassFieldValue: common.Bool(false)}},
								IsContained:  common.Bool(true),
								Key:          common.String("EXAMPLE-key-Value"),
								ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
								Name:         common.String("EXAMPLE-name-Value"),
								ObjectStatus: common.Int(612)},
							DtType: dataintegration.DataTypeDtTypeStructured,
							Key:    common.String("EXAMPLE-key-Value")}}},
					AssetProperties: map[string]string{"EXAMPLE_KEY_jABee": "EXAMPLE_VALUE_dY23SxkJv7H5hOysygPq"},
					ExternalKey:     common.String("EXAMPLE-externalKey-Value"),
					Metadata: &dataintegration.ObjectMetadata{IsFavorite: common.Bool(false),
						RegistryVersion: common.Int(19),
						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"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(703),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeConnection}}},
						CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
						CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
						InfoFields:     map[string]string{"EXAMPLE_KEY_OIIsO": "EXAMPLE_VALUE_Du3V4IlhMmSIjuide4sK"},
						Labels:         []string{"EXAMPLE--Value"},
						TimeCreated:    &common.SDKTime{Time: time.Now()},
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value")},
					ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
					Name:              common.String("EXAMPLE-name-Value"),
					ObjectVersion:     common.Int(307),
					LakeProxyEndpoint: common.String("EXAMPLE-lakeProxyEndpoint-Value")},
				Schema: &dataintegration.Schema{DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
					Description:   common.String("EXAMPLE-description-Value"),
					ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
					ObjectStatus:  common.Int(473),
					ObjectVersion: common.Int(714),
					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"),
					IsHasContainers: common.Bool(false),
					Key:             common.String("EXAMPLE-key-Value"),
					Metadata: &dataintegration.ObjectMetadata{CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(233),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset}}},
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(330),
						TimeCreated:     &common.SDKTime{Time: time.Now()},
						UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
						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")},
						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_Ebzsc": "EXAMPLE_VALUE_JrzcB7noXAgcXSNQzP2o"},
						IsFavorite:     common.Bool(true),
						TimeUpdated:    &common.SDKTime{Time: time.Now()}},
					ModelType:    common.String("EXAMPLE-modelType-Value"),
					Name:         common.String("EXAMPLE-name-Value"),
					ResourceName: common.String("EXAMPLE-resourceName-Value")}},
			Description: common.String("EXAMPLE-description-Value"),
			DisplayName: common.String("EXAMPLE-displayName-Value"),
			ResourceConfiguration: &dataintegration.ResourceConfiguration{TotalExecutors: common.Int(969),
				DriverShape:   common.String("EXAMPLE-driverShape-Value"),
				ExecutorShape: common.String("EXAMPLE-executorShape-Value"),
				SparkVersion:  common.String("EXAMPLE-sparkVersion-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)
}