// 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("5O3EKNKMQGABKIWUEDV2<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{Connection: dataintegration.ConnectionFromMySql{IsDefault: common.Bool(true),
				Key:           common.String("EXAMPLE-key-Value"),
				Username:      common.String("EXAMPLE-username-Value"),
				ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
				ObjectStatus:  common.Int(37),
				ObjectVersion: common.Int(356),
				PrimarySchema: &dataintegration.Schema{Description: common.String("EXAMPLE-description-Value"),
					ExternalKey:     common.String("EXAMPLE-externalKey-Value"),
					Identifier:      common.String("EXAMPLE-identifier-Value"),
					ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
					ObjectStatus:    common.Int(798),
					ObjectVersion:   common.Int(925),
					IsHasContainers: common.Bool(true),
					Key:             common.String("EXAMPLE-key-Value"),
					Metadata: &dataintegration.ObjectMetadata{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")},
						CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_2OoKF": "EXAMPLE_VALUE_ZKt1qSRA60pczDe6pa5F"},
						IsFavorite:      common.Bool(false),
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(808),
						TimeUpdated:     &common.SDKTime{Time: time.Now()},
						AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(900),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeProject}}},
						CreatedByName: common.String("EXAMPLE-createdByName-Value"),
						TimeCreated:   &common.SDKTime{Time: time.Now()},
						UpdatedBy:     common.String("EXAMPLE-updatedBy-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"),
					DefaultConnection: common.String("EXAMPLE-defaultConnection-Value")},
				ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
					Value: common.String("EXAMPLE-value-Value")}},
				Description: common.String("EXAMPLE-description-Value"),
				KeyMap:      map[string]string{"EXAMPLE_KEY_iVId9": "EXAMPLE_VALUE_N3EWTVVHNJB8xW9IsW3z"},
				Metadata: &dataintegration.ObjectMetadata{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"),
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(632),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeTask}}},
					CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
					IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
					IsFavorite:      common.Bool(true),
					UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
					CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
					InfoFields:      map[string]string{"EXAMPLE_KEY_xxNOV": "EXAMPLE_VALUE_buRav7ezr1OsSC1HmLQ7"},
					Labels:          []string{"EXAMPLE--Value"},
					RegistryVersion: common.Int(644),
					TimeCreated:     &common.SDKTime{Time: time.Now()},
					TimeUpdated:     &common.SDKTime{Time: time.Now()},
					UpdatedByName:   common.String("EXAMPLE-updatedByName-Value")},
				ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
					RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
				Identifier: common.String("EXAMPLE-identifier-Value"),
				Name:       common.String("EXAMPLE-name-Value")},
				DataAsset: dataintegration.DataAssetFromRestDetails{ManifestFileContent: common.String("EXAMPLE-manifestFileContent-Value"),
					ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
					Name:          common.String("EXAMPLE-name-Value"),
					ObjectStatus:  common.Int(73),
					ObjectVersion: common.Int(827),
					Description:   common.String("EXAMPLE-description-Value"),
					Key:           common.String("EXAMPLE-key-Value"),
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					AssetProperties: map[string]string{"EXAMPLE_KEY_DR0UZ": "EXAMPLE_VALUE_5xTz70ZGzDMC9ju8zspy"},
					KeyMap:          map[string]string{"EXAMPLE_KEY_Fvf03": "EXAMPLE_VALUE_9jJKx2d8nO1kXtE2R4x5"},
					ExternalKey:     common.String("EXAMPLE-externalKey-Value"),
					Metadata: &dataintegration.ObjectMetadata{AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(77),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset}}},
						CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
						CreatedByName: common.String("EXAMPLE-createdByName-Value"),
						InfoFields:    map[string]string{"EXAMPLE_KEY_yJ4Rh": "EXAMPLE_VALUE_4Vy3AvzIRIJUiBuSh1tQ"},
						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")},
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						IsFavorite:      common.Bool(false),
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(473),
						TimeCreated:     &common.SDKTime{Time: time.Now()},
						TimeUpdated:     &common.SDKTime{Time: time.Now()}},
					NativeTypeSystem: &dataintegration.TypeSystem{Description: common.String("EXAMPLE-description-Value"),
						Identifier:    common.String("EXAMPLE-identifier-Value"),
						Name:          common.String("EXAMPLE-name-Value"),
						ObjectStatus:  common.Int(443),
						ObjectVersion: common.Int(990),
						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_XBaAX": dataintegration.ConfigParameterDefinition{ParameterName: common.String("EXAMPLE-parameterName-Value"),
							ParameterType: dataintegration.ArrayType{Name: common.String("EXAMPLE-name-Value"),
								ObjectStatus: common.Int(3),
								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"),
								ElementType:  common.String("EXAMPLE-elementType-Value"),
								Key:          common.String("EXAMPLE-key-Value"),
								ModelVersion: common.String("EXAMPLE-modelVersion-Value")},
							ClassFieldName:    common.String("EXAMPLE-classFieldName-Value"),
							DefaultValue:      &defaultValue,
							Description:       common.String("EXAMPLE-description-Value"),
							IsClassFieldValue: common.Bool(false),
							IsStatic:          common.Bool(false)}},
							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(159),
							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"),
							ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
							Name:         common.String("EXAMPLE-name-Value"),
							ObjectStatus: common.Int(899),
							DtType:       dataintegration.DataTypeDtTypeStructured,
							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")}},
						Key:             common.String("EXAMPLE-key-Value"),
						ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
						TypeMappingFrom: map[string]string{"EXAMPLE_KEY_5rBod": "EXAMPLE_VALUE_EWdmYMQ585T17LbNBgWo"},
						TypeMappingTo:   map[string]string{"EXAMPLE_KEY_6ZNIy": "EXAMPLE_VALUE_ENriBB5yLCIsH8R4mcOd"}},
					BaseUrl: common.String("EXAMPLE-baseUrl-Value"),
					DefaultConnection: dataintegration.ConnectionFromOracleSiebelDetails{ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
						Value: common.String("EXAMPLE-value-Value")}},
						Description: common.String("EXAMPLE-description-Value"),
						IsDefault:   common.Bool(true),
						Key:         common.String("EXAMPLE-key-Value"),
						Metadata: &dataintegration.ObjectMetadata{CreatedByName: common.String("EXAMPLE-createdByName-Value"),
							IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
							IsFavorite:     common.Bool(true),
							TimeUpdated:    &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")},
							CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
							InfoFields:      map[string]string{"EXAMPLE_KEY_tegMz": "EXAMPLE_VALUE_YyEGaUtZGDoyprVG2wxx"},
							Labels:          []string{"EXAMPLE--Value"},
							RegistryVersion: common.Int(201),
							TimeCreated:     &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(741),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeFolder}}}},
						Name:          common.String("EXAMPLE-name-Value"),
						ObjectVersion: common.Int(797),
						Password:      common.String("EXAMPLE-password-Value"),
						PrimarySchema: &dataintegration.Schema{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"),
							Metadata: &dataintegration.ObjectMetadata{IsFavorite: common.Bool(true),
								Labels:      []string{"EXAMPLE--Value"},
								TimeUpdated: &common.SDKTime{Time: time.Now()},
								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")},
								CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(277),
									ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset}}},
								CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
								InfoFields:      map[string]string{"EXAMPLE_KEY_BCkqP": "EXAMPLE_VALUE_ibQJN11U1U7NTXAVkEJK"},
								RegistryVersion: common.Int(425),
								TimeCreated:     &common.SDKTime{Time: time.Now()},
								UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
								AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
								CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
								IdentifierPath:  common.String("EXAMPLE-identifierPath-Value")},
							ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
							ObjectStatus:      common.Int(150),
							ObjectVersion:     common.Int(786),
							ResourceName:      common.String("EXAMPLE-resourceName-Value"),
							DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
							Description:       common.String("EXAMPLE-description-Value"),
							Identifier:        common.String("EXAMPLE-identifier-Value"),
							IsHasContainers:   common.Bool(true),
							Key:               common.String("EXAMPLE-key-Value")},
						ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
						ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
							Parent: common.String("EXAMPLE-parent-Value")},
						Identifier:   common.String("EXAMPLE-identifier-Value"),
						ObjectStatus: common.Int(304),
						PasswordSecret: &dataintegration.SensitiveAttribute{Value: common.String("EXAMPLE-value-Value"),
							SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")}},
						Username: common.String("EXAMPLE-username-Value")},
					Identifier: common.String("EXAMPLE-identifier-Value")},
				Schema: &dataintegration.Schema{Description: common.String("EXAMPLE-description-Value"),
					ExternalKey:     common.String("EXAMPLE-externalKey-Value"),
					Identifier:      common.String("EXAMPLE-identifier-Value"),
					Key:             common.String("EXAMPLE-key-Value"),
					ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
					ObjectStatus:    common.Int(994),
					IsHasContainers: common.Bool(true),
					Metadata: &dataintegration.ObjectMetadata{InfoFields: map[string]string{"EXAMPLE_KEY_40iKJ": "EXAMPLE_VALUE_F0NNRsOt20jdxrGvJjVn"},
						TimeUpdated: &common.SDKTime{Time: time.Now()},
						UpdatedBy:   common.String("EXAMPLE-updatedBy-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")},
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						IsFavorite:      common.Bool(false),
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(439),
						TimeCreated:     &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{ObjectType: dataintegration.CountStatisticSummaryObjectTypeFolder,
							ObjectCount: common.Int64(481)}}},
						CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
						CreatedByName: common.String("EXAMPLE-createdByName-Value")},
					ModelType:     common.String("EXAMPLE-modelType-Value"),
					Name:          common.String("EXAMPLE-name-Value"),
					ObjectVersion: common.Int(330),
					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")},
				CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-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(238)},
			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)
}