// 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 objectValue interface{}
	objectValue = "EXAMPLE-objectValue-Value"
	var refValue interface{}
	refValue = "EXAMPLE-refValue-Value"
	var rootObjectValue interface{}
	rootObjectValue = "EXAMPLE-rootObjectValue-Value"
	var wrappedType interface{}
	wrappedType = "EXAMPLE-wrappedType-Value"
	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("6JGDXTQK0EQL542ZHVGB<unique_ID>"),
		TaskKey:      common.String("EXAMPLE-taskKey-Value"),
		UpdateExternalPublicationDetails: dataintegration.UpdateExternalPublicationDetails{ConfigurationDetails: &dataintegration.ConfigurationDetails{DataAsset: dataintegration.DataAssetFromObjectStorageDetails{OciRegion: common.String("EXAMPLE-ociRegion-Value"),
			Url:          common.String("EXAMPLE-url-Value"),
			ExternalKey:  common.String("EXAMPLE-externalKey-Value"),
			Key:          common.String("EXAMPLE-key-Value"),
			ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
			Namespace:    common.String("EXAMPLE-namespace-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_1d2zE": "EXAMPLE_VALUE_lFPr3Q1PKWjIOQXIBn6b"},
			DefaultConnection: &dataintegration.ConnectionFromObjectStorageDetails{Description: common.String("EXAMPLE-description-Value"),
				IsDefault:    common.Bool(false),
				ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
				Name:         common.String("EXAMPLE-name-Value"),
				ObjectStatus: common.Int(20),
				UserId:       common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-userId-Value"),
				ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
					Value: common.String("EXAMPLE-value-Value")}},
				CredentialFileContent: common.String("EXAMPLE-credentialFileContent-Value"),
				Key:                   common.String("EXAMPLE-key-Value"),
				PassPhrase:            common.String("EXAMPLE-passPhrase-Value"),
				PrimarySchema: &dataintegration.Schema{IsHasContainers: common.Bool(false),
					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")},
					DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
					Description:       common.String("EXAMPLE-description-Value"),
					Identifier:        common.String("EXAMPLE-identifier-Value"),
					Key:               common.String("EXAMPLE-key-Value"),
					Metadata: &dataintegration.ObjectMetadata{UpdatedByName: common.String("EXAMPLE-updatedByName-Value"),
						AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(354),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeFolder}}},
						CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
						CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						TimeCreated:    &common.SDKTime{Time: time.Now()},
						TimeUpdated:    &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")},
						InfoFields:      map[string]string{"EXAMPLE_KEY_Jy56M": "EXAMPLE_VALUE_BbD8um6E6Eipo4wbjW1i"},
						IsFavorite:      common.Bool(true),
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(132),
						UpdatedBy:       common.String("EXAMPLE-updatedBy-Value")},
					ObjectStatus:  common.Int(270),
					ObjectVersion: common.Int(848),
					ResourceName:  common.String("EXAMPLE-resourceName-Value"),
					ExternalKey:   common.String("EXAMPLE-externalKey-Value")},
				FingerPrint: common.String("EXAMPLE-fingerPrint-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"),
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(916),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataFlow}}},
					CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
					CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
					IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
					IsFavorite:      common.Bool(false),
					Labels:          []string{"EXAMPLE--Value"},
					InfoFields:      map[string]string{"EXAMPLE_KEY_fi2tF": "EXAMPLE_VALUE_eH6oK1F6oXJuMOGYwmGw"},
					RegistryVersion: common.Int(429),
					TimeCreated:     &common.SDKTime{Time: time.Now()},
					TimeUpdated:     &common.SDKTime{Time: time.Now()}},
				ObjectVersion: common.Int(399),
				Identifier:    common.String("EXAMPLE-identifier-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"),
			TenancyId:    common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-tenancyId-Value"),
			Name:         common.String("EXAMPLE-name-Value"),
			ObjectStatus: common.Int(207),
			Description:  common.String("EXAMPLE-description-Value"),
			KeyMap:       map[string]string{"EXAMPLE_KEY_Gxyb3": "EXAMPLE_VALUE_XwpYWspyy9666shlJYbO"},
			Metadata: &dataintegration.ObjectMetadata{InfoFields: map[string]string{"EXAMPLE_KEY_b7WUS": "EXAMPLE_VALUE_zNjlxi2ZmzerkQaWZb8Z"},
				Labels:        []string{"EXAMPLE--Value"},
				TimeCreated:   &common.SDKTime{Time: time.Now()},
				TimeUpdated:   &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")},
				AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
				CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
				CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
				IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
				IsFavorite:      common.Bool(true),
				RegistryVersion: common.Int(801),
				UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
				CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(956),
					ObjectType: dataintegration.CountStatisticSummaryObjectTypeProject}}}},
			NativeTypeSystem: &dataintegration.TypeSystem{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
				ObjectVersion: common.Int(526),
				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_zov0D": "EXAMPLE_VALUE_swVa165zpb0UOVerHwz6"},
				Types: []dataintegration.DataType{dataintegration.DataType{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					Name:           common.String("EXAMPLE-name-Value"),
					TypeSystemName: common.String("EXAMPLE-typeSystemName-Value"),
					ConfigDefinition: &dataintegration.ConfigDefinition{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(763),
						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_ErWJ4": dataintegration.ConfigParameterDefinition{ParameterType: dataintegration.ConfiguredType{ConfigValues: &dataintegration.ConfigValues{ConfigParamValues: map[string]dataintegration.ConfigParameterValue{"EXAMPLE_KEY_QNRN6": dataintegration.ConfigParameterValue{IntValue: common.Int(725),
							ObjectValue:     &objectValue,
							ParameterValue:  common.String("EXAMPLE-parameterValue-Value"),
							RefValue:        &refValue,
							RootObjectValue: &rootObjectValue,
							StringValue:     common.String("EXAMPLE-stringValue-Value")}},
							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"),
							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")},
							Key:          common.String("EXAMPLE-key-Value"),
							Name:         common.String("EXAMPLE-name-Value"),
							ObjectStatus: common.Int(134),
							WrappedType:  &wrappedType},
							ClassFieldName:    common.String("EXAMPLE-classFieldName-Value"),
							DefaultValue:      &defaultValue,
							Description:       common.String("EXAMPLE-description-Value"),
							IsClassFieldValue: common.Bool(false),
							IsStatic:          common.Bool(true),
							ParameterName:     common.String("EXAMPLE-parameterName-Value")}}},
					DtType:       dataintegration.DataTypeDtTypePrimitive,
					Key:          common.String("EXAMPLE-key-Value"),
					ObjectStatus: common.Int(607),
					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")}},
				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(581),
				TypeMappingTo: map[string]string{"EXAMPLE_KEY_wCCAk": "EXAMPLE_VALUE_96mev55P0Lw6dtF9wJVn"}},
			ObjectVersion: common.Int(746)},
			Schema: &dataintegration.Schema{IsHasContainers: common.Bool(false),
				Metadata: &dataintegration.ObjectMetadata{CreatedBy: common.String("EXAMPLE-createdBy-Value"),
					CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
					InfoFields:      map[string]string{"EXAMPLE_KEY_Du6yp": "EXAMPLE_VALUE_cnExsyAwioJe3E8DWKh9"},
					IsFavorite:      common.Bool(false),
					Labels:          []string{"EXAMPLE--Value"},
					IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
					RegistryVersion: common.Int(862),
					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(850),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeConnection}}}},
				ModelType:     common.String("EXAMPLE-modelType-Value"),
				ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
				ObjectStatus:  common.Int(653),
				ObjectVersion: common.Int(368),
				ExternalKey:   common.String("EXAMPLE-externalKey-Value"),
				Identifier:    common.String("EXAMPLE-identifier-Value"),
				Key:           common.String("EXAMPLE-key-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")},
			CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
			Connection: dataintegration.ConnectionFromMySql{IsDefault: common.Bool(false),
				Name:         common.String("EXAMPLE-name-Value"),
				ObjectStatus: common.Int(551),
				Metadata: &dataintegration.ObjectMetadata{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"),
					IsFavorite:    common.Bool(true),
					Labels:        []string{"EXAMPLE--Value"},
					TimeCreated:   &common.SDKTime{Time: time.Now()},
					AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(887),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeFolder}}},
					IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
					InfoFields:      map[string]string{"EXAMPLE_KEY_sqUJN": "EXAMPLE_VALUE_rfv4M8pEtGvEs0AQljzz"},
					RegistryVersion: common.Int(695),
					TimeUpdated:     &common.SDKTime{Time: time.Now()}},
				ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
				ObjectVersion: common.Int(61),
				Username:      common.String("EXAMPLE-username-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")},
				PrimarySchema: &dataintegration.Schema{ExternalKey: common.String("EXAMPLE-externalKey-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")},
					DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
					Description:       common.String("EXAMPLE-description-Value"),
					Metadata: &dataintegration.ObjectMetadata{IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						IsFavorite:    common.Bool(true),
						TimeUpdated:   &common.SDKTime{Time: time.Now()},
						UpdatedByName: common.String("EXAMPLE-updatedByName-Value"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectType: dataintegration.CountStatisticSummaryObjectTypeConnection,
							ObjectCount: common.Int64(408)}}},
						CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_4MHEH": "EXAMPLE_VALUE_g2wgBCFDiloiKliMOkoy"},
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(979),
						TimeCreated:     &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")},
						AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
						CreatedBy:     common.String("EXAMPLE-createdBy-Value")},
					Name:          common.String("EXAMPLE-name-Value"),
					ObjectStatus:  common.Int(78),
					ObjectVersion: common.Int(884),
					ResourceName:  common.String("EXAMPLE-resourceName-Value")},
				Identifier: common.String("EXAMPLE-identifier-Value"),
				KeyMap:     map[string]string{"EXAMPLE_KEY_aitNH": "EXAMPLE_VALUE_OF0DGr6pmRlHODJoPdOt"},
				ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
					Value: common.String("EXAMPLE-value-Value")}},
				Description: common.String("EXAMPLE-description-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(722)},
			ApplicationCompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-applicationCompartmentId-Value"),
			ApplicationId:            common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-applicationId-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)
}