// 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("UIB3ODDUYJTQXUFGAZEZ<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.ConnectionFromOAuth2{ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
					Value: common.String("EXAMPLE-value-Value")}},
					GrantType:      dataintegration.ConnectionFromOAuth2GrantTypeClientCredentials,
					Description:    common.String("EXAMPLE-description-Value"),
					Identifier:     common.String("EXAMPLE-identifier-Value"),
					ModelVersion:   common.String("EXAMPLE-modelVersion-Value"),
					Name:           common.String("EXAMPLE-name-Value"),
					AccessTokenUrl: common.String("EXAMPLE-accessTokenUrl-Value"),
					ClientId:       common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-clientId-Value"),
					IsDefault:      common.Bool(false),
					Key:            common.String("EXAMPLE-key-Value"),
					KeyMap:         map[string]string{"EXAMPLE_KEY_b2jAq": "EXAMPLE_VALUE_LmjGNGtwKWvnfp6qGeHX"},
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					Metadata: &dataintegration.ObjectMetadata{IdentifierPath: common.String("EXAMPLE-identifierPath-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"),
						AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(314),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeProject}}},
						CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
						CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_TYb1L": "EXAMPLE_VALUE_xyWdGmyyTcCfM4bQzbRk"},
						IsFavorite:      common.Bool(false),
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(24),
						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")}},
					ObjectStatus:  common.Int(415),
					ObjectVersion: common.Int(320),
					PrimarySchema: &dataintegration.Schema{ObjectStatus: common.Int(335),
						ObjectVersion: common.Int(253),
						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"),
						ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
						IsHasContainers:   common.Bool(false),
						Name:              common.String("EXAMPLE-name-Value"),
						ResourceName:      common.String("EXAMPLE-resourceName-Value"),
						Description:       common.String("EXAMPLE-description-Value"),
						Identifier:        common.String("EXAMPLE-identifier-Value"),
						Key:               common.String("EXAMPLE-key-Value"),
						Metadata: &dataintegration.ObjectMetadata{CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(193),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeFolder}}},
							CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
							CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
							IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
							InfoFields:     map[string]string{"EXAMPLE_KEY_nWwR6": "EXAMPLE_VALUE_OG6alF2DXC0YHpA7KwYt"},
							TimeCreated:    &common.SDKTime{Time: time.Now()},
							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")},
							AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
							IsFavorite:      common.Bool(true),
							Labels:          []string{"EXAMPLE--Value"},
							RegistryVersion: common.Int(586),
							UpdatedByName:   common.String("EXAMPLE-updatedByName-Value")},
						ModelVersion: common.String("EXAMPLE-modelVersion-Value")},
					Scope: common.String("EXAMPLE-scope-Value"),
					ClientSecret: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
						Value: common.String("EXAMPLE-value-Value")}},
				DataAsset: dataintegration.DataAssetFromRestDetails{Name: common.String("EXAMPLE-name-Value"),
					BaseUrl:    common.String("EXAMPLE-baseUrl-Value"),
					Identifier: common.String("EXAMPLE-identifier-Value"),
					NativeTypeSystem: &dataintegration.TypeSystem{TypeMappingFrom: map[string]string{"EXAMPLE_KEY_1eSf1": "EXAMPLE_VALUE_P4xiYLk6RLB6h9bzMkC7"},
						Description:   common.String("EXAMPLE-description-Value"),
						ObjectVersion: common.Int(893),
						TypeMappingTo: map[string]string{"EXAMPLE_KEY_sx7iP": "EXAMPLE_VALUE_CgRqKEEpQQWeC2BJafiC"},
						Types: []dataintegration.DataType{dataintegration.DataType{ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
							RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
							DtType:         dataintegration.DataTypeDtTypeStructured,
							Name:           common.String("EXAMPLE-name-Value"),
							TypeSystemName: common.String("EXAMPLE-typeSystemName-Value"),
							ConfigDefinition: &dataintegration.ConfigDefinition{Key: common.String("EXAMPLE-key-Value"),
								ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
								Name:         common.String("EXAMPLE-name-Value"),
								ObjectStatus: common.Int(637),
								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_tIbea": dataintegration.ConfigParameterDefinition{ParameterName: common.String("EXAMPLE-parameterName-Value"),
									ParameterType: dataintegration.ArrayType{Description: common.String("EXAMPLE-description-Value"),
										ElementType:  common.String("EXAMPLE-elementType-Value"),
										Key:          common.String("EXAMPLE-key-Value"),
										ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
										Name:         common.String("EXAMPLE-name-Value"),
										ObjectStatus: common.Int(446),
										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"),
									IsClassFieldValue: common.Bool(true),
									IsStatic:          common.Bool(false)}},
								IsContained: common.Bool(true)},
							Description:  common.String("EXAMPLE-description-Value"),
							Key:          common.String("EXAMPLE-key-Value"),
							ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
							ObjectStatus: common.Int(685)}},
						Identifier:   common.String("EXAMPLE-identifier-Value"),
						Key:          common.String("EXAMPLE-key-Value"),
						ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
						Name:         common.String("EXAMPLE-name-Value"),
						ObjectStatus: common.Int(422),
						ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
							RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")}},
					ObjectVersion: common.Int(123),
					Metadata: &dataintegration.ObjectMetadata{TimeUpdated: &common.SDKTime{Time: time.Now()},
						AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(949),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeTask}}},
						CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						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"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_xBHTj": "EXAMPLE_VALUE_tmIyS59N0jZHQo1HgA4I"},
						IsFavorite:      common.Bool(true),
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(988),
						TimeCreated:     &common.SDKTime{Time: time.Now()}},
					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"),
					ExternalKey:         common.String("EXAMPLE-externalKey-Value"),
					Key:                 common.String("EXAMPLE-key-Value"),
					ManifestFileContent: common.String("EXAMPLE-manifestFileContent-Value"),
					ObjectStatus:        common.Int(897),
					AssetProperties:     map[string]string{"EXAMPLE_KEY_04Dyp": "EXAMPLE_VALUE_7aEMslSI2xIcl3qpuDsB"},
					DefaultConnection: dataintegration.ConnectionFromOracleEbsDetails{IsDefault: common.Bool(false),
						Name:          common.String("EXAMPLE-name-Value"),
						ObjectVersion: common.Int(395),
						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{Description: common.String("EXAMPLE-description-Value"),
							Metadata: &dataintegration.ObjectMetadata{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")},
								AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
								CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(181),
									ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataFlow}}},
								CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
								IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
								IsFavorite:      common.Bool(true),
								TimeCreated:     &common.SDKTime{Time: time.Now()},
								CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
								InfoFields:      map[string]string{"EXAMPLE_KEY_tbZOE": "EXAMPLE_VALUE_FXeqbAfpFX1tMXaYi7Yc"},
								Labels:          []string{"EXAMPLE--Value"},
								RegistryVersion: common.Int(803),
								TimeUpdated:     &common.SDKTime{Time: time.Now()},
								UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
								UpdatedByName:   common.String("EXAMPLE-updatedByName-Value")},
							Name:          common.String("EXAMPLE-name-Value"),
							ObjectStatus:  common.Int(94),
							ObjectVersion: common.Int(121),
							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"),
							ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
							Identifier:        common.String("EXAMPLE-identifier-Value"),
							IsHasContainers:   common.Bool(false),
							Key:               common.String("EXAMPLE-key-Value"),
							ModelVersion:      common.String("EXAMPLE-modelVersion-Value")},
						ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Value: common.String("EXAMPLE-value-Value"),
							Name: common.String("EXAMPLE-name-Value")}},
						Identifier:   common.String("EXAMPLE-identifier-Value"),
						Key:          common.String("EXAMPLE-key-Value"),
						ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
						ObjectStatus: common.Int(459),
						Username:     common.String("EXAMPLE-username-Value"),
						Password:     common.String("EXAMPLE-password-Value"),
						Description:  common.String("EXAMPLE-description-Value"),
						Metadata: &dataintegration.ObjectMetadata{CreatedByName: common.String("EXAMPLE-createdByName-Value"),
							IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
							InfoFields:      map[string]string{"EXAMPLE_KEY_hCMi0": "EXAMPLE_VALUE_QQ3xTjlCveOnmtPU96VI"},
							RegistryVersion: common.Int(611),
							TimeUpdated:     &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(337),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeUserDefinedFunction}}},
							CreatedBy:   common.String("EXAMPLE-createdBy-Value"),
							IsFavorite:  common.Bool(true),
							Labels:      []string{"EXAMPLE--Value"},
							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")}},
						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_bnEZr": "EXAMPLE_VALUE_EVsiqUZjDb9NbOSQMVlo"},
					ModelVersion: common.String("EXAMPLE-modelVersion-Value")},
				Schema: &dataintegration.Schema{IsHasContainers: common.Bool(true),
					Key: common.String("EXAMPLE-key-Value"),
					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"),
						CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
						CreatedByName: common.String("EXAMPLE-createdByName-Value"),
						InfoFields:    map[string]string{"EXAMPLE_KEY_RqA2j": "EXAMPLE_VALUE_Lc4UHfjf8JrdzQ4joEbN"},
						IsFavorite:    common.Bool(true),
						Labels:        []string{"EXAMPLE--Value"},
						TimeCreated:   &common.SDKTime{Time: time.Now()},
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(886),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeFunctionLibrary}}},
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						RegistryVersion: common.Int(975),
						TimeUpdated:     &common.SDKTime{Time: time.Now()},
						UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
						UpdatedByName:   common.String("EXAMPLE-updatedByName-Value")},
					ModelType: common.String("EXAMPLE-modelType-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"),
					Identifier:        common.String("EXAMPLE-identifier-Value"),
					ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
					Name:              common.String("EXAMPLE-name-Value"),
					ObjectStatus:      common.Int(270),
					ObjectVersion:     common.Int(438),
					Description:       common.String("EXAMPLE-description-Value"),
					ExternalKey:       common.String("EXAMPLE-externalKey-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(995)}},
		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)
}