// 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("0MRPTVCDVPXUVATT0KP2<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{Schema: &dataintegration.Schema{Identifier: common.String("EXAMPLE-identifier-Value"),
				Metadata: &dataintegration.ObjectMetadata{Labels: []string{"EXAMPLE--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")},
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(435),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeApplication}}},
					CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
					CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
					IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
					InfoFields:      map[string]string{"EXAMPLE_KEY_AEd8Y": "EXAMPLE_VALUE_aoodFsAvaCtS7GTvKhHK"},
					IsFavorite:      common.Bool(false),
					RegistryVersion: common.Int(239),
					AggregatorKey:   common.String("EXAMPLE-aggregatorKey-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")},
				ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
				IsHasContainers:   common.Bool(false),
				Key:               common.String("EXAMPLE-key-Value"),
				ModelType:         common.String("EXAMPLE-modelType-Value"),
				ObjectStatus:      common.Int(989),
				ObjectVersion:     common.Int(822),
				ResourceName:      common.String("EXAMPLE-resourceName-Value"),
				DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
				Description:       common.String("EXAMPLE-description-Value")},
				CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
				Connection: dataintegration.ConnectionFromAtp{ObjectStatus: common.Int(265),
					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")},
					PrimarySchema: &dataintegration.Schema{Metadata: &dataintegration.ObjectMetadata{CreatedByName: common.String("EXAMPLE-createdByName-Value"),
						InfoFields:    map[string]string{"EXAMPLE_KEY_tqkBc": "EXAMPLE_VALUE_PUosbTQHtv9no8VKkf0s"},
						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{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"),
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						RegistryVersion: common.Int(513),
						TimeUpdated:     &common.SDKTime{Time: time.Now()},
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(102),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataFlow}}}},
						ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
						Key:           common.String("EXAMPLE-key-Value"),
						Name:          common.String("EXAMPLE-name-Value"),
						ObjectStatus:  common.Int(64),
						ObjectVersion: common.Int(957),
						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"),
						DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
						Description:       common.String("EXAMPLE-description-Value"),
						ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
						Identifier:        common.String("EXAMPLE-identifier-Value"),
						IsHasContainers:   common.Bool(true)},
					ObjectVersion: common.Int(624),
					Password:      common.String("EXAMPLE-password-Value"),
					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"),
					PasswordSecret: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
						Value: common.String("EXAMPLE-value-Value")},
					TnsAlias:     common.String("EXAMPLE-tnsAlias-Value"),
					TnsNames:     []string{"EXAMPLE--Value"},
					ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					Username:     common.String("EXAMPLE-username-Value"),
					Identifier:   common.String("EXAMPLE-identifier-Value"),
					IsDefault:    common.Bool(false),
					KeyMap:       map[string]string{"EXAMPLE_KEY_NvsYj": "EXAMPLE_VALUE_qg5pdrjFJ3oWIUxDGVkA"},
					Metadata: &dataintegration.ObjectMetadata{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(35),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeApplication}}},
						CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						IsFavorite:      common.Bool(true),
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(980),
						TimeCreated:     &common.SDKTime{Time: time.Now()},
						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")},
						CreatedByName: common.String("EXAMPLE-createdByName-Value"),
						InfoFields:    map[string]string{"EXAMPLE_KEY_7F2VR": "EXAMPLE_VALUE_DRgiqQkxb0tP7RPuXlek"},
						TimeUpdated:   &common.SDKTime{Time: time.Now()}}},
				DataAsset: dataintegration.DataAssetFromMySql{AssetProperties: map[string]string{"EXAMPLE_KEY_ebD1i": "EXAMPLE_VALUE_DdCI3N1FyVWheyKLYTtm"},
					Host:         common.String("EXAMPLE-host-Value"),
					Identifier:   common.String("EXAMPLE-identifier-Value"),
					ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					DefaultConnection: &dataintegration.ConnectionFromMySqlDetails{ObjectStatus: common.Int(951),
						PrimarySchema: &dataintegration.Schema{ObjectVersion: common.Int(695),
							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"),
							IsHasContainers:   common.Bool(false),
							Key:               common.String("EXAMPLE-key-Value"),
							Metadata: &dataintegration.ObjectMetadata{CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(629),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeTask}}},
								IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
								InfoFields:      map[string]string{"EXAMPLE_KEY_SVWxU": "EXAMPLE_VALUE_EIZqu1d0BbxGy2l9HDDD"},
								Labels:          []string{"EXAMPLE--Value"},
								RegistryVersion: common.Int(222),
								TimeUpdated:     &common.SDKTime{Time: time.Now()},
								UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
								AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
								CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
								CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
								IsFavorite:      common.Bool(true),
								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")}},
							ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
							Name:         common.String("EXAMPLE-name-Value"),
							ObjectStatus: common.Int(721),
							Description:  common.String("EXAMPLE-description-Value"),
							ExternalKey:  common.String("EXAMPLE-externalKey-Value"),
							Identifier:   common.String("EXAMPLE-identifier-Value")},
						Username:   common.String("EXAMPLE-username-Value"),
						Identifier: common.String("EXAMPLE-identifier-Value"),
						IsDefault:  common.Bool(true),
						Metadata: &dataintegration.ObjectMetadata{CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(265),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeConnection}}},
							IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
							IsFavorite:      common.Bool(true),
							RegistryVersion: common.Int(877),
							UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
							UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
							CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
							CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
							InfoFields:      map[string]string{"EXAMPLE_KEY_huaGm": "EXAMPLE_VALUE_iKxgEurNd8dC7EZjXGeH"},
							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")},
							AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value")},
						ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
						Name:          common.String("EXAMPLE-name-Value"),
						ObjectVersion: common.Int(36),
						ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
							RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
						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")},
					ExternalKey:   common.String("EXAMPLE-externalKey-Value"),
					KeyMap:        map[string]string{"EXAMPLE_KEY_jq8HL": "EXAMPLE_VALUE_WHSAjMSJNVWJiooxpoSY"},
					ObjectStatus:  common.Int(599),
					ObjectVersion: common.Int(209),
					Metadata: &dataintegration.ObjectMetadata{IsFavorite: common.Bool(true),
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(957),
						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")},
						AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(160),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeConnection}}},
						TimeCreated:    &common.SDKTime{Time: time.Now()},
						UpdatedBy:      common.String("EXAMPLE-updatedBy-Value"),
						UpdatedByName:  common.String("EXAMPLE-updatedByName-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_CswCz": "EXAMPLE_VALUE_6XTECdnsoDuwg9tToLd7"}},
					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")},
					ServiceName: common.String("EXAMPLE-serviceName-Value"),
					Description: common.String("EXAMPLE-description-Value"),
					Key:         common.String("EXAMPLE-key-Value"),
					NativeTypeSystem: &dataintegration.TypeSystem{Description: common.String("EXAMPLE-description-Value"),
						Identifier:      common.String("EXAMPLE-identifier-Value"),
						Key:             common.String("EXAMPLE-key-Value"),
						Name:            common.String("EXAMPLE-name-Value"),
						ObjectStatus:    common.Int(949),
						ObjectVersion:   common.Int(38),
						TypeMappingFrom: map[string]string{"EXAMPLE_KEY_jzYZs": "EXAMPLE_VALUE_vQymzpLOR3WCxLVFoMA0"},
						TypeMappingTo:   map[string]string{"EXAMPLE_KEY_Oe4vQ": "EXAMPLE_VALUE_JcDMrhMVmeGmq6HqgWM3"},
						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")},
						Types: []dataintegration.DataType{dataintegration.DataType{ConfigDefinition: &dataintegration.ConfigDefinition{ConfigParameterDefinitions: map[string]dataintegration.ConfigParameterDefinition{"EXAMPLE_KEY_LD5EP": dataintegration.ConfigParameterDefinition{IsClassFieldValue: common.Bool(true),
							IsStatic:      common.Bool(true),
							ParameterName: common.String("EXAMPLE-parameterName-Value"),
							ParameterType: dataintegration.JavaType{Description: common.String("EXAMPLE-description-Value"),
								JavaTypeName: common.String("EXAMPLE-javaTypeName-Value"),
								Key:          common.String("EXAMPLE-key-Value"),
								ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
								Name:         common.String("EXAMPLE-name-Value"),
								ObjectStatus: common.Int(766),
								ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
									RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")}},
							ClassFieldName: common.String("EXAMPLE-classFieldName-Value"),
							DefaultValue:   &defaultValue,
							Description:    common.String("EXAMPLE-description-Value")}},
							IsContained:  common.Bool(true),
							Key:          common.String("EXAMPLE-key-Value"),
							ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
							Name:         common.String("EXAMPLE-name-Value"),
							ObjectStatus: common.Int(121),
							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"),
							DtType:       dataintegration.DataTypeDtTypeStructured,
							ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
							Name:         common.String("EXAMPLE-name-Value"),
							ObjectStatus: common.Int(515),
							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")}}},
					Port: common.String("EXAMPLE-port-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(535)}},
		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)
}