// 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 defaultValue interface{}
	defaultValue = "EXAMPLE-defaultValue-Value"
	req := dataintegration.UpdateExternalPublicationRequest{ExternalPublicationsKey: common.String("EXAMPLE-externalPublicationsKey-Value"),
		IfMatch:      common.String("EXAMPLE-ifMatch-Value"),
		OpcRequestId: common.String("TOFQZHEPQTW59RCFRQH0<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.ConnectionFromBip{ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
					RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					KeyMap: map[string]string{"EXAMPLE_KEY_Csyf0": "EXAMPLE_VALUE_7SsFDffd1CS8gcbwGJjR"},
					Metadata: &dataintegration.ObjectMetadata{CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(417),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeTask}}},
						RegistryVersion: common.Int(433),
						UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
						Labels:          []string{"EXAMPLE--Value"},
						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")},
						CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
						InfoFields:     map[string]string{"EXAMPLE_KEY_6cdjT": "EXAMPLE_VALUE_p9iZLw6uGss5fU2Nv3wo"},
						CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
						TimeCreated:    &common.SDKTime{Time: time.Now()},
						UpdatedBy:      common.String("EXAMPLE-updatedBy-Value"),
						AggregatorKey:  common.String("EXAMPLE-aggregatorKey-Value"),
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						IsFavorite:     common.Bool(true)},
					ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					PasswordSecret: &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),
					ObjectStatus:  common.Int(149),
					ObjectVersion: common.Int(95),
					Description:   common.String("EXAMPLE-description-Value"),
					PrimarySchema: &dataintegration.Schema{Description: common.String("EXAMPLE-description-Value"),
						ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
						Name:            common.String("EXAMPLE-name-Value"),
						ObjectVersion:   common.Int(879),
						ResourceName:    common.String("EXAMPLE-resourceName-Value"),
						Key:             common.String("EXAMPLE-key-Value"),
						ObjectStatus:    common.Int(962),
						Identifier:      common.String("EXAMPLE-identifier-Value"),
						IsHasContainers: common.Bool(true),
						Metadata: &dataintegration.ObjectMetadata{UpdatedByName: common.String("EXAMPLE-updatedByName-Value"),
							IsFavorite:      common.Bool(false),
							RegistryVersion: common.Int(767),
							UpdatedBy:       common.String("EXAMPLE-updatedBy-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")},
							IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
							InfoFields:     map[string]string{"EXAMPLE_KEY_HmS8g": "EXAMPLE_VALUE_5oE8oi4zJhMLhI45gJao"},
							TimeUpdated:    &common.SDKTime{Time: time.Now()},
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectType: dataintegration.CountStatisticSummaryObjectTypeFunctionLibrary,
								ObjectCount: common.Int64(729)}}},
							CreatedByName: common.String("EXAMPLE-createdByName-Value"),
							TimeCreated:   &common.SDKTime{Time: time.Now()},
							AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
							CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
							Labels:        []string{"EXAMPLE--Value"}},
						DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
						ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
						ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
							RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")}},
					Name:     common.String("EXAMPLE-name-Value"),
					Username: common.String("EXAMPLE-username-Value"),
					ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
						Value: common.String("EXAMPLE-value-Value")}},
					Identifier: common.String("EXAMPLE-identifier-Value"),
					Key:        common.String("EXAMPLE-key-Value")},
				DataAsset: dataintegration.DataAssetFromMySql{NativeTypeSystem: &dataintegration.TypeSystem{Description: common.String("EXAMPLE-description-Value"),
					Identifier:      common.String("EXAMPLE-identifier-Value"),
					ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
					Name:            common.String("EXAMPLE-name-Value"),
					ObjectVersion:   common.Int(936),
					TypeMappingFrom: map[string]string{"EXAMPLE_KEY_61hy7": "EXAMPLE_VALUE_bHrA7HUYSC84k8FJ5uyh"},
					TypeMappingTo:   map[string]string{"EXAMPLE_KEY_nIGjM": "EXAMPLE_VALUE_IuyZgdvz6TARQQwic5KZ"},
					Key:             common.String("EXAMPLE-key-Value"),
					ObjectStatus:    common.Int(373),
					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{TypeSystemName: common.String("EXAMPLE-typeSystemName-Value"),
						DtType:       dataintegration.DataTypeDtTypeStructured,
						ObjectStatus: common.Int(218),
						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")},
						ConfigDefinition: &dataintegration.ConfigDefinition{ObjectStatus: common.Int(792),
							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_2myss": dataintegration.ConfigParameterDefinition{ParameterName: common.String("EXAMPLE-parameterName-Value"),
								ParameterType: dataintegration.DynamicType{ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
									RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
									TypeHandler: dataintegration.FlattenTypeHandler{Key: common.String("EXAMPLE-key-Value"),
										ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
										ObjectStatus: common.Int(50),
										ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
											RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
										Scope: common.String("EXAMPLE-scope-Value"),
										ConfigValues: &dataintegration.ConfigValues{ConfigParamValues: map[string]dataintegration.ConfigParameterValue{"EXAMPLE_KEY_KXUTd": dataintegration.ConfigParameterValue{StringValue: common.String("EXAMPLE-stringValue-Value"),
											IntValue:        common.Int(239),
											ObjectValue:     &objectValue,
											ParameterValue:  common.String("EXAMPLE-parameterValue-Value"),
											RefValue:        &refValue,
											RootObjectValue: &rootObjectValue}},
											ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
												RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")}},
										FlattenDetails: common.String("EXAMPLE-flattenDetails-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(857)},
								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(false),
							Key:          common.String("EXAMPLE-key-Value"),
							ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
							Name:         common.String("EXAMPLE-name-Value")},
						Description: common.String("EXAMPLE-description-Value"),
						Key:         common.String("EXAMPLE-key-Value")}}},
					AssetProperties: map[string]string{"EXAMPLE_KEY_VlRVS": "EXAMPLE_VALUE_EbiCtsBai180HTlH3DtA"},
					DefaultConnection: &dataintegration.ConnectionFromMySqlDetails{ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
						Value: common.String("EXAMPLE-value-Value")}},
						Identifier:   common.String("EXAMPLE-identifier-Value"),
						ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
						PrimarySchema: &dataintegration.Schema{Description: common.String("EXAMPLE-description-Value"),
							Key:               common.String("EXAMPLE-key-Value"),
							ObjectVersion:     common.Int(249),
							DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
							IsHasContainers:   common.Bool(false),
							Name:              common.String("EXAMPLE-name-Value"),
							ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
							ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
							ResourceName:      common.String("EXAMPLE-resourceName-Value"),
							Identifier:        common.String("EXAMPLE-identifier-Value"),
							Metadata: &dataintegration.ObjectMetadata{CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(990),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeUserDefinedFunction}}},
								IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
								InfoFields:      map[string]string{"EXAMPLE_KEY_SK1nh": "EXAMPLE_VALUE_drbuKLxJoqWm0LveOh65"},
								IsFavorite:      common.Bool(true),
								UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
								TimeCreated:     &common.SDKTime{Time: time.Now()},
								CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
								CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
								Labels:          []string{"EXAMPLE--Value"},
								RegistryVersion: common.Int(738),
								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"),
								TimeUpdated:   &common.SDKTime{Time: time.Now()},
								UpdatedByName: common.String("EXAMPLE-updatedByName-Value")},
							ObjectStatus: common.Int(714),
							ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
								RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")}},
						Username: common.String("EXAMPLE-username-Value"),
						Metadata: &dataintegration.ObjectMetadata{AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
							TimeCreated: &common.SDKTime{Time: time.Now()},
							InfoFields:  map[string]string{"EXAMPLE_KEY_uCW4X": "EXAMPLE_VALUE_sKfXuxd7tHQnWF6hPecf"},
							Labels:      []string{"EXAMPLE--Value"},
							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")},
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(676),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeFolder}}},
							CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
							IsFavorite:      common.Bool(true),
							CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
							IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
							RegistryVersion: common.Int(879),
							UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
							UpdatedByName:   common.String("EXAMPLE-updatedByName-Value")},
						ObjectVersion: common.Int(908),
						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"),
						IsDefault:    common.Bool(true),
						Name:         common.String("EXAMPLE-name-Value"),
						Key:          common.String("EXAMPLE-key-Value"),
						ObjectStatus: common.Int(983)},
					Host:        common.String("EXAMPLE-host-Value"),
					Identifier:  common.String("EXAMPLE-identifier-Value"),
					KeyMap:      map[string]string{"EXAMPLE_KEY_FwKTd": "EXAMPLE_VALUE_shRn5pUBANciOzaHo8k4"},
					ExternalKey: common.String("EXAMPLE-externalKey-Value"),
					Metadata: &dataintegration.ObjectMetadata{CreatedBy: common.String("EXAMPLE-createdBy-Value"),
						UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
						UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
						TimeCreated:     &common.SDKTime{Time: time.Now()},
						AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
						CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_mXZOD": "EXAMPLE_VALUE_1zEuthtdvSM04Kz4J4KP"},
						IsFavorite:      common.Bool(false),
						RegistryVersion: common.Int(116),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(415),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset}}},
						Labels:      []string{"EXAMPLE--Value"},
						TimeUpdated: &common.SDKTime{Time: time.Now()},
						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")}},
					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")},
					Key:           common.String("EXAMPLE-key-Value"),
					ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
					ObjectStatus:  common.Int(310),
					Port:          common.String("EXAMPLE-port-Value"),
					Description:   common.String("EXAMPLE-description-Value"),
					ObjectVersion: common.Int(710),
					ServiceName:   common.String("EXAMPLE-serviceName-Value")},
				Schema: &dataintegration.Schema{Identifier: common.String("EXAMPLE-identifier-Value"),
					Metadata: &dataintegration.ObjectMetadata{TimeCreated: &common.SDKTime{Time: time.Now()},
						TimeUpdated:     &common.SDKTime{Time: time.Now()},
						CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						RegistryVersion: common.Int(20),
						UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_Bunoh": "EXAMPLE_VALUE_7mtjCqQc3BZDjnT4DgLm"},
						IsFavorite:      common.Bool(false),
						UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
						Labels:          []string{"EXAMPLE--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(887),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeFunctionLibrary}}},
						CreatedByName: common.String("EXAMPLE-createdByName-Value"),
						AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value")},
					ObjectVersion:     common.Int(640),
					Description:       common.String("EXAMPLE-description-Value"),
					ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
					ResourceName:      common.String("EXAMPLE-resourceName-Value"),
					DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
					IsHasContainers:   common.Bool(true),
					Key:               common.String("EXAMPLE-key-Value"),
					Name:              common.String("EXAMPLE-name-Value"),
					ObjectStatus:      common.Int(776),
					ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
					ModelType:         common.String("EXAMPLE-modelType-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"),
			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(640)}},
		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)
}