// 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"
	var objectValue interface{}
	objectValue = "EXAMPLE-objectValue-Value"
	var refValue interface{}
	refValue = "EXAMPLE-refValue-Value"
	var rootObjectValue interface{}
	rootObjectValue = "EXAMPLE-rootObjectValue-Value"
	var wrappedType interface{}
	wrappedType = "EXAMPLE-wrappedType-Value"
	req := dataintegration.CreateExternalPublicationRequest{CreateExternalPublicationDetails: dataintegration.CreateExternalPublicationDetails{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(370)},
		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.ConnectionFromAdwc{ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
				Value: common.String("EXAMPLE-value-Value")}},
				KeyMap:       map[string]string{"EXAMPLE_KEY_oM0xm": "EXAMPLE_VALUE_WiuWUJizT6Wq2J5Xe89u"},
				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")},
				TnsAlias:   common.String("EXAMPLE-tnsAlias-Value"),
				TnsNames:   []string{"EXAMPLE--Value"},
				Username:   common.String("EXAMPLE-username-Value"),
				Identifier: common.String("EXAMPLE-identifier-Value"),
				IsDefault:  common.Bool(false),
				Key:        common.String("EXAMPLE-key-Value"),
				PasswordSecret: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
					Value: common.String("EXAMPLE-value-Value")},
				Description: common.String("EXAMPLE-description-Value"),
				PrimarySchema: &dataintegration.Schema{Metadata: &dataintegration.ObjectMetadata{AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
					CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
					IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
					InfoFields:     map[string]string{"EXAMPLE_KEY_Q7MY7": "EXAMPLE_VALUE_Icm4zciRhkYOQZoHbeUL"},
					Labels:         []string{"EXAMPLE--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(818),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeApplication}}},
					CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
					IsFavorite:      common.Bool(true),
					RegistryVersion: common.Int(620),
					TimeCreated:     &common.SDKTime{Time: time.Now()},
					TimeUpdated:     &common.SDKTime{Time: time.Now()},
					UpdatedBy:       common.String("EXAMPLE-updatedBy-Value")},
					ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
					ObjectStatus:  common.Int(962),
					ObjectVersion: common.Int(498),
					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"),
					Identifier:        common.String("EXAMPLE-identifier-Value"),
					Key:               common.String("EXAMPLE-key-Value"),
					Name:              common.String("EXAMPLE-name-Value"),
					ResourceName:      common.String("EXAMPLE-resourceName-Value"),
					IsHasContainers:   common.Bool(true)},
				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")},
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(731),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeApplication}}},
					CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
					IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
					IsFavorite:      common.Bool(false),
					Labels:          []string{"EXAMPLE--Value"},
					TimeCreated:     &common.SDKTime{Time: time.Now()},
					UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
					AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
					CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
					InfoFields:      map[string]string{"EXAMPLE_KEY_85NbV": "EXAMPLE_VALUE_9pRK0RiWfT0HUdghxC2C"},
					RegistryVersion: common.Int(77),
					TimeUpdated:     &common.SDKTime{Time: time.Now()},
					UpdatedByName:   common.String("EXAMPLE-updatedByName-Value")},
				ObjectStatus:  common.Int(459),
				ObjectVersion: common.Int(934),
				Password:      common.String("EXAMPLE-password-Value")},
			DataAsset: dataintegration.DataAssetFromObjectStorageDetails{DefaultConnection: &dataintegration.ConnectionFromObjectStorageDetails{CredentialFileContent: common.String("EXAMPLE-credentialFileContent-Value"),
				Key:         common.String("EXAMPLE-key-Value"),
				PassPhrase:  common.String("EXAMPLE-passPhrase-Value"),
				Description: common.String("EXAMPLE-description-Value"),
				IsDefault:   common.Bool(false),
				ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
					Value: common.String("EXAMPLE-value-Value")}},
				FingerPrint: common.String("EXAMPLE-fingerPrint-Value"),
				Metadata: &dataintegration.ObjectMetadata{IsFavorite: common.Bool(true),
					Labels:        []string{"EXAMPLE--Value"},
					TimeUpdated:   &common.SDKTime{Time: time.Now()},
					UpdatedBy:     common.String("EXAMPLE-updatedBy-Value"),
					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")},
					AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(187),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeProject}}},
					CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
					RegistryVersion: common.Int(327),
					TimeCreated:     &common.SDKTime{Time: time.Now()},
					CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
					IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
					InfoFields:      map[string]string{"EXAMPLE_KEY_k5mKY": "EXAMPLE_VALUE_sgI6lL9jycVEemHLa9jS"}},
				ObjectStatus:  common.Int(227),
				ObjectVersion: common.Int(866),
				UserId:        common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-userId-Value"),
				Identifier:    common.String("EXAMPLE-identifier-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")},
				PrimarySchema: &dataintegration.Schema{DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
					Description: common.String("EXAMPLE-description-Value"),
					ExternalKey: common.String("EXAMPLE-externalKey-Value"),
					Key:         common.String("EXAMPLE-key-Value"),
					Metadata: &dataintegration.ObjectMetadata{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"),
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_SzE3q": "EXAMPLE_VALUE_An5VTuWjEGfzsjvNpVjH"},
						IsFavorite:      common.Bool(true),
						RegistryVersion: common.Int(413),
						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{ObjectType: dataintegration.CountStatisticSummaryObjectTypeApplication,
							ObjectCount: common.Int64(73)}}},
						CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
						Labels:        []string{"EXAMPLE--Value"},
						UpdatedBy:     common.String("EXAMPLE-updatedBy-Value"),
						UpdatedByName: common.String("EXAMPLE-updatedByName-Value")},
					ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
					ObjectStatus:    common.Int(559),
					Identifier:      common.String("EXAMPLE-identifier-Value"),
					IsHasContainers: common.Bool(false),
					Name:            common.String("EXAMPLE-name-Value"),
					ObjectVersion:   common.Int(367),
					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")}},
				Metadata: &dataintegration.ObjectMetadata{CreatedByName: common.String("EXAMPLE-createdByName-Value"),
					IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
					Labels:          []string{"EXAMPLE--Value"},
					RegistryVersion: common.Int(823),
					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_7vdoY": "EXAMPLE_VALUE_78ekKD5GoZ9Vgh7yieuG"},
					IsFavorite:    common.Bool(true),
					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(784),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeTask}}}},
				OciRegion: common.String("EXAMPLE-ociRegion-Value"),
				ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
					RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
				NativeTypeSystem: &dataintegration.TypeSystem{ObjectStatus: common.Int(127),
					TypeMappingTo: map[string]string{"EXAMPLE_KEY_EzPAV": "EXAMPLE_VALUE_QIx8m8o1ODIAakdLiNez"},
					Types: []dataintegration.DataType{dataintegration.DataType{Name: common.String("EXAMPLE-name-Value"),
						ObjectStatus: common.Int(670),
						ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
							Parent: common.String("EXAMPLE-parent-Value")},
						ConfigDefinition: &dataintegration.ConfigDefinition{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
							Name:         common.String("EXAMPLE-name-Value"),
							ObjectStatus: common.Int(749),
							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_JSUcJ": dataintegration.ConfigParameterDefinition{DefaultValue: &defaultValue,
								Description:       common.String("EXAMPLE-description-Value"),
								IsClassFieldValue: common.Bool(true),
								IsStatic:          common.Bool(false),
								ParameterName:     common.String("EXAMPLE-parameterName-Value"),
								ParameterType: dataintegration.ConfiguredType{Key: common.String("EXAMPLE-key-Value"),
									ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
									Name:         common.String("EXAMPLE-name-Value"),
									ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
										Parent: common.String("EXAMPLE-parent-Value")},
									ConfigValues: &dataintegration.ConfigValues{ConfigParamValues: map[string]dataintegration.ConfigParameterValue{"EXAMPLE_KEY_qSf0S": dataintegration.ConfigParameterValue{IntValue: common.Int(60),
										ObjectValue:     &objectValue,
										ParameterValue:  common.String("EXAMPLE-parameterValue-Value"),
										RefValue:        &refValue,
										RootObjectValue: &rootObjectValue,
										StringValue:     common.String("EXAMPLE-stringValue-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(209),
									WrappedType:  &wrappedType},
								ClassFieldName: common.String("EXAMPLE-classFieldName-Value")}},
							IsContained: common.Bool(true),
							Key:         common.String("EXAMPLE-key-Value")},
						DtType:         dataintegration.DataTypeDtTypeStructured,
						Key:            common.String("EXAMPLE-key-Value"),
						TypeSystemName: common.String("EXAMPLE-typeSystemName-Value"),
						Description:    common.String("EXAMPLE-description-Value"),
						ModelVersion:   common.String("EXAMPLE-modelVersion-Value")}},
					Key:           common.String("EXAMPLE-key-Value"),
					ObjectVersion: common.Int(212),
					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_TTmFm": "EXAMPLE_VALUE_118GxyCPF4K8mZQD7P0k"},
					Description:     common.String("EXAMPLE-description-Value"),
					Identifier:      common.String("EXAMPLE-identifier-Value"),
					ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
					Name:            common.String("EXAMPLE-name-Value")},
				ExternalKey:     common.String("EXAMPLE-externalKey-Value"),
				Identifier:      common.String("EXAMPLE-identifier-Value"),
				Key:             common.String("EXAMPLE-key-Value"),
				KeyMap:          map[string]string{"EXAMPLE_KEY_5NswV": "EXAMPLE_VALUE_AKO0fMPT62mRF9XRKfNv"},
				ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
				Namespace:       common.String("EXAMPLE-namespace-Value"),
				Name:            common.String("EXAMPLE-name-Value"),
				ObjectVersion:   common.Int(30),
				TenancyId:       common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-tenancyId-Value"),
				ObjectStatus:    common.Int(535),
				Description:     common.String("EXAMPLE-description-Value"),
				Url:             common.String("EXAMPLE-url-Value"),
				AssetProperties: map[string]string{"EXAMPLE_KEY_QJMkE": "EXAMPLE_VALUE_WDKPo0OiHgW5Idizb6An"}},
			Schema: &dataintegration.Schema{DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
				Description:     common.String("EXAMPLE-description-Value"),
				IsHasContainers: common.Bool(false),
				Key:             common.String("EXAMPLE-key-Value"),
				ModelType:       common.String("EXAMPLE-modelType-Value"),
				ObjectStatus:    common.Int(40),
				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"),
				Identifier:   common.String("EXAMPLE-identifier-Value"),
				Metadata: &dataintegration.ObjectMetadata{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")},
					CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
					IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
					InfoFields:      map[string]string{"EXAMPLE_KEY_S0Fnm": "EXAMPLE_VALUE_u9lLoHxdHJWgh1vFrGSG"},
					IsFavorite:      common.Bool(false),
					RegistryVersion: common.Int(775),
					TimeCreated:     &common.SDKTime{Time: time.Now()},
					AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(874),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeFunctionLibrary}}},
					CreatedBy:   common.String("EXAMPLE-createdBy-Value"),
					Labels:      []string{"EXAMPLE--Value"},
					TimeUpdated: &common.SDKTime{Time: time.Now()}},
				ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
				Name:          common.String("EXAMPLE-name-Value"),
				ObjectVersion: common.Int(277)}},
		Description: common.String("EXAMPLE-description-Value")},
		OpcRequestId:  common.String("YWUJFT79X3PXMY5DGMFF<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")}

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