// 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("HXC2CLJWXTGOM0XMWIUW<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{DisplayName: common.String("EXAMPLE-displayName-Value"),
			ResourceConfiguration: &dataintegration.ResourceConfiguration{TotalExecutors: common.Int(740),
				DriverShape:   common.String("EXAMPLE-driverShape-Value"),
				ExecutorShape: common.String("EXAMPLE-executorShape-Value"),
				SparkVersion:  common.String("EXAMPLE-sparkVersion-Value")},
			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.ConnectionFromRestBasicAuth{Identifier: common.String("EXAMPLE-identifier-Value"),
					ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					Name:         common.String("EXAMPLE-name-Value"),
					Username:     common.String("EXAMPLE-username-Value"),
					ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
						Value: common.String("EXAMPLE-value-Value")}},
					Key: common.String("EXAMPLE-key-Value"),
					Metadata: &dataintegration.ObjectMetadata{IsFavorite: common.Bool(false),
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(934),
						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")},
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						InfoFields:     map[string]string{"EXAMPLE_KEY_I6lL9": "EXAMPLE_VALUE_jycVEemHLa9jSPnDvJ0D"},
						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(791),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeTask}}},
						CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
						CreatedByName: common.String("EXAMPLE-createdByName-Value")},
					PasswordSecret: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
						Value: common.String("EXAMPLE-value-Value")},
					AuthHeader: common.String("EXAMPLE-authHeader-Value"),
					IsDefault:  common.Bool(false),
					KeyMap:     map[string]string{"EXAMPLE_KEY_94MVf": "EXAMPLE_VALUE_NJTQ7MY7Icm4zciRhkYO"},
					PrimarySchema: &dataintegration.Schema{IsHasContainers: common.Bool(true),
						Key:          common.String("EXAMPLE-key-Value"),
						ObjectStatus: common.Int(90),
						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"),
						Identifier:        common.String("EXAMPLE-identifier-Value"),
						Metadata: &dataintegration.ObjectMetadata{AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
							CreatedByName: common.String("EXAMPLE-createdByName-Value"),
							InfoFields:    map[string]string{"EXAMPLE_KEY_5VTuW": "EXAMPLE_VALUE_jEGfzsjvNpVjHNALQ00R"},
							Labels:        []string{"EXAMPLE--Value"},
							TimeCreated:   &common.SDKTime{Time: time.Now()},
							TimeUpdated:   &common.SDKTime{Time: time.Now()},
							UpdatedBy:     common.String("EXAMPLE-updatedBy-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")},
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(110),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeProject}}},
							CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
							IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
							IsFavorite:      common.Bool(false),
							RegistryVersion: common.Int(112),
							UpdatedByName:   common.String("EXAMPLE-updatedByName-Value")},
						ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
						Name:          common.String("EXAMPLE-name-Value"),
						ObjectVersion: common.Int(216),
						ResourceName:  common.String("EXAMPLE-resourceName-Value"),
						Description:   common.String("EXAMPLE-description-Value")},
					Description:   common.String("EXAMPLE-description-Value"),
					ObjectStatus:  common.Int(220),
					ObjectVersion: common.Int(947),
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")}},
				DataAsset: dataintegration.DataAssetFromObjectStorageDetails{AssetProperties: map[string]string{"EXAMPLE_KEY_KPo0O": "EXAMPLE_VALUE_iHgW5Idizb6AnCEzPAVQ"},
					Identifier: common.String("EXAMPLE-identifier-Value"),
					Name:       common.String("EXAMPLE-name-Value"),
					NativeTypeSystem: &dataintegration.TypeSystem{ObjectVersion: common.Int(454),
						TypeMappingTo: map[string]string{"EXAMPLE_KEY_x8m8o": "EXAMPLE_VALUE_1ODIAakdLiNezTTmFm11"},
						Types: []dataintegration.DataType{dataintegration.DataType{ConfigDefinition: &dataintegration.ConfigDefinition{ConfigParameterDefinitions: map[string]dataintegration.ConfigParameterDefinition{"EXAMPLE_KEY_1SdiB": dataintegration.ConfigParameterDefinition{IsClassFieldValue: common.Bool(true),
							IsStatic:      common.Bool(false),
							ParameterName: common.String("EXAMPLE-parameterName-Value"),
							ParameterType: dataintegration.MaterializedCompositeType{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
								ObjectStatus: common.Int(119),
								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:    []string{"EXAMPLE--Value"},
								Key:         common.String("EXAMPLE-key-Value"),
								Name:        common.String("EXAMPLE-name-Value"),
								PathNames:   []string{"EXAMPLE--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(201),
							ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
								RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")}},
							DtType:       dataintegration.DataTypeDtTypePrimitive,
							Name:         common.String("EXAMPLE-name-Value"),
							ObjectStatus: common.Int(737),
							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"),
							Description:    common.String("EXAMPLE-description-Value"),
							Key:            common.String("EXAMPLE-key-Value"),
							ModelVersion:   common.String("EXAMPLE-modelVersion-Value")}},
						Description:  common.String("EXAMPLE-description-Value"),
						Key:          common.String("EXAMPLE-key-Value"),
						ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
						Name:         common.String("EXAMPLE-name-Value"),
						ObjectStatus: common.Int(209),
						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_8GxyC": "EXAMPLE_VALUE_PF4K8mZQD7P0k7YOIivm"},
						Identifier:      common.String("EXAMPLE-identifier-Value")},
					ObjectStatus: common.Int(275),
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					TenancyId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-tenancyId-Value"),
					DefaultConnection: &dataintegration.ConnectionFromObjectStorageDetails{FingerPrint: common.String("EXAMPLE-fingerPrint-Value"),
						Metadata: &dataintegration.ObjectMetadata{CreatedByName: common.String("EXAMPLE-createdByName-Value"),
							InfoFields:    map[string]string{"EXAMPLE_KEY_NswVA": "EXAMPLE_VALUE_KO0fMPT62mRF9XRKfNvS"},
							TimeCreated:   &common.SDKTime{Time: time.Now()},
							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"),
							IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
							IsFavorite:      common.Bool(true),
							Labels:          []string{"EXAMPLE--Value"},
							RegistryVersion: common.Int(227),
							TimeUpdated:     &common.SDKTime{Time: time.Now()},
							UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
							AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(759),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeFolder}}}},
						CredentialFileContent: common.String("EXAMPLE-credentialFileContent-Value"),
						Key:                   common.String("EXAMPLE-key-Value"),
						PassPhrase:            common.String("EXAMPLE-passPhrase-Value"),
						PrimarySchema: &dataintegration.Schema{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"),
							Description:  common.String("EXAMPLE-description-Value"),
							Identifier:   common.String("EXAMPLE-identifier-Value"),
							Key:          common.String("EXAMPLE-key-Value"),
							Metadata: &dataintegration.ObjectMetadata{TimeUpdated: &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")},
								CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(204),
									ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset}}},
								CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
								InfoFields:      map[string]string{"EXAMPLE_KEY_AjSJi": "EXAMPLE_VALUE_5e4Z7vdoY78ekKD5GoZ9"},
								IsFavorite:      common.Bool(false),
								TimeCreated:     &common.SDKTime{Time: time.Now()},
								UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
								UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
								AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
								CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
								IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
								Labels:          []string{"EXAMPLE--Value"},
								RegistryVersion: common.Int(827)},
							ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
							DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
							ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
							IsHasContainers:   common.Bool(true),
							Name:              common.String("EXAMPLE-name-Value"),
							ObjectStatus:      common.Int(57),
							ObjectVersion:     common.Int(423)},
						ObjectVersion: common.Int(658),
						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"),
						IsDefault:    common.Bool(true),
						ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
						Name:         common.String("EXAMPLE-name-Value"),
						ObjectStatus: common.Int(137),
						ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
							Value: common.String("EXAMPLE-value-Value")}},
						Identifier: common.String("EXAMPLE-identifier-Value"),
						UserId:     common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-userId-Value")},
					ExternalKey:  common.String("EXAMPLE-externalKey-Value"),
					Key:          common.String("EXAMPLE-key-Value"),
					KeyMap:       map[string]string{"EXAMPLE_KEY_0nYCz": "EXAMPLE_VALUE_qSf0SBqqojAXcI8bmXE0"},
					ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					Namespace:    common.String("EXAMPLE-namespace-Value"),
					Metadata: &dataintegration.ObjectMetadata{TimeCreated: &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(244),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeTask}}},
						CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						IsFavorite:      common.Bool(false),
						RegistryVersion: common.Int(393),
						TimeUpdated:     &common.SDKTime{Time: time.Now()},
						CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_BisPE": "EXAMPLE_VALUE_Uo7DmnUjsvOORCFXKmHM"},
						Labels:          []string{"EXAMPLE--Value"}},
					ObjectVersion: common.Int(71),
					Url:           common.String("EXAMPLE-url-Value"),
					Description:   common.String("EXAMPLE-description-Value"),
					OciRegion:     common.String("EXAMPLE-ociRegion-Value")},
				Schema: &dataintegration.Schema{ObjectStatus: common.Int(901),
					ObjectVersion: common.Int(555),
					ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
						Parent: common.String("EXAMPLE-parent-Value")},
					ExternalKey: common.String("EXAMPLE-externalKey-Value"),
					Identifier:  common.String("EXAMPLE-identifier-Value"),
					Key:         common.String("EXAMPLE-key-Value"),
					Metadata: &dataintegration.ObjectMetadata{RegistryVersion: common.Int(449),
						TimeCreated:   &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(291),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeConnection}}},
						CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
						CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						IsFavorite:     common.Bool(false),
						TimeUpdated:    &common.SDKTime{Time: time.Now()},
						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")},
						InfoFields: map[string]string{"EXAMPLE_KEY_w6vCF": "EXAMPLE_VALUE_wmlnPj85NbV9pRK0RiWf"},
						Labels:     []string{"EXAMPLE--Value"}},
					ModelType:         common.String("EXAMPLE-modelType-Value"),
					ResourceName:      common.String("EXAMPLE-resourceName-Value"),
					DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
					Description:       common.String("EXAMPLE-description-Value"),
					IsHasContainers:   common.Bool(false),
					ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
					Name:              common.String("EXAMPLE-name-Value")}},
			Description: common.String("EXAMPLE-description-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)
}