// 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 refValue interface{}
	refValue = "EXAMPLE-refValue-Value"
	var rootObjectValue interface{}
	rootObjectValue = "EXAMPLE-rootObjectValue-Value"
	var objectValue interface{}
	objectValue = "EXAMPLE-objectValue-Value"
	var defaultValue interface{}
	defaultValue = "EXAMPLE-defaultValue-Value"
	req := dataintegration.CreateExternalPublicationRequest{OpcRequestId: common.String("ZHJBHQI1HEGMTQ6FJKII<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{ApplicationId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-applicationId-Value"),
			ConfigurationDetails: &dataintegration.ConfigurationDetails{Schema: &dataintegration.Schema{ExternalKey: common.String("EXAMPLE-externalKey-Value"),
				IsHasContainers: common.Bool(true),
				ModelType:       common.String("EXAMPLE-modelType-Value"),
				Name:            common.String("EXAMPLE-name-Value"),
				ObjectStatus:    common.Int(184),
				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"),
				Key:               common.String("EXAMPLE-key-Value"),
				Metadata: &dataintegration.ObjectMetadata{TimeUpdated: &common.SDKTime{Time: time.Now()},
					AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
					InfoFields:    map[string]string{"EXAMPLE_KEY_c9DVH": "EXAMPLE_VALUE_xdPTIzzZ99mq4fLFu4QQ"},
					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{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{ObjectType: dataintegration.CountStatisticSummaryObjectTypeUserDefinedFunction,
						ObjectCount: common.Int64(111)}}},
					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(237)},
				ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
				ObjectVersion: common.Int(318),
				ResourceName:  common.String("EXAMPLE-resourceName-Value"),
				Description:   common.String("EXAMPLE-description-Value")},
				CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
				Connection: dataintegration.ConnectionFromRestBasicAuth{AuthHeader: common.String("EXAMPLE-authHeader-Value"),
					ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
					ObjectStatus:  common.Int(189),
					ObjectVersion: common.Int(131),
					PrimarySchema: &dataintegration.Schema{ObjectVersion: common.Int(732),
						ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
							RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
						ExternalKey: common.String("EXAMPLE-externalKey-Value"),
						Key:         common.String("EXAMPLE-key-Value"),
						Metadata: &dataintegration.ObjectMetadata{TimeUpdated: &common.SDKTime{Time: time.Now()},
							UpdatedBy: common.String("EXAMPLE-updatedBy-Value"),
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectType: dataintegration.CountStatisticSummaryObjectTypeConnection,
								ObjectCount: common.Int64(486)}}},
							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"},
							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")},
							AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
							InfoFields:      map[string]string{"EXAMPLE_KEY_UHGcr": "EXAMPLE_VALUE_6t8XTjaJEQ9JrdBBef1O"},
							RegistryVersion: common.Int(927),
							TimeCreated:     &common.SDKTime{Time: time.Now()}},
						Name:              common.String("EXAMPLE-name-Value"),
						ObjectStatus:      common.Int(564),
						ResourceName:      common.String("EXAMPLE-resourceName-Value"),
						DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
						Description:       common.String("EXAMPLE-description-Value"),
						Identifier:        common.String("EXAMPLE-identifier-Value"),
						IsHasContainers:   common.Bool(false),
						ModelVersion:      common.String("EXAMPLE-modelVersion-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"),
					IsDefault:   common.Bool(true),
					Key:         common.String("EXAMPLE-key-Value"),
					Metadata: &dataintegration.ObjectMetadata{TimeUpdated: &common.SDKTime{Time: time.Now()},
						CreatedByName: common.String("EXAMPLE-createdByName-Value"),
						IsFavorite:    common.Bool(false),
						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{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")},
						AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset,
							ObjectCount: common.Int64(187)}}},
						CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_j4Vxm": "EXAMPLE_VALUE_c2TMIEtH2JKdg5pRclL9"},
						RegistryVersion: common.Int(48)},
					Name: common.String("EXAMPLE-name-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"),
					KeyMap:     map[string]string{"EXAMPLE_KEY_Hg2zH": "EXAMPLE_VALUE_ik8KMd9QPlFtaLe2ftRx"},
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")}},
				DataAsset: dataintegration.DataAssetFromMySqlHeatWave{Key: common.String("EXAMPLE-key-Value"),
					NativeTypeSystem: &dataintegration.TypeSystem{Description: common.String("EXAMPLE-description-Value"),
						Identifier:    common.String("EXAMPLE-identifier-Value"),
						Key:           common.String("EXAMPLE-key-Value"),
						Name:          common.String("EXAMPLE-name-Value"),
						ObjectVersion: common.Int(230),
						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_xmhdP": "EXAMPLE_VALUE_xdHgZuWHny2HmaXi3raM"},
						Types: []dataintegration.DataType{dataintegration.DataType{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
							Name:         common.String("EXAMPLE-name-Value"),
							Key:          common.String("EXAMPLE-key-Value"),
							ObjectStatus: common.Int(863),
							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{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_7FRcc": dataintegration.ConfigParameterDefinition{IsClassFieldValue: common.Bool(true),
									IsStatic:      common.Bool(false),
									ParameterName: common.String("EXAMPLE-parameterName-Value"),
									ParameterType: dataintegration.CompositeType{ObjectStatus: common.Int(300),
										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"),
										Elements: []dataintegration.TypedObject{dataintegration.InputField{Description: common.String("EXAMPLE-description-Value"),
											Labels:       []string{"EXAMPLE--Value"},
											Name:         common.String("EXAMPLE-name-Value"),
											ObjectStatus: common.Int(536),
											ConfigValues: &dataintegration.ConfigValues{ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
												RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
												ConfigParamValues: map[string]dataintegration.ConfigParameterValue{"EXAMPLE_KEY_itHaf": dataintegration.ConfigParameterValue{RefValue: &refValue,
													RootObjectValue: &rootObjectValue,
													StringValue:     common.String("EXAMPLE-stringValue-Value"),
													IntValue:        common.Int(757),
													ObjectValue:     &objectValue,
													ParameterValue:  common.String("EXAMPLE-parameterValue-Value")}}},
											Key:          common.String("EXAMPLE-key-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")}}},
										Key:          common.String("EXAMPLE-key-Value"),
										ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
										Name:         common.String("EXAMPLE-name-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(602)},
							Description: common.String("EXAMPLE-description-Value"),
							DtType:      dataintegration.DataTypeDtTypeStructured}},
						ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
						ObjectStatus:  common.Int(413),
						TypeMappingTo: map[string]string{"EXAMPLE_KEY_uBJSg": "EXAMPLE_VALUE_yYD1xEuoBgmXUeynPnE6"}},
					ObjectStatus:  common.Int(388),
					ObjectVersion: common.Int(625),
					ServiceName:   common.String("EXAMPLE-serviceName-Value"),
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					DefaultConnection: &dataintegration.ConnectionFromMySqlHeatWaveDetails{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()},
							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(702),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeConnection}}},
							CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
							CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
							InfoFields:      map[string]string{"EXAMPLE_KEY_RC1rx": "EXAMPLE_VALUE_7JVYlg5yCprfdeGAlNyX"},
							Labels:          []string{"EXAMPLE--Value"},
							RegistryVersion: common.Int(817),
							TimeCreated:     &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")}},
						ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
						ObjectStatus:  common.Int(715),
						ObjectVersion: common.Int(754),
						PrimarySchema: &dataintegration.Schema{ObjectStatus: common.Int(761),
							ObjectVersion: common.Int(782),
							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{AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
								CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
								IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
								InfoFields:      map[string]string{"EXAMPLE_KEY_zpSyF": "EXAMPLE_VALUE_109qrHGa9M1tNEjrvtux"},
								Labels:          []string{"EXAMPLE--Value"},
								RegistryVersion: common.Int(996),
								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")},
								CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(26),
									ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset}}},
								CreatedByName: common.String("EXAMPLE-createdByName-Value"),
								IsFavorite:    common.Bool(false),
								TimeCreated:   &common.SDKTime{Time: time.Now()},
								TimeUpdated:   &common.SDKTime{Time: time.Now()},
								UpdatedByName: common.String("EXAMPLE-updatedByName-Value")},
							ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
							ResourceName:    common.String("EXAMPLE-resourceName-Value"),
							Identifier:      common.String("EXAMPLE-identifier-Value"),
							IsHasContainers: common.Bool(false),
							Key:             common.String("EXAMPLE-key-Value"),
							Name:            common.String("EXAMPLE-name-Value")},
						ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Value: common.String("EXAMPLE-value-Value"),
							Name: common.String("EXAMPLE-name-Value")}},
						Identifier: common.String("EXAMPLE-identifier-Value"),
						IsDefault:  common.Bool(false),
						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")},
						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")},
						Username: common.String("EXAMPLE-username-Value")},
					ExternalKey:  common.String("EXAMPLE-externalKey-Value"),
					Identifier:   common.String("EXAMPLE-identifier-Value"),
					KeyMap:       map[string]string{"EXAMPLE_KEY_5FOoQ": "EXAMPLE_VALUE_ajomjRcKKGj10na5NO1N"},
					ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					Name:         common.String("EXAMPLE-name-Value"),
					Host:         common.String("EXAMPLE-host-Value"),
					Metadata: &dataintegration.ObjectMetadata{AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(961),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeApplication}}},
						InfoFields:    map[string]string{"EXAMPLE_KEY_kcexG": "EXAMPLE_VALUE_Yco6T6I7d3EfnGcp9fhX"},
						TimeCreated:   &common.SDKTime{Time: time.Now()},
						UpdatedBy:     common.String("EXAMPLE-updatedBy-Value"),
						UpdatedByName: common.String("EXAMPLE-updatedByName-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")},
						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"},
						RegistryVersion: common.Int(371),
						TimeUpdated:     &common.SDKTime{Time: time.Now()}},
					Port:            common.String("EXAMPLE-port-Value"),
					AssetProperties: map[string]string{"EXAMPLE_KEY_Us1rJ": "EXAMPLE_VALUE_LW0vin9jQ6yzdj8sS27O"},
					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(869)},
			ApplicationCompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-applicationCompartmentId-Value")}}

	// 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)
}