// 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 ExampleCreateExternalPublication() {
	// 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.CreateExternalPublicationRequest{OpcRequestId: common.String("4MFXBAOXVLFO1KWPFEXX<unique_ID>"),
		OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value"),
		TaskKey:       common.String("EXAMPLE-taskKey-Value"),
		WorkspaceId:   common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-workspaceId-Value"),
		CreateExternalPublicationDetails: dataintegration.CreateExternalPublicationDetails{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{Schema: &dataintegration.Schema{ExternalKey: common.String("EXAMPLE-externalKey-Value"),
				Identifier:        common.String("EXAMPLE-identifier-Value"),
				IsHasContainers:   common.Bool(true),
				ResourceName:      common.String("EXAMPLE-resourceName-Value"),
				DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
				Name:              common.String("EXAMPLE-name-Value"),
				ObjectVersion:     common.Int(922),
				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"),
				ModelType:   common.String("EXAMPLE-modelType-Value"),
				Key:         common.String("EXAMPLE-key-Value"),
				Metadata: &dataintegration.ObjectMetadata{RegistryVersion: common.Int(359),
					TimeCreated:   &common.SDKTime{Time: time.Now()},
					UpdatedByName: common.String("EXAMPLE-updatedByName-Value"),
					AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
					CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
					TimeUpdated:   &common.SDKTime{Time: time.Now()},
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(439),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset}}},
					IsFavorite:     common.Bool(false),
					IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
					InfoFields:     map[string]string{"EXAMPLE_KEY_DWRT2": "EXAMPLE_VALUE_jDUMnup3djCkFYukpvfX"},
					Labels:         []string{"EXAMPLE--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"),
					UpdatedBy:     common.String("EXAMPLE-updatedBy-Value")},
				ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
				ObjectStatus: common.Int(447)},
				CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
				Connection: dataintegration.ConnectionFromMySqlHeatWave{ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
					RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					Password: common.String("EXAMPLE-password-Value"),
					ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Value: common.String("EXAMPLE-value-Value"),
						Name: common.String("EXAMPLE-name-Value")}},
					Key: common.String("EXAMPLE-key-Value"),
					Metadata: &dataintegration.ObjectMetadata{Labels: []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(602),
						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"),
						CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						InfoFields:     map[string]string{"EXAMPLE_KEY_lbWic": "EXAMPLE_VALUE_KyNn0VnWXpEjH1S6epwZ"},
						CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(225),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeTask}}},
						IsFavorite:    common.Bool(true),
						TimeCreated:   &common.SDKTime{Time: time.Now()},
						TimeUpdated:   &common.SDKTime{Time: time.Now()},
						UpdatedBy:     common.String("EXAMPLE-updatedBy-Value"),
						UpdatedByName: common.String("EXAMPLE-updatedByName-Value")},
					ObjectVersion: common.Int(168),
					PrimarySchema: &dataintegration.Schema{IsHasContainers: common.Bool(false),
						ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
						ObjectVersion: common.Int(779),
						Description:   common.String("EXAMPLE-description-Value"),
						ExternalKey:   common.String("EXAMPLE-externalKey-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")},
						ResourceName:      common.String("EXAMPLE-resourceName-Value"),
						DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
						ObjectStatus:      common.Int(180),
						Key:               common.String("EXAMPLE-key-Value"),
						Metadata: &dataintegration.ObjectMetadata{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")},
							IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
							InfoFields:      map[string]string{"EXAMPLE_KEY_LcWBv": "EXAMPLE_VALUE_G82MfaBMZjTp2M8OgRFK"},
							TimeCreated:     &common.SDKTime{Time: time.Now()},
							CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
							CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
							RegistryVersion: common.Int(225),
							AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
							Labels:          []string{"EXAMPLE--Value"},
							UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(797),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset}}},
							IsFavorite: common.Bool(false)},
						Name: common.String("EXAMPLE-name-Value")},
					Description:  common.String("EXAMPLE-description-Value"),
					IsDefault:    common.Bool(true),
					ObjectStatus: common.Int(620),
					KeyMap:       map[string]string{"EXAMPLE_KEY_DDpYy": "EXAMPLE_VALUE_zOBA5mBTQjTca1cafFGb"},
					PasswordSecret: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
						Value: common.String("EXAMPLE-value-Value")},
					Name:         common.String("EXAMPLE-name-Value"),
					Username:     common.String("EXAMPLE-username-Value"),
					Identifier:   common.String("EXAMPLE-identifier-Value"),
					ModelVersion: common.String("EXAMPLE-modelVersion-Value")},
				DataAsset: dataintegration.DataAssetFromMySqlHeatWave{Key: common.String("EXAMPLE-key-Value"),
					Name:         common.String("EXAMPLE-name-Value"),
					ObjectStatus: common.Int(25),
					DefaultConnection: &dataintegration.ConnectionFromMySqlHeatWaveDetails{Description: common.String("EXAMPLE-description-Value"),
						Key: common.String("EXAMPLE-key-Value"),
						Metadata: &dataintegration.ObjectMetadata{TimeCreated: &common.SDKTime{Time: time.Now()},
							IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
							InfoFields:      map[string]string{"EXAMPLE_KEY_0WvCr": "EXAMPLE_VALUE_7RfgeZu0EENgSAeUyPvI"},
							RegistryVersion: common.Int(221),
							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")},
							CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
							TimeUpdated:   &common.SDKTime{Time: time.Now()},
							CreatedByName: common.String("EXAMPLE-createdByName-Value"),
							IsFavorite:    common.Bool(false),
							Labels:        []string{"EXAMPLE--Value"},
							AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(723),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeFunctionLibrary}}},
							UpdatedBy: common.String("EXAMPLE-updatedBy-Value")},
						ObjectStatus: common.Int(707),
						Identifier:   common.String("EXAMPLE-identifier-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")},
						IsDefault:     common.Bool(false),
						ObjectVersion: common.Int(498),
						Password:      common.String("EXAMPLE-password-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{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"),
							ObjectStatus:      common.Int(284),
							DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
							IsHasContainers:   common.Bool(true),
							ModelVersion:      common.String("EXAMPLE-modelVersion-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"),
							ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
							Metadata: &dataintegration.ObjectMetadata{CreatedByName: common.String("EXAMPLE-createdByName-Value"),
								IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
								InfoFields:     map[string]string{"EXAMPLE_KEY_4Hk25": "EXAMPLE_VALUE_lmf9Zr7qlQFgTHyq79r3"},
								Labels:         []string{"EXAMPLE--Value"},
								AggregatorKey:  common.String("EXAMPLE-aggregatorKey-Value"),
								CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
								IsFavorite:     common.Bool(true),
								UpdatedByName:  common.String("EXAMPLE-updatedByName-Value"),
								TimeCreated:    &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")},
								CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(919),
									ObjectType: dataintegration.CountStatisticSummaryObjectTypeFolder}}},
								RegistryVersion: common.Int(810),
								TimeUpdated:     &common.SDKTime{Time: time.Now()},
								UpdatedBy:       common.String("EXAMPLE-updatedBy-Value")},
							ObjectVersion: common.Int(843)},
						ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
							Value: common.String("EXAMPLE-value-Value")}},
						Name:     common.String("EXAMPLE-name-Value"),
						Username: common.String("EXAMPLE-username-Value")},
					Host: common.String("EXAMPLE-host-Value"),
					Metadata: &dataintegration.ObjectMetadata{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")},
						Labels:          []string{"EXAMPLE--Value"},
						TimeUpdated:     &common.SDKTime{Time: time.Now()},
						UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_hGbjH": "EXAMPLE_VALUE_hrxn4HEO6Ui1ipJ3FVph"},
						IsFavorite:      common.Bool(true),
						CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
						TimeCreated:     &common.SDKTime{Time: time.Now()},
						RegistryVersion: common.Int(595),
						UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
						AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(844),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeProject}}},
						CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value")},
					NativeTypeSystem: &dataintegration.TypeSystem{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
						Name:          common.String("EXAMPLE-name-Value"),
						Identifier:    common.String("EXAMPLE-identifier-Value"),
						Key:           common.String("EXAMPLE-key-Value"),
						ObjectStatus:  common.Int(700),
						ObjectVersion: common.Int(336),
						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_TmcZ5": "EXAMPLE_VALUE_btiw1UhMYDEFMB7WRB2z"},
						TypeMappingTo:   map[string]string{"EXAMPLE_KEY_DvXsD": "EXAMPLE_VALUE_efbkMkJ3Sqm7bcqHaHAi"},
						Description:     common.String("EXAMPLE-description-Value"),
						Types: []dataintegration.DataType{dataintegration.DataType{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
							ObjectStatus: common.Int(603),
							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"),
							ConfigDefinition: &dataintegration.ConfigDefinition{ConfigParameterDefinitions: map[string]dataintegration.ConfigParameterDefinition{"EXAMPLE_KEY_h3ieb": dataintegration.ConfigParameterDefinition{ParameterType: dataintegration.MapType{ObjectStatus: common.Int(715),
								ValueElementType: common.String("EXAMPLE-valueElementType-Value"),
								ContainsNull:     common.Bool(true),
								KeyElementType:   common.String("EXAMPLE-keyElementType-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"),
								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(false),
								IsStatic:          common.Bool(true),
								ParameterName:     common.String("EXAMPLE-parameterName-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(353),
								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"),
							DtType:      dataintegration.DataTypeDtTypePrimitive,
							Name:        common.String("EXAMPLE-name-Value")}}},
					Port:            common.String("EXAMPLE-port-Value"),
					AssetProperties: map[string]string{"EXAMPLE_KEY_vYt3b": "EXAMPLE_VALUE_flb50yI5LVk2YT2KP33O"},
					KeyMap:          map[string]string{"EXAMPLE_KEY_dcnEV": "EXAMPLE_VALUE_2MIQerdMfq78kdQs6dR6"},
					ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
					ObjectVersion:   common.Int(615),
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					ServiceName: common.String("EXAMPLE-serviceName-Value"),
					Description: common.String("EXAMPLE-description-Value"),
					Identifier:  common.String("EXAMPLE-identifier-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(253)}}}

	// Send the request using the service client
	resp, err := client.CreateExternalPublication(context.Background(), req)
	helpers.FatalIfError(err)

	// Retrieve value from the response.
	fmt.Println(resp)
}