// 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{OpcRequestId: common.String("6VBOSRQMDNTAM9PIGF0V<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.ConnectionFromBicc{IsDefault: common.Bool(true),
					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")},
					Key:           common.String("EXAMPLE-key-Value"),
					Name:          common.String("EXAMPLE-name-Value"),
					ObjectStatus:  common.Int(817),
					ObjectVersion: common.Int(366),
					PrimarySchema: &dataintegration.Schema{Description: common.String("EXAMPLE-description-Value"),
						IsHasContainers: common.Bool(true),
						Key:             common.String("EXAMPLE-key-Value"),
						Metadata: &dataintegration.ObjectMetadata{UpdatedBy: common.String("EXAMPLE-updatedBy-Value"),
							UpdatedByName: common.String("EXAMPLE-updatedByName-Value"),
							AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(807),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset}}},
							CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
							CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
							IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
							IsFavorite:     common.Bool(false),
							Labels:         []string{"EXAMPLE--Value"},
							TimeUpdated:    &common.SDKTime{Time: time.Now()},
							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")},
							InfoFields:      map[string]string{"EXAMPLE_KEY_ZM2CC": "EXAMPLE_VALUE_3amCPSvhXI9QDLjUAPTw"},
							RegistryVersion: common.Int(180),
							TimeCreated:     &common.SDKTime{Time: time.Now()}},
						ObjectStatus:  common.Int(297),
						ObjectVersion: common.Int(165),
						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"),
						ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
						Identifier:        common.String("EXAMPLE-identifier-Value"),
						ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
						Name:              common.String("EXAMPLE-name-Value"),
						ResourceName:      common.String("EXAMPLE-resourceName-Value")},
					ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
						Value: common.String("EXAMPLE-value-Value")}},
					DefaultExternalStorage: &dataintegration.ExternalStorage{StorageId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-storageId-Value"),
						StorageName: common.String("EXAMPLE-storageName-Value"),
						TenancyId:   common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-tenancyId-Value"),
						Bucket:      common.String("EXAMPLE-bucket-Value"),
						Host:        common.String("EXAMPLE-host-Value"),
						Namespace:   common.String("EXAMPLE-namespace-Value")},
					Description: common.String("EXAMPLE-description-Value"),
					KeyMap:      map[string]string{"EXAMPLE_KEY_LfbAV": "EXAMPLE_VALUE_3NbY7v8VMjQpn7l7LWmR"},
					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{CreatedBy: common.String("EXAMPLE-createdBy-Value"),
						CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						IsFavorite:      common.Bool(false),
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(196),
						TimeCreated:     &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"),
						InfoFields:    map[string]string{"EXAMPLE_KEY_2cUJs": "EXAMPLE_VALUE_TSCoIYYMEpmEUDbeykgf"},
						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(110),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeConnection}}}},
					Username: common.String("EXAMPLE-username-Value")},
				DataAsset: dataintegration.DataAssetFromLakeDetails{ObjectStatus: common.Int(208),
					Identifier: common.String("EXAMPLE-identifier-Value"),
					Key:        common.String("EXAMPLE-key-Value"),
					LakeId:     common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-lakeId-Value"),
					Metadata: &dataintegration.ObjectMetadata{CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectType: dataintegration.CountStatisticSummaryObjectTypeUserDefinedFunction,
						ObjectCount: common.Int64(398)}}},
						InfoFields:    map[string]string{"EXAMPLE_KEY_5MaeP": "EXAMPLE_VALUE_WfbUMr4nJ2MV3JSy0vSr"},
						Labels:        []string{"EXAMPLE--Value"},
						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"),
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						IsFavorite:      common.Bool(false),
						RegistryVersion: common.Int(434),
						TimeCreated:     &common.SDKTime{Time: time.Now()}},
					MetastoreId:   common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-metastoreId-Value"),
					ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
					ObjectVersion: common.Int(122),
					DefaultConnection: &dataintegration.ConnectionFromLakeDetails{ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
						PrimarySchema: &dataintegration.Schema{ExternalKey: common.String("EXAMPLE-externalKey-Value"),
							Identifier:        common.String("EXAMPLE-identifier-Value"),
							ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
							Name:              common.String("EXAMPLE-name-Value"),
							ObjectStatus:      common.Int(49),
							DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
							Description:       common.String("EXAMPLE-description-Value"),
							IsHasContainers:   common.Bool(true),
							Key:               common.String("EXAMPLE-key-Value"),
							Metadata: &dataintegration.ObjectMetadata{IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
								InfoFields:  map[string]string{"EXAMPLE_KEY_oUHGc": "EXAMPLE_VALUE_r6t8XTjaJEQ9JrdBBef1"},
								IsFavorite:  common.Bool(false),
								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"),
								RegistryVersion: common.Int(752),
								UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
								UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
								CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(984),
									ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataFlow}}},
								CreatedByName: common.String("EXAMPLE-createdByName-Value")},
							ObjectVersion: common.Int(189),
							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{Name: common.String("EXAMPLE-name-Value"),
							Value: common.String("EXAMPLE-value-Value")}},
						Description: common.String("EXAMPLE-description-Value"),
						Identifier:  common.String("EXAMPLE-identifier-Value"),
						Key:         common.String("EXAMPLE-key-Value"),
						Metadata: &dataintegration.ObjectMetadata{RegistryVersion: common.Int(621),
							UpdatedBy:     common.String("EXAMPLE-updatedBy-Value"),
							UpdatedByName: common.String("EXAMPLE-updatedByName-Value"),
							AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(139),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeFolder}}},
							InfoFields:  map[string]string{"EXAMPLE_KEY_Sj4Vx": "EXAMPLE_VALUE_mc2TMIEtH2JKdg5pRclL"},
							IsFavorite:  common.Bool(true),
							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")},
							CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
							CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
							IdentifierPath: common.String("EXAMPLE-identifierPath-Value")},
						ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
						ObjectStatus:  common.Int(131),
						IsDefault:     common.Bool(false),
						Name:          common.String("EXAMPLE-name-Value"),
						ObjectVersion: common.Int(707)},
					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"),
					ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
					KeyMap:            map[string]string{"EXAMPLE_KEY_aWrt2": "EXAMPLE_VALUE_eBZkDGEvPwdRDa07MGHl"},
					LakeProxyEndpoint: common.String("EXAMPLE-lakeProxyEndpoint-Value"),
					AssetProperties:   map[string]string{"EXAMPLE_KEY_Hg2zH": "EXAMPLE_VALUE_ik8KMd9QPlFtaLe2ftRx"},
					Name:              common.String("EXAMPLE-name-Value"),
					NativeTypeSystem: &dataintegration.TypeSystem{Description: common.String("EXAMPLE-description-Value"),
						Identifier:    common.String("EXAMPLE-identifier-Value"),
						Key:           common.String("EXAMPLE-key-Value"),
						Name:          common.String("EXAMPLE-name-Value"),
						ObjectStatus:  common.Int(703),
						ObjectVersion: common.Int(644),
						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"),
						TypeMappingFrom: map[string]string{"EXAMPLE_KEY_99mq4": "EXAMPLE_VALUE_fLFu4QQPqN1eOZHjBhqi"},
						TypeMappingTo:   map[string]string{"EXAMPLE_KEY_OUJcj": "EXAMPLE_VALUE_1FkTDqFc9DVHxdPTIzzZ"},
						Types: []dataintegration.DataType{dataintegration.DataType{ConfigDefinition: &dataintegration.ConfigDefinition{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
							Name:         common.String("EXAMPLE-name-Value"),
							ObjectStatus: common.Int(35),
							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_i13I6": dataintegration.ConfigParameterDefinition{Description: common.String("EXAMPLE-description-Value"),
								IsClassFieldValue: common.Bool(false),
								IsStatic:          common.Bool(true),
								ParameterName:     common.String("EXAMPLE-parameterName-Value"),
								ParameterType: dataintegration.DerivedType{ObjectStatus: 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"),
									Key:          common.String("EXAMPLE-key-Value"),
									ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
									Name:         common.String("EXAMPLE-name-Value")},
								ClassFieldName: common.String("EXAMPLE-classFieldName-Value"),
								DefaultValue:   &defaultValue}},
							IsContained: common.Bool(true),
							Key:         common.String("EXAMPLE-key-Value")},
							Description:  common.String("EXAMPLE-description-Value"),
							DtType:       dataintegration.DataTypeDtTypeStructured,
							Key:          common.String("EXAMPLE-key-Value"),
							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")},
							ObjectStatus:   common.Int(529),
							TypeSystemName: common.String("EXAMPLE-typeSystemName-Value")}}}},
				Schema: &dataintegration.Schema{Identifier: common.String("EXAMPLE-identifier-Value"),
					IsHasContainers: common.Bool(false),
					Key:             common.String("EXAMPLE-key-Value"),
					Metadata: &dataintegration.ObjectMetadata{CreatedByName: common.String("EXAMPLE-createdByName-Value"),
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						RegistryVersion: common.Int(743),
						TimeCreated:     &common.SDKTime{Time: time.Now()},
						InfoFields:      map[string]string{"EXAMPLE_KEY_gSUdk": "EXAMPLE_VALUE_rtailz8TRJse9WZBeqYd"},
						IsFavorite:      common.Bool(true),
						Labels:          []string{"EXAMPLE--Value"},
						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"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(789),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeUserDefinedFunction}}},
						CreatedBy: common.String("EXAMPLE-createdBy-Value")},
					ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
					Name:          common.String("EXAMPLE-name-Value"),
					Description:   common.String("EXAMPLE-description-Value"),
					ModelType:     common.String("EXAMPLE-modelType-Value"),
					ObjectStatus:  common.Int(639),
					ObjectVersion: common.Int(206),
					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")}},
			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(902)}},
		WorkspaceId:             common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-workspaceId-Value"),
		ExternalPublicationsKey: common.String("EXAMPLE-externalPublicationsKey-Value"),
		IfMatch:                 common.String("EXAMPLE-ifMatch-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)
}