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