// 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("MGQYNKCSKN2WOXZ8HORQ<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{ExecutorShape: common.String("EXAMPLE-executorShape-Value"),
				SparkVersion:   common.String("EXAMPLE-sparkVersion-Value"),
				TotalExecutors: common.Int(411),
				DriverShape:    common.String("EXAMPLE-driverShape-Value")},
			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.ConnectionFromRestBasicAuth{Description: common.String("EXAMPLE-description-Value"),
					Identifier: common.String("EXAMPLE-identifier-Value"),
					Key:        common.String("EXAMPLE-key-Value"),
					KeyMap:     map[string]string{"EXAMPLE_KEY_Ssqsm": "EXAMPLE_VALUE_bqumzhFGsKaIhwpEsXpE"},
					PasswordSecret: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
						Value: common.String("EXAMPLE-value-Value")},
					AuthHeader:    common.String("EXAMPLE-authHeader-Value"),
					IsDefault:     common.Bool(false),
					ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
					ObjectVersion: common.Int(749),
					PrimarySchema: &dataintegration.Schema{Name: common.String("EXAMPLE-name-Value"),
						ObjectVersion: common.Int(414),
						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"),
						IsHasContainers:   common.Bool(false),
						Key:               common.String("EXAMPLE-key-Value"),
						ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
						ObjectStatus:      common.Int(989),
						ResourceName:      common.String("EXAMPLE-resourceName-Value"),
						Description:       common.String("EXAMPLE-description-Value"),
						ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
						Identifier:        common.String("EXAMPLE-identifier-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"),
							CreatedByName: common.String("EXAMPLE-createdByName-Value"),
							InfoFields:    map[string]string{"EXAMPLE_KEY_tqV01": "EXAMPLE_VALUE_0FhhxhIIY0aaPFxItfkC"},
							IsFavorite:    common.Bool(false),
							Labels:        []string{"EXAMPLE--Value"},
							TimeCreated:   &common.SDKTime{Time: time.Now()},
							TimeUpdated:   &common.SDKTime{Time: time.Now()},
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(256),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeUserDefinedFunction}}},
							CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
							IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
							RegistryVersion: common.Int(3),
							UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
							UpdatedByName:   common.String("EXAMPLE-updatedByName-Value")}},
					Username: common.String("EXAMPLE-username-Value"),
					ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
						Value: common.String("EXAMPLE-value-Value")}},
					Metadata: &dataintegration.ObjectMetadata{RegistryVersion: common.Int(667),
						TimeCreated: &common.SDKTime{Time: time.Now()},
						TimeUpdated: &common.SDKTime{Time: time.Now()},
						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")},
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(178),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeProject}}},
						InfoFields:     map[string]string{"EXAMPLE_KEY_efrma": "EXAMPLE_VALUE_JCstB4CHSBjdxwYXNmUX"},
						IsFavorite:     common.Bool(false),
						UpdatedBy:      common.String("EXAMPLE-updatedBy-Value"),
						UpdatedByName:  common.String("EXAMPLE-updatedByName-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"}},
					Name:         common.String("EXAMPLE-name-Value"),
					ObjectStatus: common.Int(151),
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")}},
				DataAsset: dataintegration.DataAssetFromOracleDetails{Metadata: &dataintegration.ObjectMetadata{IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
					InfoFields:      map[string]string{"EXAMPLE_KEY_94Iqj": "EXAMPLE_VALUE_2TxRABRRTbhfxwenkNgu"},
					RegistryVersion: common.Int(429),
					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")},
					CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
					IsFavorite:    common.Bool(false),
					Labels:        []string{"EXAMPLE--Value"},
					TimeUpdated:   &common.SDKTime{Time: time.Now()},
					UpdatedBy:     common.String("EXAMPLE-updatedBy-Value"),
					AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(309),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeFunctionLibrary}}},
					CreatedByName: common.String("EXAMPLE-createdByName-Value")},
					ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					Name:         common.String("EXAMPLE-name-Value"),
					NativeTypeSystem: &dataintegration.TypeSystem{Key: common.String("EXAMPLE-key-Value"),
						ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
						Name:          common.String("EXAMPLE-name-Value"),
						ObjectVersion: common.Int(764),
						ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
							Parent: common.String("EXAMPLE-parent-Value")},
						TypeMappingFrom: map[string]string{"EXAMPLE_KEY_p5wJX": "EXAMPLE_VALUE_OVpVqkOCTAjBt1GK0bAV"},
						Types: []dataintegration.DataType{dataintegration.DataType{Description: common.String("EXAMPLE-description-Value"),
							DtType:       dataintegration.DataTypeDtTypePrimitive,
							Key:          common.String("EXAMPLE-key-Value"),
							ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
							ObjectStatus: common.Int(514),
							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{ObjectStatus: common.Int(179),
								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_1H0uG": dataintegration.ConfigParameterDefinition{ClassFieldName: common.String("EXAMPLE-classFieldName-Value"),
									DefaultValue:      &defaultValue,
									Description:       common.String("EXAMPLE-description-Value"),
									IsClassFieldValue: common.Bool(false),
									IsStatic:          common.Bool(true),
									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(788),
										ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
											RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")}}}},
								IsContained:  common.Bool(true),
								Key:          common.String("EXAMPLE-key-Value"),
								ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
								Name:         common.String("EXAMPLE-name-Value")},
							Name: common.String("EXAMPLE-name-Value")}},
						Description:   common.String("EXAMPLE-description-Value"),
						Identifier:    common.String("EXAMPLE-identifier-Value"),
						ObjectStatus:  common.Int(352),
						TypeMappingTo: map[string]string{"EXAMPLE_KEY_HqotU": "EXAMPLE_VALUE_dtYH0vlWFWYLYAIPfxOG"}},
					ObjectStatus:  common.Int(639),
					ObjectVersion: common.Int(305),
					Host:          common.String("EXAMPLE-host-Value"),
					Identifier:    common.String("EXAMPLE-identifier-Value"),
					KeyMap:        map[string]string{"EXAMPLE_KEY_yyElo": "EXAMPLE_VALUE_S5CwPgSjzB3Gmej4xTjm"},
					ServiceName:   common.String("EXAMPLE-serviceName-Value"),
					Sid:           common.String("EXAMPLE-sid-Value"),
					Description:   common.String("EXAMPLE-description-Value"),
					Key:           common.String("EXAMPLE-key-Value"),
					Port:          common.String("EXAMPLE-port-Value"),
					WalletSecret: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
						Value: common.String("EXAMPLE-value-Value")},
					AssetProperties:       map[string]string{"EXAMPLE_KEY_6IuMB": "EXAMPLE_VALUE_mePEJzgHaZcQKwjQlrAV"},
					CredentialFileContent: common.String("EXAMPLE-credentialFileContent-Value"),
					DefaultConnection: &dataintegration.ConnectionFromOracleDetails{Name: common.String("EXAMPLE-name-Value"),
						Username: common.String("EXAMPLE-username-Value"),
						ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
							Value: common.String("EXAMPLE-value-Value")}},
						ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
						ObjectStatus:  common.Int(267),
						ObjectVersion: common.Int(679),
						Description:   common.String("EXAMPLE-description-Value"),
						IsDefault:     common.Bool(false),
						Password:      common.String("EXAMPLE-password-Value"),
						Metadata: &dataintegration.ObjectMetadata{IsFavorite: common.Bool(true),
							RegistryVersion: common.Int(470),
							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"},
							TimeCreated:   &common.SDKTime{Time: time.Now()},
							UpdatedBy:     common.String("EXAMPLE-updatedBy-Value"),
							AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(285),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeApplication}}},
							IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
							InfoFields:     map[string]string{"EXAMPLE_KEY_97XPE": "EXAMPLE_VALUE_gyKtVMKlTooMh5VUmWBM"}},
						ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
							RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
						PasswordSecret: &dataintegration.SensitiveAttribute{Value: common.String("EXAMPLE-value-Value"),
							SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")}},
						PrimarySchema: &dataintegration.Schema{ExternalKey: common.String("EXAMPLE-externalKey-Value"),
							Identifier:      common.String("EXAMPLE-identifier-Value"),
							IsHasContainers: common.Bool(false),
							Metadata: &dataintegration.ObjectMetadata{CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(60),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeTask}}},
								IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
								IsFavorite:     common.Bool(false),
								TimeUpdated:    &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"),
								InfoFields:      map[string]string{"EXAMPLE_KEY_HSE3w": "EXAMPLE_VALUE_b5MVcX8e39VHuI5wmxGT"},
								Labels:          []string{"EXAMPLE--Value"},
								RegistryVersion: common.Int(112),
								TimeCreated:     &common.SDKTime{Time: time.Now()}},
							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")},
							ResourceName:      common.String("EXAMPLE-resourceName-Value"),
							DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
							Description:       common.String("EXAMPLE-description-Value"),
							Key:               common.String("EXAMPLE-key-Value"),
							ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
							ObjectStatus:      common.Int(390),
							ObjectVersion:     common.Int(215)},
						Identifier: common.String("EXAMPLE-identifier-Value"),
						Key:        common.String("EXAMPLE-key-Value")},
					ExternalKey: common.String("EXAMPLE-externalKey-Value"),
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					WalletPasswordSecret: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
						Value: common.String("EXAMPLE-value-Value")},
					DriverClass: common.String("EXAMPLE-driverClass-Value")},
				Schema: &dataintegration.Schema{Name: common.String("EXAMPLE-name-Value"),
					ObjectVersion:   common.Int(185),
					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(true),
					Key:             common.String("EXAMPLE-key-Value"),
					ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
					ObjectStatus:    common.Int(915),
					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"),
					Metadata: &dataintegration.ObjectMetadata{Labels: []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(719),
						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(751),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeApplication}}},
						CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						InfoFields:     map[string]string{"EXAMPLE_KEY_IPDZz": "EXAMPLE_VALUE_ruOwLKtvLFgNeD1oexfy"},
						IsFavorite:     common.Bool(false),
						TimeCreated:    &common.SDKTime{Time: time.Now()},
						CreatedBy:      common.String("EXAMPLE-createdBy-Value")},
					ModelType: common.String("EXAMPLE-modelType-Value")}}},
		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)
}