// 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("NFXUF4VJGGSHSSRKMZJI<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.ConnectionFromOracle{Password: common.String("EXAMPLE-password-Value"),
					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"),
					Description: common.String("EXAMPLE-description-Value"),
					ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
						Value: common.String("EXAMPLE-value-Value")}},
					Identifier: common.String("EXAMPLE-identifier-Value"),
					IsDefault:  common.Bool(false),
					KeyMap:     map[string]string{"EXAMPLE_KEY_kwbLk": "EXAMPLE_VALUE_qvDoNqVK2nZsHXCyKDTk"},
					Metadata: &dataintegration.ObjectMetadata{IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_MCWuH": "EXAMPLE_VALUE_JRrulO3vEGCPfFfvsXQf"},
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(593),
						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(854),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeFunctionLibrary}}},
						CreatedByName: common.String("EXAMPLE-createdByName-Value"),
						IsFavorite:    common.Bool(false),
						TimeCreated:   &common.SDKTime{Time: time.Now()},
						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")},
						CreatedBy: common.String("EXAMPLE-createdBy-Value")},
					Name:         common.String("EXAMPLE-name-Value"),
					ObjectStatus: common.Int(841),
					PrimarySchema: &dataintegration.Schema{Metadata: &dataintegration.ObjectMetadata{IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_y86Uo": "EXAMPLE_VALUE_4k9T1cGam61XnZKcShsO"},
						RegistryVersion: common.Int(553),
						TimeUpdated:     &common.SDKTime{Time: time.Now()},
						CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
						IsFavorite:      common.Bool(true),
						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(944),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeFunctionLibrary}}},
						CreatedByName: common.String("EXAMPLE-createdByName-Value")},
						ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
						ObjectStatus:  common.Int(867),
						ObjectVersion: common.Int(298),
						ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
							RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
						ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
						Identifier:        common.String("EXAMPLE-identifier-Value"),
						Key:               common.String("EXAMPLE-key-Value"),
						Name:              common.String("EXAMPLE-name-Value"),
						ResourceName:      common.String("EXAMPLE-resourceName-Value"),
						DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
						Description:       common.String("EXAMPLE-description-Value"),
						IsHasContainers:   common.Bool(false)},
					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"),
					ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
					ObjectVersion: common.Int(701)},
				DataAsset: dataintegration.DataAssetFromOraclePeopleSoftDetails{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					ObjectStatus: common.Int(702),
					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")},
					AssetProperties: map[string]string{"EXAMPLE_KEY_Xxqh9": "EXAMPLE_VALUE_fwNNN23yaUWPYzY9s3HW"},
					Identifier:      common.String("EXAMPLE-identifier-Value"),
					KeyMap:          map[string]string{"EXAMPLE_KEY_6Cqyj": "EXAMPLE_VALUE_kudcEP2k8TwAUKQP0Tvp"},
					Metadata: &dataintegration.ObjectMetadata{IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						InfoFields: map[string]string{"EXAMPLE_KEY_z2xbG": "EXAMPLE_VALUE_2vSufLhZHcDYUGdTEXYD"},
						IsFavorite: common.Bool(false),
						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")},
						CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(355),
						TimeCreated:     &common.SDKTime{Time: time.Now()},
						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(643),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset}}},
						CreatedBy: common.String("EXAMPLE-createdBy-Value")},
					Name: common.String("EXAMPLE-name-Value"),
					Port: common.String("EXAMPLE-port-Value"),
					Sid:  common.String("EXAMPLE-sid-Value"),
					DefaultConnection: &dataintegration.ConnectionFromOraclePeopleSoftDetails{ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
						Value: common.String("EXAMPLE-value-Value")}},
						Description: common.String("EXAMPLE-description-Value"),
						Metadata: &dataintegration.ObjectMetadata{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")},
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(669),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset}}},
							CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
							CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
							IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
							InfoFields:      map[string]string{"EXAMPLE_KEY_UYr23": "EXAMPLE_VALUE_dCnNRC3yTD6YppARbKKr"},
							IsFavorite:      common.Bool(true),
							Labels:          []string{"EXAMPLE--Value"},
							AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
							RegistryVersion: common.Int(406),
							TimeCreated:     &common.SDKTime{Time: time.Now()},
							TimeUpdated:     &common.SDKTime{Time: time.Now()}},
						ObjectStatus:  common.Int(487),
						ObjectVersion: common.Int(909),
						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"),
						PasswordSecret: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
							Value: common.String("EXAMPLE-value-Value")},
						PrimarySchema: &dataintegration.Schema{IsHasContainers: common.Bool(false),
							Key: common.String("EXAMPLE-key-Value"),
							Metadata: &dataintegration.ObjectMetadata{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"),
								CreatedByName: common.String("EXAMPLE-createdByName-Value"),
								InfoFields:    map[string]string{"EXAMPLE_KEY_E6pgO": "EXAMPLE_VALUE_9Ix8pXRmocN1cnrY2BpN"},
								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(341),
									ObjectType: dataintegration.CountStatisticSummaryObjectTypeTask}}},
								IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
								IsFavorite:      common.Bool(false),
								RegistryVersion: common.Int(264)},
							ObjectStatus:      common.Int(798),
							ObjectVersion:     common.Int(340),
							DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
							Description:       common.String("EXAMPLE-description-Value"),
							ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
							ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
							Name:              common.String("EXAMPLE-name-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"),
							Identifier:   common.String("EXAMPLE-identifier-Value")},
						IsDefault:    common.Bool(true),
						Identifier:   common.String("EXAMPLE-identifier-Value"),
						ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
						Name:         common.String("EXAMPLE-name-Value"),
						Password:     common.String("EXAMPLE-password-Value"),
						Username:     common.String("EXAMPLE-username-Value")},
					DriverClass:   common.String("EXAMPLE-driverClass-Value"),
					ExternalKey:   common.String("EXAMPLE-externalKey-Value"),
					Host:          common.String("EXAMPLE-host-Value"),
					Key:           common.String("EXAMPLE-key-Value"),
					ObjectVersion: common.Int(584),
					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")},
					NativeTypeSystem: &dataintegration.TypeSystem{Description: common.String("EXAMPLE-description-Value"),
						Identifier:   common.String("EXAMPLE-identifier-Value"),
						ObjectStatus: common.Int(80),
						ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
							RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
						TypeMappingTo: map[string]string{"EXAMPLE_KEY_jyNb0": "EXAMPLE_VALUE_ZFaRTMoxp67ocgR3LbKe"},
						Types: []dataintegration.DataType{dataintegration.DataType{DtType: dataintegration.DataTypeDtTypeStructured,
							ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
							ConfigDefinition: &dataintegration.ConfigDefinition{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
								Name:         common.String("EXAMPLE-name-Value"),
								ObjectStatus: common.Int(710),
								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_wHspi": dataintegration.ConfigParameterDefinition{ParameterName: common.String("EXAMPLE-parameterName-Value"),
									ClassFieldName:    common.String("EXAMPLE-classFieldName-Value"),
									DefaultValue:      &defaultValue,
									Description:       common.String("EXAMPLE-description-Value"),
									IsClassFieldValue: common.Bool(true),
									IsStatic:          common.Bool(false)}},
								IsContained: common.Bool(true),
								Key:         common.String("EXAMPLE-key-Value")},
							Key:          common.String("EXAMPLE-key-Value"),
							Name:         common.String("EXAMPLE-name-Value"),
							ObjectStatus: common.Int(388),
							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"),
							Description:    common.String("EXAMPLE-description-Value")}},
						Key:             common.String("EXAMPLE-key-Value"),
						ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
						Name:            common.String("EXAMPLE-name-Value"),
						ObjectVersion:   common.Int(529),
						TypeMappingFrom: map[string]string{"EXAMPLE_KEY_LqQnM": "EXAMPLE_VALUE_g3NCxIW62zegW402zZAJ"}},
					Description: common.String("EXAMPLE-description-Value")},
				Schema: &dataintegration.Schema{ExternalKey: common.String("EXAMPLE-externalKey-Value"),
					Identifier: common.String("EXAMPLE-identifier-Value"),
					Key:        common.String("EXAMPLE-key-Value"),
					Metadata: &dataintegration.ObjectMetadata{RegistryVersion: common.Int(831),
						TimeUpdated:   &common.SDKTime{Time: time.Now()},
						CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
						InfoFields:    map[string]string{"EXAMPLE_KEY_7QRZM": "EXAMPLE_VALUE_K9TiWML4KTlodzQOIU73"},
						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{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(482),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeConnection}}},
						CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						IsFavorite:     common.Bool(false)},
					ObjectStatus:    common.Int(876),
					ObjectVersion:   common.Int(440),
					IsHasContainers: common.Bool(false),
					ModelType:       common.String("EXAMPLE-modelType-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")},
					ResourceName:      common.String("EXAMPLE-resourceName-Value"),
					DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
					Description:       common.String("EXAMPLE-description-Value")}},
			Description: common.String("EXAMPLE-description-Value"),
			DisplayName: common.String("EXAMPLE-displayName-Value"),
			ResourceConfiguration: &dataintegration.ResourceConfiguration{TotalExecutors: common.Int(632),
				DriverShape:   common.String("EXAMPLE-driverShape-Value"),
				ExecutorShape: common.String("EXAMPLE-executorShape-Value"),
				SparkVersion:  common.String("EXAMPLE-sparkVersion-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)
}