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