// 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.ConnectionFromAmazonS3{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
				Name:         common.String("EXAMPLE-name-Value"),
				Description:  common.String("EXAMPLE-description-Value"),
				KeyMap:       map[string]string{"EXAMPLE_KEY_YCpX8": "EXAMPLE_VALUE_APQTjyzNiD9yVMC2vmlP"},
				ObjectStatus: common.Int(947),
				PrimarySchema: &dataintegration.Schema{ResourceName: common.String("EXAMPLE-resourceName-Value"),
					DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
					ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
					Metadata: &dataintegration.ObjectMetadata{AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
						CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
						IsFavorite:      common.Bool(true),
						RegistryVersion: common.Int(655),
						UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
						UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(591),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeFunctionLibrary}}},
						CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						InfoFields:     map[string]string{"EXAMPLE_KEY_q770a": "EXAMPLE_VALUE_hVWcx0Y9VQIEQEPuKdVy"},
						Labels:         []string{"EXAMPLE--Value"},
						TimeCreated:    &common.SDKTime{Time: time.Now()},
						TimeUpdated:    &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")}},
					ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
					ObjectStatus:  common.Int(190),
					ObjectVersion: common.Int(760),
					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"),
					Identifier:      common.String("EXAMPLE-identifier-Value"),
					IsHasContainers: common.Bool(true),
					Key:             common.String("EXAMPLE-key-Value"),
					Name:            common.String("EXAMPLE-name-Value")},
				SecretKey: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
					Value: common.String("EXAMPLE-value-Value")},
				AccessKey: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
					Value: common.String("EXAMPLE-value-Value")},
				IsDefault: common.Bool(false),
				Key:       common.String("EXAMPLE-key-Value"),
				ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
					Value: common.String("EXAMPLE-value-Value")}},
				Identifier: common.String("EXAMPLE-identifier-Value"),
				Metadata: &dataintegration.ObjectMetadata{RegistryVersion: common.Int(454),
					TimeCreated:    &common.SDKTime{Time: time.Now()},
					AggregatorKey:  common.String("EXAMPLE-aggregatorKey-Value"),
					CreatedBy:      common.String("EXAMPLE-createdBy-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"),
					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")},
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(165),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeProject}}},
					CreatedByName: common.String("EXAMPLE-createdByName-Value"),
					InfoFields:    map[string]string{"EXAMPLE_KEY_a7kJO": "EXAMPLE_VALUE_f7ClHNhZCHrznNo19KKo"},
					IsFavorite:    common.Bool(true),
					Labels:        []string{"EXAMPLE--Value"}},
				ObjectVersion: common.Int(737),
				ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
					RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")}},
			DataAsset: dataintegration.DataAssetFromMySqlHeatWave{Host: common.String("EXAMPLE-host-Value"),
				Metadata: &dataintegration.ObjectMetadata{Labels: []string{"EXAMPLE--Value"},
					CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
					RegistryVersion: common.Int(462),
					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{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(835),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeTask}}},
					CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
					IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
					InfoFields:     map[string]string{"EXAMPLE_KEY_h8lSk": "EXAMPLE_VALUE_J5KOVUyzjvnufjO1pbjL"},
					IsFavorite:     common.Bool(true)},
				ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
					RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
				DefaultConnection: &dataintegration.ConnectionFromMySqlHeatWaveDetails{ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
					Value: common.String("EXAMPLE-value-Value")}},
					Description:   common.String("EXAMPLE-description-Value"),
					Key:           common.String("EXAMPLE-key-Value"),
					ObjectStatus:  common.Int(905),
					ObjectVersion: common.Int(398),
					Identifier:    common.String("EXAMPLE-identifier-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"),
					IsDefault: common.Bool(true),
					Metadata: &dataintegration.ObjectMetadata{IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						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"),
						CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
						CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_pCpIx": "EXAMPLE_VALUE_6RUr6wbBk9jpnMWh0naf"},
						IsFavorite:      common.Bool(false),
						RegistryVersion: common.Int(11),
						TimeUpdated:     &common.SDKTime{Time: time.Now()},
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(329),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeUserDefinedFunction}}}},
					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")},
					Password: common.String("EXAMPLE-password-Value"),
					PrimarySchema: &dataintegration.Schema{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"),
						Identifier:   common.String("EXAMPLE-identifier-Value"),
						Metadata: &dataintegration.ObjectMetadata{RegistryVersion: common.Int(551),
							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{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"),
							CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
							CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
							IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
							InfoFields:     map[string]string{"EXAMPLE_KEY_yOdZC": "EXAMPLE_VALUE_Mpa1QjvocFVtZ9Bp5xeN"},
							IsFavorite:     common.Bool(true),
							Labels:         []string{"EXAMPLE--Value"},
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(172),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeFolder}}}},
						ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
						ObjectStatus:      common.Int(309),
						ObjectVersion:     common.Int(624),
						DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
						Description:       common.String("EXAMPLE-description-Value"),
						ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
						IsHasContainers:   common.Bool(true),
						Key:               common.String("EXAMPLE-key-Value"),
						Name:              common.String("EXAMPLE-name-Value")}},
				ExternalKey:  common.String("EXAMPLE-externalKey-Value"),
				KeyMap:       map[string]string{"EXAMPLE_KEY_H6x2n": "EXAMPLE_VALUE_rA7z71iYvLYfZr218GZm"},
				ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
				Name:         common.String("EXAMPLE-name-Value"),
				NativeTypeSystem: &dataintegration.TypeSystem{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_vO16s": "EXAMPLE_VALUE_0qtSFi8II7rWwRlxieht"},
					TypeMappingTo:   map[string]string{"EXAMPLE_KEY_Nidy0": "EXAMPLE_VALUE_B2pxGu9G6qvam2JZDk2e"},
					Key:             common.String("EXAMPLE-key-Value"),
					Name:            common.String("EXAMPLE-name-Value"),
					ObjectStatus:    common.Int(184),
					ObjectVersion:   common.Int(237),
					Types: []dataintegration.DataType{dataintegration.DataType{Description: common.String("EXAMPLE-description-Value"),
						ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
						ObjectStatus: common.Int(198),
						ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
							Parent: common.String("EXAMPLE-parent-Value")},
						TypeSystemName: common.String("EXAMPLE-typeSystemName-Value"),
						ConfigDefinition: &dataintegration.ConfigDefinition{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
							Name:         common.String("EXAMPLE-name-Value"),
							ObjectStatus: common.Int(148),
							ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
								Parent: common.String("EXAMPLE-parent-Value")},
							ConfigParameterDefinitions: map[string]dataintegration.ConfigParameterDefinition{"EXAMPLE_KEY_1SVob": dataintegration.ConfigParameterDefinition{IsClassFieldValue: common.Bool(true),
								IsStatic:      common.Bool(true),
								ParameterName: common.String("EXAMPLE-parameterName-Value"),
								ParameterType: dataintegration.MapType{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
									Name:         common.String("EXAMPLE-name-Value"),
									ObjectStatus: common.Int(968),
									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"),
									ValueElementType: common.String("EXAMPLE-valueElementType-Value"),
									ContainsNull:     common.Bool(true),
									Key:              common.String("EXAMPLE-key-Value"),
									KeyElementType:   common.String("EXAMPLE-keyElementType-Value")},
								ClassFieldName: common.String("EXAMPLE-classFieldName-Value"),
								DefaultValue:   &defaultValue,
								Description:    common.String("EXAMPLE-description-Value")}},
							IsContained: common.Bool(false),
							Key:         common.String("EXAMPLE-key-Value")},
						DtType: dataintegration.DataTypeDtTypeStructured,
						Key:    common.String("EXAMPLE-key-Value"),
						Name:   common.String("EXAMPLE-name-Value")}},
					Description:  common.String("EXAMPLE-description-Value"),
					Identifier:   common.String("EXAMPLE-identifier-Value"),
					ModelVersion: common.String("EXAMPLE-modelVersion-Value")},
				ServiceName:     common.String("EXAMPLE-serviceName-Value"),
				AssetProperties: map[string]string{"EXAMPLE_KEY_nHQjo": "EXAMPLE_VALUE_GVEPFOHzpxPME7FUlr5u"},
				Description:     common.String("EXAMPLE-description-Value"),
				Identifier:      common.String("EXAMPLE-identifier-Value"),
				Key:             common.String("EXAMPLE-key-Value"),
				Port:            common.String("EXAMPLE-port-Value"),
				ObjectStatus:    common.Int(675),
				ObjectVersion:   common.Int(521)},
			Schema: &dataintegration.Schema{ResourceName: common.String("EXAMPLE-resourceName-Value"),
				DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
				ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
				Identifier:        common.String("EXAMPLE-identifier-Value"),
				ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
				Name:              common.String("EXAMPLE-name-Value"),
				ObjectStatus:      common.Int(66),
				ObjectVersion:     common.Int(484),
				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"),
				IsHasContainers: common.Bool(false),
				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(959),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeProject}}},
					CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
					InfoFields:      map[string]string{"EXAMPLE_KEY_0PEyS": "EXAMPLE_VALUE_DqvVh4A6y6ppv5ljKhWl"},
					IsFavorite:      common.Bool(true),
					Labels:          []string{"EXAMPLE--Value"},
					RegistryVersion: common.Int(202),
					CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
					IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
					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{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")}},
				ModelType: common.String("EXAMPLE-modelType-Value")}},
		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(386)}},
		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("39R2IMRFOTNVHPUCYTD8<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)
}