// 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{IfMatch: common.String("EXAMPLE-ifMatch-Value"),
		OpcRequestId: common.String("QXWI4SG431XUAGJ8RWRZ<unique_ID>"),
		TaskKey:      common.String("EXAMPLE-taskKey-Value"),
		UpdateExternalPublicationDetails: dataintegration.UpdateExternalPublicationDetails{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(799)},
			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.ConnectionFromBip{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"),
					ObjectVersion: common.Int(386),
					PasswordSecret: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
						Value: common.String("EXAMPLE-value-Value")},
					Username:     common.String("EXAMPLE-username-Value"),
					Key:          common.String("EXAMPLE-key-Value"),
					ObjectStatus: common.Int(523),
					PrimarySchema: &dataintegration.Schema{IsHasContainers: common.Bool(true),
						Key: common.String("EXAMPLE-key-Value"),
						Metadata: &dataintegration.ObjectMetadata{AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(800),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataFlow}}},
							Labels:          []string{"EXAMPLE--Value"},
							RegistryVersion: common.Int(912),
							TimeCreated:     &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")},
							CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
							CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
							IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
							InfoFields:     map[string]string{"EXAMPLE_KEY_aMmuR": "EXAMPLE_VALUE_19OskOJOX0vy7dtnLklJ"},
							IsFavorite:     common.Bool(false),
							TimeUpdated:    &common.SDKTime{Time: time.Now()}},
						Name:         common.String("EXAMPLE-name-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")},
						DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
						Description:       common.String("EXAMPLE-description-Value"),
						ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
						ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
						ObjectVersion:     common.Int(433),
						ResourceName:      common.String("EXAMPLE-resourceName-Value"),
						Identifier:        common.String("EXAMPLE-identifier-Value")},
					KeyMap: map[string]string{"EXAMPLE_KEY_uc9xm": "EXAMPLE_VALUE_GLLtAUv69ZEVQUV2PXRV"},
					Metadata: &dataintegration.ObjectMetadata{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{ObjectCount: common.Int64(831),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeFunctionLibrary}}},
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						IsFavorite:     common.Bool(false),
						Labels:         []string{"EXAMPLE--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")},
						CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
						CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_hjNL1": "EXAMPLE_VALUE_T5O3Lk6RQoGeabVDT21C"},
						RegistryVersion: common.Int(811),
						TimeCreated:     &common.SDKTime{Time: time.Now()}},
					IsDefault:    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")}},
				DataAsset: dataintegration.DataAssetFromJdbc{ObjectStatus: common.Int(862),
					AssetProperties: map[string]string{"EXAMPLE_KEY_ZKqIK": "EXAMPLE_VALUE_JijWjetGtgkRvZqySJaH"},
					DefaultConnection: &dataintegration.ConnectionFromJdbcDetails{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")},
						PrimarySchema: &dataintegration.Schema{DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
							ExternalKey:     common.String("EXAMPLE-externalKey-Value"),
							IsHasContainers: common.Bool(false),
							ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
							ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
								Parent: common.String("EXAMPLE-parent-Value")},
							ResourceName: common.String("EXAMPLE-resourceName-Value"),
							Description:  common.String("EXAMPLE-description-Value"),
							Identifier:   common.String("EXAMPLE-identifier-Value"),
							Key:          common.String("EXAMPLE-key-Value"),
							Metadata: &dataintegration.ObjectMetadata{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"),
								InfoFields:    map[string]string{"EXAMPLE_KEY_Ttiyp": "EXAMPLE_VALUE_w9yRxDTsR8S700STxWRQ"},
								IsFavorite:    common.Bool(false),
								Labels:        []string{"EXAMPLE--Value"},
								TimeCreated:   &common.SDKTime{Time: time.Now()},
								UpdatedBy:     common.String("EXAMPLE-updatedBy-Value"),
								CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(704),
									ObjectType: dataintegration.CountStatisticSummaryObjectTypeProject}}},
								CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
								CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
								IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
								RegistryVersion: common.Int(340),
								TimeUpdated:     &common.SDKTime{Time: time.Now()},
								UpdatedByName:   common.String("EXAMPLE-updatedByName-Value")},
							Name:          common.String("EXAMPLE-name-Value"),
							ObjectStatus:  common.Int(512),
							ObjectVersion: common.Int(289)},
						Identifier: common.String("EXAMPLE-identifier-Value"),
						Metadata: &dataintegration.ObjectMetadata{TimeUpdated: &common.SDKTime{Time: time.Now()},
							UpdatedBy:     common.String("EXAMPLE-updatedBy-Value"),
							UpdatedByName: common.String("EXAMPLE-updatedByName-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"),
							CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
							IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
							IsFavorite:      common.Bool(false),
							Labels:          []string{"EXAMPLE--Value"},
							RegistryVersion: common.Int(574),
							TimeCreated:     &common.SDKTime{Time: time.Now()},
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(496),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeProject}}},
							CreatedByName: common.String("EXAMPLE-createdByName-Value"),
							InfoFields:    map[string]string{"EXAMPLE_KEY_D8snO": "EXAMPLE_VALUE_9WTjUPtx8kAf1uXlOB2s"}},
						Name:          common.String("EXAMPLE-name-Value"),
						ObjectStatus:  common.Int(412),
						ObjectVersion: common.Int(453),
						Username:      common.String("EXAMPLE-username-Value"),
						ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
							Value: common.String("EXAMPLE-value-Value")}},
						Description: common.String("EXAMPLE-description-Value")},
					ExternalKey: common.String("EXAMPLE-externalKey-Value"),
					NativeTypeSystem: &dataintegration.TypeSystem{Description: common.String("EXAMPLE-description-Value"),
						Identifier:      common.String("EXAMPLE-identifier-Value"),
						Name:            common.String("EXAMPLE-name-Value"),
						TypeMappingFrom: map[string]string{"EXAMPLE_KEY_dgoaz": "EXAMPLE_VALUE_XLjkGledbd6gikPRFDEd"},
						TypeMappingTo:   map[string]string{"EXAMPLE_KEY_J3Mp5": "EXAMPLE_VALUE_hIYcKHgKebYVLVpIGOiB"},
						Key:             common.String("EXAMPLE-key-Value"),
						ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
						ObjectStatus:    common.Int(166),
						ObjectVersion:   common.Int(139),
						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{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")},
							TypeSystemName: common.String("EXAMPLE-typeSystemName-Value"),
							ConfigDefinition: &dataintegration.ConfigDefinition{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(587),
								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_ZiY2h": dataintegration.ConfigParameterDefinition{ParameterType: dataintegration.ArrayType{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"),
									ElementType:  common.String("EXAMPLE-elementType-Value"),
									Key:          common.String("EXAMPLE-key-Value"),
									ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
									Name:         common.String("EXAMPLE-name-Value"),
									ObjectStatus: common.Int(663)},
									ClassFieldName:    common.String("EXAMPLE-classFieldName-Value"),
									DefaultValue:      &defaultValue,
									Description:       common.String("EXAMPLE-description-Value"),
									IsClassFieldValue: common.Bool(true),
									IsStatic:          common.Bool(true),
									ParameterName:     common.String("EXAMPLE-parameterName-Value")}}},
							Description:  common.String("EXAMPLE-description-Value"),
							DtType:       dataintegration.DataTypeDtTypeStructured,
							Key:          common.String("EXAMPLE-key-Value"),
							Name:         common.String("EXAMPLE-name-Value"),
							ObjectStatus: common.Int(360)}}},
					Description:   common.String("EXAMPLE-description-Value"),
					KeyMap:        map[string]string{"EXAMPLE_KEY_xFoQE": "EXAMPLE_VALUE_BsyMxIPdV5E8algzZf5i"},
					ObjectVersion: common.Int(742),
					Host:          common.String("EXAMPLE-host-Value"),
					Key:           common.String("EXAMPLE-key-Value"),
					Metadata: &dataintegration.ObjectMetadata{AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(625),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeUserDefinedFunction}}},
						InfoFields:    map[string]string{"EXAMPLE_KEY_CVuFZ": "EXAMPLE_VALUE_p9pXMiDtpnn8Rta9DUMn"},
						IsFavorite:    common.Bool(true),
						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")},
						CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
						CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(67),
						TimeUpdated:     &common.SDKTime{Time: time.Now()},
						UpdatedBy:       common.String("EXAMPLE-updatedBy-Value")},
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					Port:          common.String("EXAMPLE-port-Value"),
					DataAssetType: common.String("EXAMPLE-dataAssetType-Value"),
					Identifier:    common.String("EXAMPLE-identifier-Value"),
					ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
					Name:          common.String("EXAMPLE-name-Value")},
				Schema: &dataintegration.Schema{ObjectStatus: common.Int(531),
					ObjectVersion: common.Int(493),
					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"),
					Description:       common.String("EXAMPLE-description-Value"),
					ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
					ModelType:         common.String("EXAMPLE-modelType-Value"),
					Name:              common.String("EXAMPLE-name-Value"),
					ResourceName:      common.String("EXAMPLE-resourceName-Value"),
					Identifier:        common.String("EXAMPLE-identifier-Value"),
					IsHasContainers:   common.Bool(true),
					Key:               common.String("EXAMPLE-key-Value"),
					Metadata: &dataintegration.ObjectMetadata{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{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"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(233),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeUserDefinedFunction}}},
						CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
						CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
						IsFavorite:      common.Bool(false),
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(568),
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_dEL75": "EXAMPLE_VALUE_AQJjTHg9QLHnK1uQpoFS"}},
					ModelVersion: common.String("EXAMPLE-modelVersion-Value")}}},
		WorkspaceId:             common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-workspaceId-Value"),
		ExternalPublicationsKey: common.String("EXAMPLE-externalPublicationsKey-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)
}