// 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{ExternalPublicationsKey: common.String("EXAMPLE-externalPublicationsKey-Value"),
		IfMatch:      common.String("EXAMPLE-ifMatch-Value"),
		OpcRequestId: common.String("VNUHTGMJZHY7H0MDYYUQ<unique_ID>"),
		TaskKey:      common.String("EXAMPLE-taskKey-Value"),
		UpdateExternalPublicationDetails: dataintegration.UpdateExternalPublicationDetails{ApplicationId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-applicationId-Value"),
			ConfigurationDetails: &dataintegration.ConfigurationDetails{DataAsset: dataintegration.DataAssetFromRestDetails{BaseUrl: common.String("EXAMPLE-baseUrl-Value"),
				KeyMap: map[string]string{"EXAMPLE_KEY_M1IHx": "EXAMPLE_VALUE_OVcHvxpYNaOf1LrW2vWO"},
				Metadata: &dataintegration.ObjectMetadata{RegistryVersion: common.Int(682),
					TimeCreated:    &common.SDKTime{Time: time.Now()},
					UpdatedBy:      common.String("EXAMPLE-updatedBy-Value"),
					CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
					IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
					CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
					Labels:         []string{"EXAMPLE--Value"},
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(216),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeUserDefinedFunction}}},
					TimeUpdated: &common.SDKTime{Time: time.Now()},
					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"),
					UpdatedByName: common.String("EXAMPLE-updatedByName-Value"),
					InfoFields:    map[string]string{"EXAMPLE_KEY_ttvN9": "EXAMPLE_VALUE_BqeEnr8VKcla9B825AP5"},
					IsFavorite:    common.Bool(true)},
				NativeTypeSystem: &dataintegration.TypeSystem{Key: common.String("EXAMPLE-key-Value"),
					Name:            common.String("EXAMPLE-name-Value"),
					ObjectStatus:    common.Int(136),
					TypeMappingFrom: map[string]string{"EXAMPLE_KEY_2f8yI": "EXAMPLE_VALUE_6FqMys327doVO2Xe1kb6"},
					TypeMappingTo:   map[string]string{"EXAMPLE_KEY_AZof9": "EXAMPLE_VALUE_fSk8vDuQMBXYM55HFT7o"},
					Identifier:      common.String("EXAMPLE-identifier-Value"),
					ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
					ObjectVersion:   common.Int(756),
					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{Description: common.String("EXAMPLE-description-Value"),
						ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
						ObjectStatus: common.Int(970),
						ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
							RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
						ConfigDefinition: &dataintegration.ConfigDefinition{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_UU7xL": dataintegration.ConfigParameterDefinition{Description: common.String("EXAMPLE-description-Value"),
								IsClassFieldValue: common.Bool(false),
								IsStatic:          common.Bool(true),
								ParameterName:     common.String("EXAMPLE-parameterName-Value"),
								ParameterType: dataintegration.MapType{ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
									RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
									ContainsNull:     common.Bool(false),
									Description:      common.String("EXAMPLE-description-Value"),
									ModelVersion:     common.String("EXAMPLE-modelVersion-Value"),
									Name:             common.String("EXAMPLE-name-Value"),
									ObjectStatus:     common.Int(471),
									ValueElementType: common.String("EXAMPLE-valueElementType-Value"),
									Key:              common.String("EXAMPLE-key-Value"),
									KeyElementType:   common.String("EXAMPLE-keyElementType-Value")},
								ClassFieldName: common.String("EXAMPLE-classFieldName-Value"),
								DefaultValue:   &defaultValue}},
							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(380)},
						Key:            common.String("EXAMPLE-key-Value"),
						Name:           common.String("EXAMPLE-name-Value"),
						TypeSystemName: common.String("EXAMPLE-typeSystemName-Value"),
						DtType:         dataintegration.DataTypeDtTypeStructured}},
					Description: common.String("EXAMPLE-description-Value")},
				Description:     common.String("EXAMPLE-description-Value"),
				Key:             common.String("EXAMPLE-key-Value"),
				ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
				ObjectStatus:    common.Int(776),
				Name:            common.String("EXAMPLE-name-Value"),
				ObjectVersion:   common.Int(74),
				AssetProperties: map[string]string{"EXAMPLE_KEY_g5Ag0": "EXAMPLE_VALUE_3PzQm26LOanmfInmRQ0J"},
				DefaultConnection: dataintegration.ConnectionFromRestNoAuthDetails{ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
					Value: common.String("EXAMPLE-value-Value")}},
					Key:           common.String("EXAMPLE-key-Value"),
					ObjectVersion: common.Int(202),
					Description:   common.String("EXAMPLE-description-Value"),
					Identifier:    common.String("EXAMPLE-identifier-Value"),
					IsDefault:     common.Bool(true),
					Metadata: &dataintegration.ObjectMetadata{RegistryVersion: common.Int(736),
						TimeUpdated:    &common.SDKTime{Time: time.Now()},
						CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						InfoFields:     map[string]string{"EXAMPLE_KEY_JQeQE": "EXAMPLE_VALUE_BusCnxTe1IJTLCUOAYmb"},
						UpdatedByName:  common.String("EXAMPLE-updatedByName-Value"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectType: dataintegration.CountStatisticSummaryObjectTypeUserDefinedFunction,
							ObjectCount: common.Int64(802)}}},
						CreatedBy:   common.String("EXAMPLE-createdBy-Value"),
						TimeCreated: &common.SDKTime{Time: time.Now()},
						IsFavorite:  common.Bool(true),
						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"),
						Labels:        []string{"EXAMPLE--Value"}},
					ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					Name:         common.String("EXAMPLE-name-Value"),
					ObjectStatus: common.Int(146),
					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"),
						ObjectStatus:  common.Int(733),
						ObjectVersion: common.Int(769),
						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")},
							InfoFields:      map[string]string{"EXAMPLE_KEY_fsstb": "EXAMPLE_VALUE_K0TaBPgdLRobIUB4nwsz"},
							TimeUpdated:     &common.SDKTime{Time: time.Now()},
							AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
							Labels:          []string{"EXAMPLE--Value"},
							TimeCreated:     &common.SDKTime{Time: time.Now()},
							CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
							CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
							RegistryVersion: common.Int(770),
							UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(959),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeConnection}}},
							IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
							IsFavorite:     common.Bool(false),
							UpdatedBy:      common.String("EXAMPLE-updatedBy-Value")},
						ResourceName:    common.String("EXAMPLE-resourceName-Value"),
						Description:     common.String("EXAMPLE-description-Value"),
						IsHasContainers: common.Bool(false),
						Name:            common.String("EXAMPLE-name-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")},
						DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
						Identifier:        common.String("EXAMPLE-identifier-Value"),
						Key:               common.String("EXAMPLE-key-Value")}},
				ExternalKey:         common.String("EXAMPLE-externalKey-Value"),
				Identifier:          common.String("EXAMPLE-identifier-Value"),
				ManifestFileContent: common.String("EXAMPLE-manifestFileContent-Value"),
				ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
					RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")}},
				Schema: &dataintegration.Schema{Key: common.String("EXAMPLE-key-Value"),
					ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
					ObjectVersion: common.Int(163),
					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),
					Identifier:        common.String("EXAMPLE-identifier-Value"),
					ObjectStatus:      common.Int(675),
					Name:              common.String("EXAMPLE-name-Value"),
					Metadata: &dataintegration.ObjectMetadata{CreatedByName: common.String("EXAMPLE-createdByName-Value"),
						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"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(335),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset}}},
						CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_jfCvO": "EXAMPLE_VALUE_gNGXYF2GtJWGc03XDcKY"},
						IsFavorite:      common.Bool(false),
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(533),
						TimeCreated:     &common.SDKTime{Time: time.Now()},
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value")},
					ModelType:    common.String("EXAMPLE-modelType-Value"),
					ResourceName: common.String("EXAMPLE-resourceName-Value"),
					Description:  common.String("EXAMPLE-description-Value"),
					ExternalKey:  common.String("EXAMPLE-externalKey-Value")},
				CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
				Connection: dataintegration.ConnectionFromOraclePeopleSoft{PrimarySchema: &dataintegration.Schema{Metadata: &dataintegration.ObjectMetadata{RegistryVersion: common.Int(437),
					TimeUpdated: &common.SDKTime{Time: time.Now()},
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(584),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeUserDefinedFunction}}},
					CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
					CreatedByName: common.String("EXAMPLE-createdByName-Value"),
					TimeCreated:   &common.SDKTime{Time: time.Now()},
					UpdatedBy:     common.String("EXAMPLE-updatedBy-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")},
					IsFavorite:     common.Bool(false),
					Labels:         []string{"EXAMPLE--Value"},
					AggregatorKey:  common.String("EXAMPLE-aggregatorKey-Value"),
					IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
					InfoFields:     map[string]string{"EXAMPLE_KEY_q4SxM": "EXAMPLE_VALUE_RemEkJ97eDGz8ArSfoMF"},
					UpdatedByName:  common.String("EXAMPLE-updatedByName-Value")},
					ObjectStatus:  common.Int(504),
					ObjectVersion: common.Int(934),
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					IsHasContainers:   common.Bool(true),
					Description:       common.String("EXAMPLE-description-Value"),
					Identifier:        common.String("EXAMPLE-identifier-Value"),
					Key:               common.String("EXAMPLE-key-Value"),
					ResourceName:      common.String("EXAMPLE-resourceName-Value"),
					DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
					Name:              common.String("EXAMPLE-name-Value"),
					ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
					ExternalKey:       common.String("EXAMPLE-externalKey-Value")},
					Identifier:   common.String("EXAMPLE-identifier-Value"),
					ObjectStatus: common.Int(189),
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					Name:          common.String("EXAMPLE-name-Value"),
					ObjectVersion: common.Int(559),
					Description:   common.String("EXAMPLE-description-Value"),
					IsDefault:     common.Bool(false),
					Password:      common.String("EXAMPLE-password-Value"),
					Username:      common.String("EXAMPLE-username-Value"),
					ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
						Value: common.String("EXAMPLE-value-Value")}},
					Key: common.String("EXAMPLE-key-Value"),
					Metadata: &dataintegration.ObjectMetadata{InfoFields: map[string]string{"EXAMPLE_KEY_IuylQ": "EXAMPLE_VALUE_QNpgLD0WFroyoXvcSmAp"},
						RegistryVersion: common.Int(491),
						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")},
						CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
						CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						Labels:         []string{"EXAMPLE--Value"},
						IsFavorite:     common.Bool(false),
						AggregatorKey:  common.String("EXAMPLE-aggregatorKey-Value"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(437),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeFolder}}},
						TimeCreated: &common.SDKTime{Time: time.Now()}},
					KeyMap:       map[string]string{"EXAMPLE_KEY_Dx8xo": "EXAMPLE_VALUE_RnTl7w5V6McoH26wKxi6"},
					ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					PasswordSecret: &dataintegration.SensitiveAttribute{Value: common.String("EXAMPLE-value-Value"),
						SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")}}}},
			Description: common.String("EXAMPLE-description-Value"),
			DisplayName: common.String("EXAMPLE-displayName-Value"),
			ResourceConfiguration: &dataintegration.ResourceConfiguration{SparkVersion: common.String("EXAMPLE-sparkVersion-Value"),
				TotalExecutors: common.Int(678),
				DriverShape:    common.String("EXAMPLE-driverShape-Value"),
				ExecutorShape:  common.String("EXAMPLE-executorShape-Value")},
			ApplicationCompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-applicationCompartmentId-Value")},
		WorkspaceId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-workspaceId-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)
}