// 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{IfMatch: common.String("EXAMPLE-ifMatch-Value"),
		OpcRequestId: common.String("3NCMONRQGLB6RKB0LTWI<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{CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
				Connection: dataintegration.ConnectionFromOracleEbs{ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
					Value: common.String("EXAMPLE-value-Value")}},
					KeyMap:       map[string]string{"EXAMPLE_KEY_A9N9G": "EXAMPLE_VALUE_9W4NTuWTWpLQ0n0PhPR5"},
					Description:  common.String("EXAMPLE-description-Value"),
					IsDefault:    common.Bool(true),
					Key:          common.String("EXAMPLE-key-Value"),
					ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					Name:         common.String("EXAMPLE-name-Value"),
					Identifier:   common.String("EXAMPLE-identifier-Value"),
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					PasswordSecret: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
						Value: common.String("EXAMPLE-value-Value")},
					PrimarySchema: &dataintegration.Schema{Identifier: common.String("EXAMPLE-identifier-Value"),
						Key:             common.String("EXAMPLE-key-Value"),
						ObjectStatus:    common.Int(262),
						ResourceName:    common.String("EXAMPLE-resourceName-Value"),
						IsHasContainers: common.Bool(true),
						Metadata: &dataintegration.ObjectMetadata{AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectType: dataintegration.CountStatisticSummaryObjectTypeFunctionLibrary,
								ObjectCount: common.Int64(764)}}},
							CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
							IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
							RegistryVersion: common.Int(936),
							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")},
							CreatedByName: common.String("EXAMPLE-createdByName-Value"),
							InfoFields:    map[string]string{"EXAMPLE_KEY_wujFu": "EXAMPLE_VALUE_wpJW6yIf64RSbTMlgflJ"},
							IsFavorite:    common.Bool(false),
							Labels:        []string{"EXAMPLE--Value"},
							TimeCreated:   &common.SDKTime{Time: time.Now()},
							TimeUpdated:   &common.SDKTime{Time: time.Now()},
							UpdatedBy:     common.String("EXAMPLE-updatedBy-Value")},
						ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
						Name:          common.String("EXAMPLE-name-Value"),
						ObjectVersion: common.Int(209),
						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"),
						ExternalKey:       common.String("EXAMPLE-externalKey-Value")},
					Metadata: &dataintegration.ObjectMetadata{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_Oao4a": "EXAMPLE_VALUE_3wgOlXj0kGRgNR17gJAD"},
						IsFavorite:     common.Bool(true),
						Labels:         []string{"EXAMPLE--Value"},
						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(562)}}},
						CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
						CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
						RegistryVersion: common.Int(318),
						TimeUpdated:     &common.SDKTime{Time: time.Now()},
						UpdatedBy:       common.String("EXAMPLE-updatedBy-Value")},
					ObjectStatus:  common.Int(840),
					ObjectVersion: common.Int(111),
					Password:      common.String("EXAMPLE-password-Value"),
					Username:      common.String("EXAMPLE-username-Value")},
				DataAsset: dataintegration.DataAssetFromRestDetails{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					ObjectStatus:  common.Int(352),
					ObjectVersion: common.Int(140),
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					BaseUrl:     common.String("EXAMPLE-baseUrl-Value"),
					Description: common.String("EXAMPLE-description-Value"),
					ExternalKey: common.String("EXAMPLE-externalKey-Value"),
					KeyMap:      map[string]string{"EXAMPLE_KEY_EIPr5": "EXAMPLE_VALUE_FLicYTUml1RF6ft6EBec"},
					Name:        common.String("EXAMPLE-name-Value"),
					NativeTypeSystem: &dataintegration.TypeSystem{TypeMappingFrom: map[string]string{"EXAMPLE_KEY_tjCqQ": "EXAMPLE_VALUE_c3BZDjnT4DgLmktHmult"},
						TypeMappingTo: map[string]string{"EXAMPLE_KEY_wGJjR": "EXAMPLE_VALUE_VYBkIOLcQu5wtBunoh7m"},
						Types: []dataintegration.DataType{dataintegration.DataType{ConfigDefinition: &dataintegration.ConfigDefinition{ConfigParameterDefinitions: map[string]dataintegration.ConfigParameterDefinition{"EXAMPLE_KEY_O0N6s": dataintegration.ConfigParameterDefinition{IsClassFieldValue: common.Bool(true),
							IsStatic:       common.Bool(false),
							ParameterName:  common.String("EXAMPLE-parameterName-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(512),
							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"),
							ObjectStatus:   common.Int(481),
							TypeSystemName: common.String("EXAMPLE-typeSystemName-Value"),
							DtType:         dataintegration.DataTypeDtTypePrimitive,
							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")}}},
						Identifier:   common.String("EXAMPLE-identifier-Value"),
						Key:          common.String("EXAMPLE-key-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")},
						Description:   common.String("EXAMPLE-description-Value"),
						ObjectStatus:  common.Int(412),
						ObjectVersion: common.Int(999)},
					Metadata: &dataintegration.ObjectMetadata{UpdatedByName: common.String("EXAMPLE-updatedByName-Value"),
						AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
						CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
						CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
						IsFavorite:      common.Bool(false),
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(737),
						TimeCreated:     &common.SDKTime{Time: time.Now()},
						TimeUpdated:     &common.SDKTime{Time: time.Now()},
						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")},
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(43),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataFlow}}},
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						InfoFields:     map[string]string{"EXAMPLE_KEY_sNhVz": "EXAMPLE_VALUE_ltmizp63BBTABeHhU9yo"},
						UpdatedBy:      common.String("EXAMPLE-updatedBy-Value")},
					AssetProperties: map[string]string{"EXAMPLE_KEY_TfxvI": "EXAMPLE_VALUE_CCsyf07SsFDffd1CS8gc"},
					DefaultConnection: dataintegration.ConnectionFromAtpDetails{Metadata: &dataintegration.ObjectMetadata{TimeCreated: &common.SDKTime{Time: time.Now()},
						TimeUpdated:   &common.SDKTime{Time: time.Now()},
						AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(59),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeFolder}}},
						CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
						CreatedByName: common.String("EXAMPLE-createdByName-Value"),
						InfoFields:    map[string]string{"EXAMPLE_KEY_UxKuX": "EXAMPLE_VALUE_NGzFIfbqBT90exRBPgUS"},
						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")},
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						IsFavorite:      common.Bool(false),
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(975)},
						PrimarySchema: &dataintegration.Schema{Key: common.String("EXAMPLE-key-Value"),
							Metadata: &dataintegration.ObjectMetadata{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")},
								CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(101),
									ObjectType: dataintegration.CountStatisticSummaryObjectTypeTask}}},
								CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
								CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
								IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
								IsFavorite:      common.Bool(false),
								RegistryVersion: common.Int(302),
								TimeUpdated:     &common.SDKTime{Time: time.Now()},
								AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
								InfoFields:      map[string]string{"EXAMPLE_KEY_B2wxz": "EXAMPLE_VALUE_H7EjSV9Wt1YmvCWZcvt8"}},
							ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
							Name:              common.String("EXAMPLE-name-Value"),
							ObjectStatus:      common.Int(907),
							DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
							Description:       common.String("EXAMPLE-description-Value"),
							Identifier:        common.String("EXAMPLE-identifier-Value"),
							ObjectVersion:     common.Int(955),
							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"),
							ExternalKey:     common.String("EXAMPLE-externalKey-Value"),
							IsHasContainers: common.Bool(true)},
						TnsAlias:     common.String("EXAMPLE-tnsAlias-Value"),
						IsDefault:    common.Bool(true),
						Name:         common.String("EXAMPLE-name-Value"),
						Password:     common.String("EXAMPLE-password-Value"),
						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")},
						PasswordSecret: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
							Value: common.String("EXAMPLE-value-Value")},
						Identifier:    common.String("EXAMPLE-identifier-Value"),
						Key:           common.String("EXAMPLE-key-Value"),
						ObjectStatus:  common.Int(498),
						ObjectVersion: common.Int(271),
						TnsNames:      []string{"EXAMPLE--Value"},
						Username:      common.String("EXAMPLE-username-Value"),
						ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
							Value: common.String("EXAMPLE-value-Value")}},
						Description: common.String("EXAMPLE-description-Value")},
					Identifier:          common.String("EXAMPLE-identifier-Value"),
					Key:                 common.String("EXAMPLE-key-Value"),
					ManifestFileContent: common.String("EXAMPLE-manifestFileContent-Value")},
				Schema: &dataintegration.Schema{Description: common.String("EXAMPLE-description-Value"),
					ExternalKey: common.String("EXAMPLE-externalKey-Value"),
					Key:         common.String("EXAMPLE-key-Value"),
					Metadata: &dataintegration.ObjectMetadata{TimeUpdated: &common.SDKTime{Time: time.Now()},
						CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
						CreatedByName: common.String("EXAMPLE-createdByName-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"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(142),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset}}},
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_chL72": "EXAMPLE_VALUE_7IGAR40rQaK4DCKXu5KM"},
						IsFavorite:      common.Bool(true),
						RegistryVersion: common.Int(710)},
					ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
					ObjectStatus:  common.Int(81),
					ObjectVersion: common.Int(47),
					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"),
					Identifier:        common.String("EXAMPLE-identifier-Value"),
					IsHasContainers:   common.Bool(true),
					ModelType:         common.String("EXAMPLE-modelType-Value"),
					Name:              common.String("EXAMPLE-name-Value"),
					ResourceName:      common.String("EXAMPLE-resourceName-Value")}},
			Description: common.String("EXAMPLE-description-Value"),
			DisplayName: common.String("EXAMPLE-displayName-Value"),
			ResourceConfiguration: &dataintegration.ResourceConfiguration{SparkVersion: common.String("EXAMPLE-sparkVersion-Value"),
				TotalExecutors: common.Int(186),
				DriverShape:    common.String("EXAMPLE-driverShape-Value"),
				ExecutorShape:  common.String("EXAMPLE-executorShape-Value")},
			ApplicationCompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-applicationCompartmentId-Value")},
		WorkspaceId:             common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-workspaceId-Value"),
		ExternalPublicationsKey: common.String("EXAMPLE-externalPublicationsKey-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)
}