// 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{ApplicationId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-applicationId-Value"),
		ConfigurationDetails: &dataintegration.ConfigurationDetails{Connection: dataintegration.ConnectionFromAmazonS3{Key: common.String("EXAMPLE-key-Value"),
			ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
			ObjectStatus: common.Int(251),
			IsDefault:    common.Bool(true),
			Metadata: &dataintegration.ObjectMetadata{AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
				IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
				InfoFields:     map[string]string{"EXAMPLE_KEY_rkH2R": "EXAMPLE_VALUE_PUUgN2bUPbBYlNsYuapq"},
				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(323),
					ObjectType: dataintegration.CountStatisticSummaryObjectTypeTask}}},
				CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
				RegistryVersion: common.Int(873),
				TimeUpdated:     &common.SDKTime{Time: time.Now()},
				UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
				Labels:          []string{"EXAMPLE--Value"},
				TimeCreated:     &common.SDKTime{Time: time.Now()},
				UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
				CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
				IsFavorite:      common.Bool(false)},
			Name: common.String("EXAMPLE-name-Value"),
			PrimarySchema: &dataintegration.Schema{Metadata: &dataintegration.ObjectMetadata{IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
				TimeCreated:   &common.SDKTime{Time: time.Now()},
				AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
				CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(537),
					ObjectType: dataintegration.CountStatisticSummaryObjectTypeTask}}},
				InfoFields:    map[string]string{"EXAMPLE_KEY_XaGcu": "EXAMPLE_VALUE_bjTQvye1MxVhN0wUalmR"},
				UpdatedByName: common.String("EXAMPLE-updatedByName-Value"),
				CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
				CreatedByName: common.String("EXAMPLE-createdByName-Value"),
				IsFavorite:    common.Bool(true),
				Labels:        []string{"EXAMPLE--Value"},
				TimeUpdated:   &common.SDKTime{Time: time.Now()},
				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")},
				RegistryVersion: common.Int(391)},
				ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
				ObjectStatus:    common.Int(249),
				ObjectVersion:   common.Int(791),
				ResourceName:    common.String("EXAMPLE-resourceName-Value"),
				Description:     common.String("EXAMPLE-description-Value"),
				IsHasContainers: common.Bool(true),
				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")},
				DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
				Name:              common.String("EXAMPLE-name-Value"),
				Identifier:        common.String("EXAMPLE-identifier-Value"),
				ExternalKey:       common.String("EXAMPLE-externalKey-Value")},
			Description: common.String("EXAMPLE-description-Value"),
			ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Value: common.String("EXAMPLE-value-Value"),
				Name: common.String("EXAMPLE-name-Value")}},
			Identifier: common.String("EXAMPLE-identifier-Value"),
			KeyMap:     map[string]string{"EXAMPLE_KEY_oPYgH": "EXAMPLE_VALUE_vUf21Zs82R4HhC7aNsdk"},
			AccessKey: &dataintegration.SensitiveAttribute{Value: common.String("EXAMPLE-value-Value"),
				SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")}},
			ObjectVersion: common.Int(728),
			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")}},
			DataAsset: dataintegration.DataAssetFromAmazonS3{ExternalKey: common.String("EXAMPLE-externalKey-Value"),
				KeyMap: map[string]string{"EXAMPLE_KEY_rosHV": "EXAMPLE_VALUE_iiFOzzheOvy8BTkiCbz1"},
				NativeTypeSystem: &dataintegration.TypeSystem{Description: common.String("EXAMPLE-description-Value"),
					Identifier:   common.String("EXAMPLE-identifier-Value"),
					ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					Name:         common.String("EXAMPLE-name-Value"),
					ObjectStatus: common.Int(353),
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					Key:             common.String("EXAMPLE-key-Value"),
					ObjectVersion:   common.Int(147),
					TypeMappingFrom: map[string]string{"EXAMPLE_KEY_OkmZa": "EXAMPLE_VALUE_7u9HWgswPRC8TSLJ2XZK"},
					TypeMappingTo:   map[string]string{"EXAMPLE_KEY_QSa4n": "EXAMPLE_VALUE_SKoK41Zb4U6Z2kEzQgLJ"},
					Types: []dataintegration.DataType{dataintegration.DataType{ObjectStatus: common.Int(658),
						TypeSystemName: common.String("EXAMPLE-typeSystemName-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_gvkzE": dataintegration.ConfigParameterDefinition{ParameterName: common.String("EXAMPLE-parameterName-Value"),
								ParameterType: dataintegration.DerivedType{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(824),
									ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
										RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-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"),
							ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
							Name:         common.String("EXAMPLE-name-Value"),
							ObjectStatus: common.Int(827)},
						DtType:       dataintegration.DataTypeDtTypePrimitive,
						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")},
						Description: common.String("EXAMPLE-description-Value"),
						Key:         common.String("EXAMPLE-key-Value")}}},
				ObjectVersion: common.Int(764),
				Description:   common.String("EXAMPLE-description-Value"),
				Key:           common.String("EXAMPLE-key-Value"),
				ObjectStatus:  common.Int(358),
				ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
					RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
				Region:          common.String("EXAMPLE-region-Value"),
				AssetProperties: map[string]string{"EXAMPLE_KEY_0jIAF": "EXAMPLE_VALUE_2X8Nz3C5T42RPc0WasrX"},
				DefaultConnection: &dataintegration.ConnectionSummaryFromAmazonS3{KeyMap: map[string]string{"EXAMPLE_KEY_G3DeD": "EXAMPLE_VALUE_iW8hcZrYkDdadQDXOgee"},
					ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					ObjectStatus: common.Int(832),
					Description:  common.String("EXAMPLE-description-Value"),
					Key:          common.String("EXAMPLE-key-Value"),
					ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
						Parent: common.String("EXAMPLE-parent-Value")},
					Identifier:    common.String("EXAMPLE-identifier-Value"),
					ObjectVersion: common.Int(89),
					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{Value: common.String("EXAMPLE-value-Value"),
						SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")}},
					IsDefault: common.Bool(false),
					Metadata: &dataintegration.ObjectMetadata{TimeUpdated: &common.SDKTime{Time: time.Now()},
						Labels:         []string{"EXAMPLE--Value"},
						UpdatedBy:      common.String("EXAMPLE-updatedBy-Value"),
						UpdatedByName:  common.String("EXAMPLE-updatedByName-Value"),
						CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
						InfoFields:     map[string]string{"EXAMPLE_KEY_Rfctj": "EXAMPLE_VALUE_BIB8I6c6Je1JBjSoUsdn"},
						CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						TimeCreated:    &common.SDKTime{Time: time.Now()},
						AggregatorKey:  common.String("EXAMPLE-aggregatorKey-Value"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(654),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeApplication}}},
						RegistryVersion: common.Int(744),
						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)},
					Name: common.String("EXAMPLE-name-Value"),
					PrimarySchema: &dataintegration.Schema{ObjectStatus: common.Int(942),
						ObjectVersion:     common.Int(548),
						Description:       common.String("EXAMPLE-description-Value"),
						Identifier:        common.String("EXAMPLE-identifier-Value"),
						IsHasContainers:   common.Bool(true),
						DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
						ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
						Key:               common.String("EXAMPLE-key-Value"),
						Name:              common.String("EXAMPLE-name-Value"),
						Metadata: &dataintegration.ObjectMetadata{InfoFields: map[string]string{"EXAMPLE_KEY_Bbm9m": "EXAMPLE_VALUE_j7XLRjSswVZlLYzlFFba"},
							Labels:          []string{"EXAMPLE--Value"},
							RegistryVersion: common.Int(541),
							AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
							CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
							IsFavorite:      common.Bool(true),
							TimeCreated:     &common.SDKTime{Time: time.Now()},
							TimeUpdated:     &common.SDKTime{Time: time.Now()},
							UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
							IdentifierPath:  common.String("EXAMPLE-identifierPath-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")},
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(642),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeUserDefinedFunction}}},
							CreatedBy: common.String("EXAMPLE-createdBy-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")},
						ResourceName: common.String("EXAMPLE-resourceName-Value")},
					ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
						Value: common.String("EXAMPLE-value-Value")}}},
				Metadata: &dataintegration.ObjectMetadata{CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(224),
					ObjectType: dataintegration.CountStatisticSummaryObjectTypeApplication}}},
					TimeUpdated:     &common.SDKTime{Time: time.Now()},
					UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
					AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
					CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
					CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
					IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
					Labels:          []string{"EXAMPLE--Value"},
					RegistryVersion: common.Int(272),
					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")},
					InfoFields:  map[string]string{"EXAMPLE_KEY_R9H9o": "EXAMPLE_VALUE_1er28Y9kNCTWyHWwGDyt"},
					IsFavorite:  common.Bool(true),
					TimeCreated: &common.SDKTime{Time: time.Now()}},
				Name:         common.String("EXAMPLE-name-Value"),
				Identifier:   common.String("EXAMPLE-identifier-Value"),
				ModelVersion: common.String("EXAMPLE-modelVersion-Value")},
			Schema: &dataintegration.Schema{Description: common.String("EXAMPLE-description-Value"),
				ExternalKey:  common.String("EXAMPLE-externalKey-Value"),
				ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
				ObjectStatus: common.Int(535),
				Identifier:   common.String("EXAMPLE-identifier-Value"),
				Key:          common.String("EXAMPLE-key-Value"),
				ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
					Parent: common.String("EXAMPLE-parent-Value")},
				ResourceName:      common.String("EXAMPLE-resourceName-Value"),
				DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
				IsHasContainers:   common.Bool(true),
				Metadata: &dataintegration.ObjectMetadata{RegistryVersion: common.Int(482),
					TimeCreated: &common.SDKTime{Time: time.Now()},
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(452),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeFunctionLibrary}}},
					TimeUpdated: &common.SDKTime{Time: time.Now()},
					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")},
					AggregatorKey:  common.String("EXAMPLE-aggregatorKey-Value"),
					Labels:         []string{"EXAMPLE--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"),
					InfoFields:     map[string]string{"EXAMPLE_KEY_Svgt2": "EXAMPLE_VALUE_Tvlcnw0vYDKS5L0LuW3e"},
					IsFavorite:     common.Bool(false)},
				ModelType:     common.String("EXAMPLE-modelType-Value"),
				Name:          common.String("EXAMPLE-name-Value"),
				ObjectVersion: common.Int(36)},
			CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value")},
		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(274)},
		ApplicationCompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-applicationCompartmentId-Value")},
		OpcRequestId:  common.String("EBEDZMOLSNKCYOG5CSZI<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)
}