// 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{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")}},
				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")},
				KeyMap: map[string]string{"EXAMPLE_KEY_CAuF2": "EXAMPLE_VALUE_zn1dPa4ecp6D2LDl3sHL"},
				PasswordSecret: &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"),
				Identifier:  common.String("EXAMPLE-identifier-Value"),
				IsDefault:   common.Bool(true),
				Key:         common.String("EXAMPLE-key-Value"),
				Metadata: &dataintegration.ObjectMetadata{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")},
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(348),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataFlow}}},
					CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
					IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
					IsFavorite:      common.Bool(false),
					RegistryVersion: common.Int(874),
					TimeUpdated:     &common.SDKTime{Time: time.Now()},
					AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
					CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
					InfoFields:      map[string]string{"EXAMPLE_KEY_Dyn4q": "EXAMPLE_VALUE_kPIRsL2IzLRbcRVKgmy5"},
					Labels:          []string{"EXAMPLE--Value"},
					TimeCreated:     &common.SDKTime{Time: time.Now()}},
				Name: common.String("EXAMPLE-name-Value"),
				PrimarySchema: &dataintegration.Schema{Description: common.String("EXAMPLE-description-Value"),
					ExternalKey:     common.String("EXAMPLE-externalKey-Value"),
					Identifier:      common.String("EXAMPLE-identifier-Value"),
					IsHasContainers: common.Bool(false),
					Metadata: &dataintegration.ObjectMetadata{Labels: []string{"EXAMPLE--Value"},
						TimeCreated:   &common.SDKTime{Time: time.Now()},
						UpdatedBy:     common.String("EXAMPLE-updatedBy-Value"),
						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"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(921),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeTask}}},
						CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_2vY9p": "EXAMPLE_VALUE_d0gI3abpfOcQw2I48aaZ"},
						IsFavorite:      common.Bool(true),
						RegistryVersion: common.Int(285),
						TimeUpdated:     &common.SDKTime{Time: time.Now()},
						CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value")},
					ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
					Name:          common.String("EXAMPLE-name-Value"),
					Key:           common.String("EXAMPLE-key-Value"),
					ObjectStatus:  common.Int(500),
					ObjectVersion: common.Int(312),
					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")},
				Username:      common.String("EXAMPLE-username-Value"),
				ObjectStatus:  common.Int(681),
				ObjectVersion: common.Int(303)},
			DataAsset: dataintegration.DataAssetFromOracleDetails{Host: common.String("EXAMPLE-host-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"),
				Identifier:   common.String("EXAMPLE-identifier-Value"),
				ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
				NativeTypeSystem: &dataintegration.TypeSystem{ObjectVersion: common.Int(324),
					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_mGLTo": "EXAMPLE_VALUE_3IBGb1c5JAsjJvzLiuJN"},
					TypeMappingTo:   map[string]string{"EXAMPLE_KEY_V7ZXR": "EXAMPLE_VALUE_J7qwbDgbYYKzPzvTpRuN"},
					Types: []dataintegration.DataType{dataintegration.DataType{ConfigDefinition: &dataintegration.ConfigDefinition{ConfigParameterDefinitions: map[string]dataintegration.ConfigParameterDefinition{"EXAMPLE_KEY_mqi9r": dataintegration.ConfigParameterDefinition{ClassFieldName: common.String("EXAMPLE-classFieldName-Value"),
						DefaultValue:      &defaultValue,
						Description:       common.String("EXAMPLE-description-Value"),
						IsClassFieldValue: common.Bool(true),
						IsStatic:          common.Bool(false),
						ParameterName:     common.String("EXAMPLE-parameterName-Value"),
						ParameterType: dataintegration.DerivedType{Description: common.String("EXAMPLE-description-Value"),
							Key:          common.String("EXAMPLE-key-Value"),
							ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
							Name:         common.String("EXAMPLE-name-Value"),
							ObjectStatus: common.Int(193),
							ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
								RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")}}}},
						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(604),
						ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
							RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")}},
						DtType: dataintegration.DataTypeDtTypeStructured,
						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")},
						Description:    common.String("EXAMPLE-description-Value"),
						Key:            common.String("EXAMPLE-key-Value"),
						ModelVersion:   common.String("EXAMPLE-modelVersion-Value"),
						ObjectStatus:   common.Int(664),
						TypeSystemName: common.String("EXAMPLE-typeSystemName-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"),
					Name:         common.String("EXAMPLE-name-Value"),
					ObjectStatus: common.Int(461)},
				ObjectVersion:   common.Int(729),
				Sid:             common.String("EXAMPLE-sid-Value"),
				AssetProperties: map[string]string{"EXAMPLE_KEY_odtaU": "EXAMPLE_VALUE_ZH6TIGpg9DaN9CoOZQmo"},
				Key:             common.String("EXAMPLE-key-Value"),
				KeyMap:          map[string]string{"EXAMPLE_KEY_PKm2z": "EXAMPLE_VALUE_ldjSMlJsaPX015qWmC26"},
				Metadata: &dataintegration.ObjectMetadata{TimeUpdated: &common.SDKTime{Time: time.Now()},
					AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
					IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
					Labels:          []string{"EXAMPLE--Value"},
					RegistryVersion: common.Int(73),
					TimeCreated:     &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")},
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(44),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeFolder}}},
					CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
					CreatedByName: common.String("EXAMPLE-createdByName-Value"),
					InfoFields:    map[string]string{"EXAMPLE_KEY_1kj2v": "EXAMPLE_VALUE_PoGcA0xNriC8hyPpwAUN"},
					IsFavorite:    common.Bool(false)},
				Name:         common.String("EXAMPLE-name-Value"),
				ObjectStatus: common.Int(888),
				WalletPasswordSecret: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
					Value: common.String("EXAMPLE-value-Value")},
				CredentialFileContent: common.String("EXAMPLE-credentialFileContent-Value"),
				DefaultConnection: &dataintegration.ConnectionFromOracleDetails{PrimarySchema: &dataintegration.Schema{ObjectVersion: common.Int(1),
					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"),
					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{RegistryVersion: common.Int(550),
						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")},
						CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						TimeUpdated:    &common.SDKTime{Time: time.Now()},
						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(890),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeFunctionLibrary}}},
						CreatedBy:  common.String("EXAMPLE-createdBy-Value"),
						InfoFields: map[string]string{"EXAMPLE_KEY_DUzgj": "EXAMPLE_VALUE_wofHEed1jQuJTayXhpmm"},
						IsFavorite: common.Bool(true),
						Labels:     []string{"EXAMPLE--Value"}},
					ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
					Name:              common.String("EXAMPLE-name-Value"),
					DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
					Description:       common.String("EXAMPLE-description-Value"),
					ObjectStatus:      common.Int(545)},
					Description: common.String("EXAMPLE-description-Value"),
					Identifier:  common.String("EXAMPLE-identifier-Value"),
					IsDefault:   common.Bool(false),
					PasswordSecret: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
						Value: common.String("EXAMPLE-value-Value")},
					ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
						Value: common.String("EXAMPLE-value-Value")}},
					Metadata: &dataintegration.ObjectMetadata{InfoFields: map[string]string{"EXAMPLE_KEY_1Wx2l": "EXAMPLE_VALUE_Y3R9xUgKEliDCGezykfI"},
						IsFavorite:      common.Bool(true),
						RegistryVersion: common.Int(966),
						TimeUpdated:     &common.SDKTime{Time: time.Now()},
						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")},
						AggregatorKey:  common.String("EXAMPLE-aggregatorKey-Value"),
						CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						Labels:         []string{"EXAMPLE--Value"},
						TimeCreated:    &common.SDKTime{Time: time.Now()},
						UpdatedByName:  common.String("EXAMPLE-updatedByName-Value"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(890),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeConnection}}},
						CreatedByName: common.String("EXAMPLE-createdByName-Value")},
					ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
					Name:          common.String("EXAMPLE-name-Value"),
					ObjectVersion: common.Int(899),
					Key:           common.String("EXAMPLE-key-Value"),
					ObjectStatus:  common.Int(786),
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					Username: common.String("EXAMPLE-username-Value"),
					Password: common.String("EXAMPLE-password-Value")},
				Description: common.String("EXAMPLE-description-Value"),
				DriverClass: common.String("EXAMPLE-driverClass-Value"),
				ExternalKey: common.String("EXAMPLE-externalKey-Value"),
				ServiceName: common.String("EXAMPLE-serviceName-Value"),
				WalletSecret: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
					Value: common.String("EXAMPLE-value-Value")}},
			Schema: &dataintegration.Schema{DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
				Key: common.String("EXAMPLE-key-Value"),
				Metadata: &dataintegration.ObjectMetadata{CreatedBy: common.String("EXAMPLE-createdBy-Value"),
					InfoFields:      map[string]string{"EXAMPLE_KEY_16GOX": "EXAMPLE_VALUE_Q705ca07sihZux5qYCWb"},
					TimeUpdated:     &common.SDKTime{Time: time.Now()},
					UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
					AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
					CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
					IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
					IsFavorite:      common.Bool(false),
					Labels:          []string{"EXAMPLE--Value"},
					RegistryVersion: common.Int(63),
					TimeCreated:     &common.SDKTime{Time: time.Now()},
					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")},
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(513),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeApplication}}}},
				ObjectVersion: common.Int(527),
				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"),
				Description:     common.String("EXAMPLE-description-Value"),
				ExternalKey:     common.String("EXAMPLE-externalKey-Value"),
				Identifier:      common.String("EXAMPLE-identifier-Value"),
				IsHasContainers: common.Bool(false),
				ModelType:       common.String("EXAMPLE-modelType-Value"),
				ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
				Name:            common.String("EXAMPLE-name-Value"),
				ObjectStatus:    common.Int(177)}},
		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(486)}},
		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("8EU9R2TGRAZYD2PUNHRC<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)
}