// 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{CreateExternalPublicationDetails: dataintegration.CreateExternalPublicationDetails{ConfigurationDetails: &dataintegration.ConfigurationDetails{Schema: &dataintegration.Schema{DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
		Name:            common.String("EXAMPLE-name-Value"),
		ObjectStatus:    common.Int(90),
		Description:     common.String("EXAMPLE-description-Value"),
		ExternalKey:     common.String("EXAMPLE-externalKey-Value"),
		IsHasContainers: common.Bool(true),
		Key:             common.String("EXAMPLE-key-Value"),
		Metadata: &dataintegration.ObjectMetadata{CreatedByName: common.String("EXAMPLE-createdByName-Value"),
			IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
			RegistryVersion: common.Int(491),
			TimeUpdated:     &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")},
			CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(774),
				ObjectType: dataintegration.CountStatisticSummaryObjectTypeProject}}},
			TimeCreated:   &common.SDKTime{Time: time.Now()},
			CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
			InfoFields:    map[string]string{"EXAMPLE_KEY_DrKaW": "EXAMPLE_VALUE_crj6bvi9ICS5dlyj173Z"},
			Labels:        []string{"EXAMPLE--Value"},
			UpdatedBy:     common.String("EXAMPLE-updatedBy-Value"),
			AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
			IsFavorite:    common.Bool(false)},
		ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
		ObjectVersion: common.Int(545),
		ResourceName:  common.String("EXAMPLE-resourceName-Value"),
		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"),
		ModelType:  common.String("EXAMPLE-modelType-Value")},
		CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
		Connection: dataintegration.ConnectionFromAmazonS3{KeyMap: map[string]string{"EXAMPLE_KEY_7iCp2": "EXAMPLE_VALUE_NsPeCVBCoXUgSgHq7LWR"},
			PrimarySchema: &dataintegration.Schema{Description: common.String("EXAMPLE-description-Value"),
				IsHasContainers: common.Bool(true),
				ObjectStatus:    common.Int(624),
				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")},
				DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
				ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
				Metadata: &dataintegration.ObjectMetadata{IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
					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")},
					CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
					InfoFields:      map[string]string{"EXAMPLE_KEY_ZWr7l": "EXAMPLE_VALUE_MKhiKVPd5soszfkk9ous"},
					RegistryVersion: common.Int(690),
					TimeUpdated:     &common.SDKTime{Time: time.Now()},
					AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
					CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
					Labels:          []string{"EXAMPLE--Value"},
					UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(658),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeFunctionLibrary}}},
					IsFavorite:  common.Bool(true),
					TimeCreated: &common.SDKTime{Time: time.Now()}},
				ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
				ObjectVersion: common.Int(134),
				Identifier:    common.String("EXAMPLE-identifier-Value"),
				ResourceName:  common.String("EXAMPLE-resourceName-Value")},
			Description: common.String("EXAMPLE-description-Value"),
			ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
				RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
			ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Value: common.String("EXAMPLE-value-Value"),
				Name: common.String("EXAMPLE-name-Value")}},
			Metadata: &dataintegration.ObjectMetadata{CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(19),
				ObjectType: dataintegration.CountStatisticSummaryObjectTypeFolder}}},
				IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
				InfoFields:      map[string]string{"EXAMPLE_KEY_08u1f": "EXAMPLE_VALUE_f4GMD6jAkYyI1yRdL0nA"},
				RegistryVersion: common.Int(501),
				AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
				TimeUpdated:     &common.SDKTime{Time: time.Now()},
				Labels:          []string{"EXAMPLE--Value"},
				UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
				TimeCreated:     &common.SDKTime{Time: time.Now()},
				CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
				CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
				IsFavorite:      common.Bool(false),
				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")}},
			ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
			ObjectVersion: common.Int(587),
			IsDefault:     common.Bool(false),
			Identifier:    common.String("EXAMPLE-identifier-Value"),
			Key:           common.String("EXAMPLE-key-Value"),
			Name:          common.String("EXAMPLE-name-Value"),
			ObjectStatus:  common.Int(617),
			SecretKey: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
				Value: common.String("EXAMPLE-value-Value")},
			AccessKey: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
				Value: common.String("EXAMPLE-value-Value")}},
		DataAsset: dataintegration.DataAssetFromLakeDetails{Description: common.String("EXAMPLE-description-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")},
			AssetProperties: map[string]string{"EXAMPLE_KEY_1ogaP": "EXAMPLE_VALUE_ClhRJcskNobq4ut85guE"},
			DefaultConnection: &dataintegration.ConnectionFromLakeDetails{ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
				Value: common.String("EXAMPLE-value-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"),
				PrimarySchema: &dataintegration.Schema{Description: common.String("EXAMPLE-description-Value"),
					Metadata: &dataintegration.ObjectMetadata{IsFavorite: common.Bool(false),
						CreatedByName: common.String("EXAMPLE-createdByName-Value"),
						AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
						InfoFields:    map[string]string{"EXAMPLE_KEY_2gLfR": "EXAMPLE_VALUE_Ui5SvOe5DFkfNIG1lhPG"},
						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"),
						Labels:         []string{"EXAMPLE--Value"},
						UpdatedByName:  common.String("EXAMPLE-updatedByName-Value"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(888),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeFolder}}},
						RegistryVersion: common.Int(708),
						TimeCreated:     &common.SDKTime{Time: time.Now()},
						CreatedBy:       common.String("EXAMPLE-createdBy-Value")},
					ObjectStatus:      common.Int(270),
					DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
					Key:               common.String("EXAMPLE-key-Value"),
					ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
					ObjectVersion:     common.Int(868),
					IsHasContainers:   common.Bool(false),
					Name:              common.String("EXAMPLE-name-Value"),
					ResourceName:      common.String("EXAMPLE-resourceName-Value"),
					ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
					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")},
				IsDefault: common.Bool(false),
				Metadata: &dataintegration.ObjectMetadata{CreatedBy: common.String("EXAMPLE-createdBy-Value"),
					RegistryVersion: common.Int(868),
					TimeUpdated:     &common.SDKTime{Time: time.Now()},
					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")},
					TimeCreated:    &common.SDKTime{Time: time.Now()},
					UpdatedBy:      common.String("EXAMPLE-updatedBy-Value"),
					AggregatorKey:  common.String("EXAMPLE-aggregatorKey-Value"),
					CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
					IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
					IsFavorite:     common.Bool(false),
					Labels:         []string{"EXAMPLE--Value"},
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(567),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeFunctionLibrary}}},
					InfoFields: map[string]string{"EXAMPLE_KEY_M8HX4": "EXAMPLE_VALUE_JWEzOYn00twQJlj477Rh"}},
				ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
				ObjectStatus:  common.Int(224),
				ObjectVersion: common.Int(561),
				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"),
			NativeTypeSystem: &dataintegration.TypeSystem{Description: common.String("EXAMPLE-description-Value"),
				Identifier:      common.String("EXAMPLE-identifier-Value"),
				ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
				ObjectStatus:    common.Int(944),
				ObjectVersion:   common.Int(780),
				TypeMappingFrom: map[string]string{"EXAMPLE_KEY_B8YlJ": "EXAMPLE_VALUE_eV0mqo9ksYMBO4Aqv1qr"},
				TypeMappingTo:   map[string]string{"EXAMPLE_KEY_JpsFo": "EXAMPLE_VALUE_j8o4h0PRKrup8Dm7CdYn"},
				Types: []dataintegration.DataType{dataintegration.DataType{TypeSystemName: common.String("EXAMPLE-typeSystemName-Value"),
					ConfigDefinition: &dataintegration.ConfigDefinition{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
						Name:         common.String("EXAMPLE-name-Value"),
						ObjectStatus: common.Int(397),
						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_QuhrE": dataintegration.ConfigParameterDefinition{ParameterName: common.String("EXAMPLE-parameterName-Value"),
							ClassFieldName:    common.String("EXAMPLE-classFieldName-Value"),
							DefaultValue:      &defaultValue,
							Description:       common.String("EXAMPLE-description-Value"),
							IsClassFieldValue: common.Bool(false),
							IsStatic:          common.Bool(false)}},
						IsContained: common.Bool(false),
						Key:         common.String("EXAMPLE-key-Value")},
					DtType:       dataintegration.DataTypeDtTypeStructured,
					Key:          common.String("EXAMPLE-key-Value"),
					Name:         common.String("EXAMPLE-name-Value"),
					ObjectStatus: common.Int(534),
					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")}},
				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")}},
			LakeId:            common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-lakeId-Value"),
			LakeProxyEndpoint: common.String("EXAMPLE-lakeProxyEndpoint-Value"),
			MetastoreId:       common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-metastoreId-Value"),
			ObjectVersion:     common.Int(816),
			ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
			ObjectStatus:      common.Int(399),
			Identifier:        common.String("EXAMPLE-identifier-Value"),
			Key:               common.String("EXAMPLE-key-Value"),
			KeyMap:            map[string]string{"EXAMPLE_KEY_PpzLp": "EXAMPLE_VALUE_LbsRAWO6hzWZCebyBeV5"},
			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")},
				RegistryVersion: common.Int(515),
				Labels:          []string{"EXAMPLE--Value"},
				UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
				AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
				CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(931),
					ObjectType: dataintegration.CountStatisticSummaryObjectTypeConnection}}},
				IsFavorite:     common.Bool(false),
				CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
				CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
				UpdatedBy:      common.String("EXAMPLE-updatedBy-Value"),
				TimeUpdated:    &common.SDKTime{Time: time.Now()},
				IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
				InfoFields:     map[string]string{"EXAMPLE_KEY_YJbnt": "EXAMPLE_VALUE_LbDo2avBQYJywkQsti2C"},
				TimeCreated:    &common.SDKTime{Time: time.Now()}}}},
		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(385)},
		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("SCQFGVFXAE4U4FESRDAF<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)
}