// 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 wrappedType interface{}
	wrappedType = "EXAMPLE-wrappedType-Value"
	var objectValue interface{}
	objectValue = "EXAMPLE-objectValue-Value"
	var refValue interface{}
	refValue = "EXAMPLE-refValue-Value"
	var rootObjectValue interface{}
	rootObjectValue = "EXAMPLE-rootObjectValue-Value"
	var defaultValue interface{}
	defaultValue = "EXAMPLE-defaultValue-Value"
	req := dataintegration.CreateExternalPublicationRequest{CreateExternalPublicationDetails: dataintegration.CreateExternalPublicationDetails{ConfigurationDetails: &dataintegration.ConfigurationDetails{CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
		Connection: dataintegration.ConnectionFromOracle{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")},
			Password:      common.String("EXAMPLE-password-Value"),
			ObjectVersion: common.Int(710),
			ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
				Value: common.String("EXAMPLE-value-Value")}},
			Description:  common.String("EXAMPLE-description-Value"),
			Key:          common.String("EXAMPLE-key-Value"),
			Name:         common.String("EXAMPLE-name-Value"),
			ObjectStatus: common.Int(273),
			PrimarySchema: &dataintegration.Schema{IsHasContainers: common.Bool(false),
				Key: common.String("EXAMPLE-key-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")},
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(959),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeUserDefinedFunction}}},
					CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
					RegistryVersion: common.Int(576),
					TimeCreated:     &common.SDKTime{Time: time.Now()},
					TimeUpdated:     &common.SDKTime{Time: time.Now()},
					AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
					CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
					IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
					InfoFields:      map[string]string{"EXAMPLE_KEY_u9G6q": "EXAMPLE_VALUE_vam2JZDk2evO16s0qtSF"},
					IsFavorite:      common.Bool(false),
					Labels:          []string{"EXAMPLE--Value"},
					UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
					UpdatedByName:   common.String("EXAMPLE-updatedByName-Value")},
				ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
					RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
				ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
				Name:              common.String("EXAMPLE-name-Value"),
				ObjectStatus:      common.Int(237),
				ObjectVersion:     common.Int(85),
				ResourceName:      common.String("EXAMPLE-resourceName-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")},
			Identifier: common.String("EXAMPLE-identifier-Value"),
			PasswordSecret: &dataintegration.SensitiveAttribute{Value: common.String("EXAMPLE-value-Value"),
				SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")}},
			IsDefault: common.Bool(true),
			KeyMap:    map[string]string{"EXAMPLE_KEY_a1SVo": "EXAMPLE_VALUE_bHMJPFXM3sh8lSkJ5KOV"},
			Metadata: &dataintegration.ObjectMetadata{CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(500),
				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_K3ACk": "EXAMPLE_VALUE_4368rHbJArYtf6gho1Io"},
				IsFavorite:      common.Bool(true),
				Labels:          []string{"EXAMPLE--Value"},
				AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
				RegistryVersion: common.Int(147),
				TimeCreated:     &common.SDKTime{Time: time.Now()},
				TimeUpdated:     &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")}},
			Username: common.String("EXAMPLE-username-Value")},
		DataAsset: dataintegration.DataAssetFromObjectStorageDetails{AssetProperties: map[string]string{"EXAMPLE_KEY_Uo4k9": "EXAMPLE_VALUE_T1cGam61XnZKcShsOd2C"},
			Description: common.String("EXAMPLE-description-Value"),
			KeyMap:      map[string]string{"EXAMPLE_KEY_dSUfm": "EXAMPLE_VALUE_sraQ0mc2s2YdlTzeyHPV"},
			Namespace:   common.String("EXAMPLE-namespace-Value"),
			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")},
			DefaultConnection: &dataintegration.ConnectionFromObjectStorageDetails{CredentialFileContent: common.String("EXAMPLE-credentialFileContent-Value"),
				Metadata: &dataintegration.ObjectMetadata{InfoFields: map[string]string{"EXAMPLE_KEY_jG06S": "EXAMPLE_VALUE_HatxQ2rnHQjoGVEPFOHz"},
					Labels:          []string{"EXAMPLE--Value"},
					RegistryVersion: common.Int(265),
					IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
					IsFavorite:      common.Bool(false),
					TimeCreated:     &common.SDKTime{Time: time.Now()},
					TimeUpdated:     &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(918),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset}}},
					CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
					CreatedByName: common.String("EXAMPLE-createdByName-Value")},
				Description:  common.String("EXAMPLE-description-Value"),
				IsDefault:    common.Bool(false),
				ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
				ObjectStatus: common.Int(371),
				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"),
					IsHasContainers: common.Bool(true),
					Metadata: &dataintegration.ObjectMetadata{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(808),
						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(782),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeFunctionLibrary}}},
						InfoFields:  map[string]string{"EXAMPLE_KEY_0uQBk": "EXAMPLE_VALUE_tVeKnXu2ngJf8Gl64665"},
						Labels:      []string{"EXAMPLE--Value"},
						TimeCreated: &common.SDKTime{Time: time.Now()},
						TimeUpdated: &common.SDKTime{Time: time.Now()}},
					ObjectStatus:  common.Int(163),
					ObjectVersion: common.Int(481),
					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")},
					ResourceName: common.String("EXAMPLE-resourceName-Value")},
				UserId:     common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-userId-Value"),
				Identifier: common.String("EXAMPLE-identifier-Value"),
				Key:        common.String("EXAMPLE-key-Value"),
				Name:       common.String("EXAMPLE-name-Value"),
				PassPhrase: common.String("EXAMPLE-passPhrase-Value"),
				ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
					Value: common.String("EXAMPLE-value-Value")}},
				FingerPrint:   common.String("EXAMPLE-fingerPrint-Value"),
				ObjectVersion: common.Int(25)},
			Identifier: common.String("EXAMPLE-identifier-Value"),
			Key:        common.String("EXAMPLE-key-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")},
				CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(981),
					ObjectType: dataintegration.CountStatisticSummaryObjectTypeFolder}}},
				CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
				Labels:          []string{"EXAMPLE--Value"},
				RegistryVersion: common.Int(694),
				TimeCreated:     &common.SDKTime{Time: time.Now()},
				TimeUpdated:     &common.SDKTime{Time: time.Now()},
				AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
				CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
				IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
				InfoFields:      map[string]string{"EXAMPLE_KEY_Tsarr": "EXAMPLE_VALUE_dpMhVPQHsLK59mRCW6Tt"},
				IsFavorite:      common.Bool(false),
				UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
				UpdatedByName:   common.String("EXAMPLE-updatedByName-Value")},
			ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
			ObjectStatus: common.Int(722),
			Url:          common.String("EXAMPLE-url-Value"),
			NativeTypeSystem: &dataintegration.TypeSystem{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
				Name:          common.String("EXAMPLE-name-Value"),
				ObjectStatus:  common.Int(963),
				ObjectVersion: common.Int(913),
				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"),
				TypeMappingFrom: map[string]string{"EXAMPLE_KEY_vEGCP": "EXAMPLE_VALUE_fFfvsXQfHAWhjkkwbLkq"},
				TypeMappingTo:   map[string]string{"EXAMPLE_KEY_ZVvny": "EXAMPLE_VALUE_VicPVPETMCWuHJRrulO3"},
				Types: []dataintegration.DataType{dataintegration.DataType{ConfigDefinition: &dataintegration.ConfigDefinition{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					Name:         common.String("EXAMPLE-name-Value"),
					ObjectStatus: common.Int(107),
					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_7JULm": dataintegration.ConfigParameterDefinition{ParameterType: dataintegration.ConfiguredType{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")},
						WrappedType: &wrappedType,
						ConfigValues: &dataintegration.ConfigValues{ConfigParamValues: map[string]dataintegration.ConfigParameterValue{"EXAMPLE_KEY_f2bFZ": dataintegration.ConfigParameterValue{ObjectValue: &objectValue,
							ParameterValue:  common.String("EXAMPLE-parameterValue-Value"),
							RefValue:        &refValue,
							RootObjectValue: &rootObjectValue,
							StringValue:     common.String("EXAMPLE-stringValue-Value"),
							IntValue:        common.Int(57)}},
							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(998)},
						ClassFieldName:    common.String("EXAMPLE-classFieldName-Value"),
						DefaultValue:      &defaultValue,
						Description:       common.String("EXAMPLE-description-Value"),
						IsClassFieldValue: common.Bool(true),
						IsStatic:          common.Bool(true),
						ParameterName:     common.String("EXAMPLE-parameterName-Value")}},
					IsContained: common.Bool(true),
					Key:         common.String("EXAMPLE-key-Value")},
					DtType:         dataintegration.DataTypeDtTypeStructured,
					Name:           common.String("EXAMPLE-name-Value"),
					TypeSystemName: common.String("EXAMPLE-typeSystemName-Value"),
					Description:    common.String("EXAMPLE-description-Value"),
					Key:            common.String("EXAMPLE-key-Value"),
					ModelVersion:   common.String("EXAMPLE-modelVersion-Value"),
					ObjectStatus:   common.Int(985),
					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")},
			ObjectVersion: common.Int(533),
			ExternalKey:   common.String("EXAMPLE-externalKey-Value"),
			Name:          common.String("EXAMPLE-name-Value"),
			TenancyId:     common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-tenancyId-Value")},
		Schema: &dataintegration.Schema{Description: common.String("EXAMPLE-description-Value"),
			ModelType:     common.String("EXAMPLE-modelType-Value"),
			ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
			ObjectVersion: common.Int(848),
			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"),
			Metadata: &dataintegration.ObjectMetadata{TimeUpdated: &common.SDKTime{Time: time.Now()},
				UpdatedBy:      common.String("EXAMPLE-updatedBy-Value"),
				UpdatedByName:  common.String("EXAMPLE-updatedByName-Value"),
				CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
				CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
				IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
				IsFavorite:     common.Bool(true),
				Labels:         []string{"EXAMPLE--Value"},
				TimeCreated:    &common.SDKTime{Time: time.Now()},
				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(984),
					ObjectType: dataintegration.CountStatisticSummaryObjectTypeProject}}},
				InfoFields:      map[string]string{"EXAMPLE_KEY_jLcJt": "EXAMPLE_VALUE_PnzH6x2nrA7z71iYvLYf"},
				RegistryVersion: common.Int(257)},
			Name:         common.String("EXAMPLE-name-Value"),
			ObjectStatus: common.Int(169)}},
		Description: common.String("EXAMPLE-description-Value"),
		DisplayName: common.String("EXAMPLE-displayName-Value"),
		ResourceConfiguration: &dataintegration.ResourceConfiguration{SparkVersion: common.String("EXAMPLE-sparkVersion-Value"),
			TotalExecutors: common.Int(500),
			DriverShape:    common.String("EXAMPLE-driverShape-Value"),
			ExecutorShape:  common.String("EXAMPLE-executorShape-Value")},
		ApplicationCompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-applicationCompartmentId-Value"),
		ApplicationId:            common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-applicationId-Value")},
		OpcRequestId:  common.String("ZMS1EBPJJ2VJRSBSYODZ<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)
}