// 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{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{Connection: dataintegration.ConnectionFromAmazonS3{Name: common.String("EXAMPLE-name-Value"),
			AccessKey: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
				Value: common.String("EXAMPLE-value-Value")},
			Description:   common.String("EXAMPLE-description-Value"),
			ObjectVersion: common.Int(587),
			SecretKey: &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{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_08u1f": "EXAMPLE_VALUE_f4GMD6jAkYyI1yRdL0nA"},
				IsFavorite:      common.Bool(false),
				RegistryVersion: common.Int(501),
				CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(19),
					ObjectType: dataintegration.CountStatisticSummaryObjectTypeFolder}}},
				Labels:        []string{"EXAMPLE--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")},
			ObjectStatus: common.Int(617),
			ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
				RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
			PrimarySchema: &dataintegration.Schema{Key: common.String("EXAMPLE-key-Value"),
				ObjectStatus:  common.Int(624),
				ObjectVersion: common.Int(134),
				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"),
				Description:       common.String("EXAMPLE-description-Value"),
				ExternalKey:       common.String("EXAMPLE-externalKey-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(658),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeFunctionLibrary}}},
					CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
					IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
					InfoFields:      map[string]string{"EXAMPLE_KEY_ZWr7l": "EXAMPLE_VALUE_MKhiKVPd5soszfkk9ous"},
					RegistryVersion: common.Int(690),
					TimeCreated:     &common.SDKTime{Time: time.Now()},
					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")},
					CreatedByName: common.String("EXAMPLE-createdByName-Value"),
					IsFavorite:    common.Bool(true),
					Labels:        []string{"EXAMPLE--Value"},
					TimeUpdated:   &common.SDKTime{Time: time.Now()},
					UpdatedBy:     common.String("EXAMPLE-updatedBy-Value")},
				ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
				Name:         common.String("EXAMPLE-name-Value"),
				Identifier:   common.String("EXAMPLE-identifier-Value")},
			ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
				Value: common.String("EXAMPLE-value-Value")}},
			Identifier:   common.String("EXAMPLE-identifier-Value"),
			IsDefault:    common.Bool(false),
			Key:          common.String("EXAMPLE-key-Value"),
			ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
			KeyMap:       map[string]string{"EXAMPLE_KEY_7iCp2": "EXAMPLE_VALUE_NsPeCVBCoXUgSgHq7LWR"}},
			DataAsset: dataintegration.DataAssetFromLakeDetails{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"),
				Key:               common.String("EXAMPLE-key-Value"),
				LakeProxyEndpoint: common.String("EXAMPLE-lakeProxyEndpoint-Value"),
				ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
				Name:              common.String("EXAMPLE-name-Value"),
				KeyMap:            map[string]string{"EXAMPLE_KEY_PpzLp": "EXAMPLE_VALUE_LbsRAWO6hzWZCebyBeV5"},
				ObjectStatus:      common.Int(399),
				ObjectVersion:     common.Int(816),
				AssetProperties:   map[string]string{"EXAMPLE_KEY_1ogaP": "EXAMPLE_VALUE_ClhRJcskNobq4ut85guE"},
				Identifier:        common.String("EXAMPLE-identifier-Value"),
				LakeId:            common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-lakeId-Value"),
				Metadata: &dataintegration.ObjectMetadata{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"),
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(931),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeConnection}}},
					CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
					InfoFields:      map[string]string{"EXAMPLE_KEY_YJbnt": "EXAMPLE_VALUE_LbDo2avBQYJywkQsti2C"},
					IsFavorite:      common.Bool(false),
					Labels:          []string{"EXAMPLE--Value"},
					RegistryVersion: common.Int(515),
					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")},
				MetastoreId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-metastoreId-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(false),
					Key:          common.String("EXAMPLE-key-Value"),
					ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					ObjectStatus: common.Int(224),
					Metadata: &dataintegration.ObjectMetadata{CreatedByName: common.String("EXAMPLE-createdByName-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_M8HX4": "EXAMPLE_VALUE_JWEzOYn00twQJlj477Rh"},
						IsFavorite:      common.Bool(false),
						RegistryVersion: common.Int(868),
						TimeCreated:     &common.SDKTime{Time: time.Now()},
						TimeUpdated:     &common.SDKTime{Time: time.Now()},
						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(567),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeFunctionLibrary}}},
						CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						Labels:         []string{"EXAMPLE--Value"},
						UpdatedBy:      common.String("EXAMPLE-updatedBy-Value")},
					Name:          common.String("EXAMPLE-name-Value"),
					ObjectVersion: common.Int(561),
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					PrimarySchema: &dataintegration.Schema{ObjectVersion: common.Int(868),
						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"),
						Description:       common.String("EXAMPLE-description-Value"),
						ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
						Identifier:        common.String("EXAMPLE-identifier-Value"),
						Key:               common.String("EXAMPLE-key-Value"),
						Metadata: &dataintegration.ObjectMetadata{RegistryVersion: common.Int(708),
							UpdatedBy:     common.String("EXAMPLE-updatedBy-Value"),
							AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(888),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeFolder}}},
							IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
							InfoFields:     map[string]string{"EXAMPLE_KEY_2gLfR": "EXAMPLE_VALUE_Ui5SvOe5DFkfNIG1lhPG"},
							IsFavorite:     common.Bool(false),
							TimeCreated:    &common.SDKTime{Time: time.Now()},
							TimeUpdated:    &common.SDKTime{Time: time.Now()},
							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")},
							CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
							CreatedByName: common.String("EXAMPLE-createdByName-Value"),
							Labels:        []string{"EXAMPLE--Value"}},
						ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
						IsHasContainers: common.Bool(false),
						Name:            common.String("EXAMPLE-name-Value"),
						ObjectStatus:    common.Int(270)}},
				NativeTypeSystem: &dataintegration.TypeSystem{Description: common.String("EXAMPLE-description-Value"),
					Name:          common.String("EXAMPLE-name-Value"),
					ObjectVersion: common.Int(780),
					TypeMappingTo: map[string]string{"EXAMPLE_KEY_JpsFo": "EXAMPLE_VALUE_j8o4h0PRKrup8Dm7CdYn"},
					Identifier:    common.String("EXAMPLE-identifier-Value"),
					Key:           common.String("EXAMPLE-key-Value"),
					ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
					ObjectStatus:  common.Int(944),
					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_B8YlJ": "EXAMPLE_VALUE_eV0mqo9ksYMBO4Aqv1qr"},
					Types: []dataintegration.DataType{dataintegration.DataType{Key: common.String("EXAMPLE-key-Value"),
						ObjectStatus: common.Int(534),
						ConfigDefinition: &dataintegration.ConfigDefinition{Key: common.String("EXAMPLE-key-Value"),
							ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
							Name:         common.String("EXAMPLE-name-Value"),
							ObjectStatus: common.Int(397),
							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_QuhrE": dataintegration.ConfigParameterDefinition{Description: common.String("EXAMPLE-description-Value"),
								IsClassFieldValue: common.Bool(false),
								IsStatic:          common.Bool(false),
								ParameterName:     common.String("EXAMPLE-parameterName-Value"),
								ClassFieldName:    common.String("EXAMPLE-classFieldName-Value"),
								DefaultValue:      &defaultValue}},
							IsContained: common.Bool(false)},
						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")},
						TypeSystemName: common.String("EXAMPLE-typeSystemName-Value"),
						Description:    common.String("EXAMPLE-description-Value"),
						DtType:         dataintegration.DataTypeDtTypeStructured}}}},
			Schema: &dataintegration.Schema{Identifier: common.String("EXAMPLE-identifier-Value"),
				ObjectStatus:  common.Int(90),
				ObjectVersion: common.Int(545),
				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"),
				ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
				IsHasContainers:   common.Bool(true),
				Key:               common.String("EXAMPLE-key-Value"),
				Metadata: &dataintegration.ObjectMetadata{CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(774),
					ObjectType: dataintegration.CountStatisticSummaryObjectTypeProject}}},
					CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
					IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
					InfoFields:      map[string]string{"EXAMPLE_KEY_DrKaW": "EXAMPLE_VALUE_crj6bvi9ICS5dlyj173Z"},
					IsFavorite:      common.Bool(false),
					RegistryVersion: common.Int(491),
					TimeUpdated:     &common.SDKTime{Time: time.Now()},
					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")},
					AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
					CreatedByName: common.String("EXAMPLE-createdByName-Value"),
					Labels:        []string{"EXAMPLE--Value"},
					TimeCreated:   &common.SDKTime{Time: time.Now()},
					UpdatedByName: common.String("EXAMPLE-updatedByName-Value")},
				ModelType:    common.String("EXAMPLE-modelType-Value"),
				ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
				Name:         common.String("EXAMPLE-name-Value"),
				Description:  common.String("EXAMPLE-description-Value")},
			CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-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(385)}},
		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("SCQFGVFXAE4U4FESRDAF<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)
}