// 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{ResourceConfiguration: &dataintegration.ResourceConfiguration{DriverShape: common.String("EXAMPLE-driverShape-Value"),
		ExecutorShape:  common.String("EXAMPLE-executorShape-Value"),
		SparkVersion:   common.String("EXAMPLE-sparkVersion-Value"),
		TotalExecutors: common.Int(80)},
		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{Key: common.String("EXAMPLE-key-Value"),
				KeyMap:        map[string]string{"EXAMPLE_KEY_kNgu3": "EXAMPLE_VALUE_lhpjRyyEloS5CwPgSjzB"},
				Name:          common.String("EXAMPLE-name-Value"),
				ObjectVersion: common.Int(38),
				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{Name: common.String("EXAMPLE-name-Value"),
					Value: common.String("EXAMPLE-value-Value")}},
				ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
				Description:  common.String("EXAMPLE-description-Value"),
				ObjectStatus: common.Int(257),
				PrimarySchema: &dataintegration.Schema{DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
					ExternalKey:     common.String("EXAMPLE-externalKey-Value"),
					IsHasContainers: common.Bool(true),
					Key:             common.String("EXAMPLE-key-Value"),
					Metadata: &dataintegration.ObjectMetadata{RegistryVersion: common.Int(951),
						TimeCreated: &common.SDKTime{Time: time.Now()},
						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")},
						CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
						CreatedByName: common.String("EXAMPLE-createdByName-Value"),
						IsFavorite:    common.Bool(true),
						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{ObjectType: dataintegration.CountStatisticSummaryObjectTypeFolder,
							ObjectCount: common.Int64(222)}}},
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						InfoFields:     map[string]string{"EXAMPLE_KEY_K0bAV": "EXAMPLE_VALUE_uo0kDtcWHUdJ1HtP2zbX"},
						Labels:         []string{"EXAMPLE--Value"}},
					Name:          common.String("EXAMPLE-name-Value"),
					ObjectVersion: common.Int(771),
					ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
						Parent: common.String("EXAMPLE-parent-Value")},
					Description:  common.String("EXAMPLE-description-Value"),
					Identifier:   common.String("EXAMPLE-identifier-Value"),
					ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					ObjectStatus: common.Int(432),
					ResourceName: common.String("EXAMPLE-resourceName-Value")},
				Identifier: common.String("EXAMPLE-identifier-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")},
					AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(164),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeProject}}},
					CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
					IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
					IsFavorite:      common.Bool(true),
					RegistryVersion: common.Int(513),
					TimeUpdated:     &common.SDKTime{Time: time.Now()},
					CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
					InfoFields:      map[string]string{"EXAMPLE_KEY_GnMnq": "EXAMPLE_VALUE_KQXV294Iqj2TxRABRRTb"},
					Labels:          []string{"EXAMPLE--Value"},
					TimeCreated:     &common.SDKTime{Time: time.Now()}},
				PasswordSecret: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
					Value: common.String("EXAMPLE-value-Value")},
				Username:   common.String("EXAMPLE-username-Value"),
				AuthHeader: common.String("EXAMPLE-authHeader-Value"),
				IsDefault:  common.Bool(false)},
			DataAsset: dataintegration.DataAssetFromRestDetails{ObjectStatus: common.Int(377),
				AssetProperties: map[string]string{"EXAMPLE_KEY_dF1bY": "EXAMPLE_VALUE_h59QxptEGDLGPDE0fxzC"},
				Metadata: &dataintegration.ObjectMetadata{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")},
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(368),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeUserDefinedFunction}}},
					CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
					IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
					IsFavorite:      common.Bool(true),
					TimeCreated:     &common.SDKTime{Time: time.Now()},
					TimeUpdated:     &common.SDKTime{Time: time.Now()},
					UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
					AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
					CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
					InfoFields:      map[string]string{"EXAMPLE_KEY_YLIn1": "EXAMPLE_VALUE_C7Z5kSXqf1I2cOWYz44v"},
					Labels:          []string{"EXAMPLE--Value"},
					RegistryVersion: common.Int(235),
					UpdatedByName:   common.String("EXAMPLE-updatedByName-Value")},
				ObjectVersion: common.Int(506),
				NativeTypeSystem: &dataintegration.TypeSystem{Key: common.String("EXAMPLE-key-Value"),
					ObjectStatus: common.Int(50),
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					TypeMappingTo:   map[string]string{"EXAMPLE_KEY_EgvnD": "EXAMPLE_VALUE_iLlnZYjvKAsgz2K8NktF"},
					Description:     common.String("EXAMPLE-description-Value"),
					ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
					Name:            common.String("EXAMPLE-name-Value"),
					ObjectVersion:   common.Int(267),
					TypeMappingFrom: map[string]string{"EXAMPLE_KEY_UCWrD": "EXAMPLE_VALUE_fK3aQZOkaJDuvbVDLdUa"},
					Types: []dataintegration.DataType{dataintegration.DataType{ConfigDefinition: &dataintegration.ConfigDefinition{ConfigParameterDefinitions: map[string]dataintegration.ConfigParameterDefinition{"EXAMPLE_KEY_HT6wB": dataintegration.ConfigParameterDefinition{ParameterType: dataintegration.MaterializedCompositeType{Description: common.String("EXAMPLE-description-Value"),
						Elements:     []string{"EXAMPLE--Value"},
						Name:         common.String("EXAMPLE-name-Value"),
						PathNames:    []string{"EXAMPLE--Value"},
						Key:          common.String("EXAMPLE-key-Value"),
						ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
						ObjectStatus: common.Int(788),
						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(true),
						IsStatic:          common.Bool(true),
						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"),
						ObjectStatus: common.Int(115),
						ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
							Parent: common.String("EXAMPLE-parent-Value")}},
						Description:  common.String("EXAMPLE-description-Value"),
						Key:          common.String("EXAMPLE-key-Value"),
						Name:         common.String("EXAMPLE-name-Value"),
						ObjectStatus: common.Int(785),
						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"),
						DtType:         dataintegration.DataTypeDtTypePrimitive,
						ModelVersion:   common.String("EXAMPLE-modelVersion-Value")}},
					Identifier: common.String("EXAMPLE-identifier-Value")},
				BaseUrl: common.String("EXAMPLE-baseUrl-Value"),
				DefaultConnection: dataintegration.ConnectionFromRestNoAuthDetails{ObjectStatus: common.Int(397),
					ObjectVersion: common.Int(644),
					PrimarySchema: &dataintegration.Schema{DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
						Description: common.String("EXAMPLE-description-Value"),
						ExternalKey: common.String("EXAMPLE-externalKey-Value"),
						Identifier:  common.String("EXAMPLE-identifier-Value"),
						Key:         common.String("EXAMPLE-key-Value"),
						Metadata: &dataintegration.ObjectMetadata{TimeCreated: &common.SDKTime{Time: time.Now()},
							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")},
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectType: dataintegration.CountStatisticSummaryObjectTypeUserDefinedFunction,
								ObjectCount: common.Int64(118)}}},
							IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
							Labels:          []string{"EXAMPLE--Value"},
							RegistryVersion: common.Int(838),
							UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
							AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
							CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
							CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
							InfoFields:      map[string]string{"EXAMPLE_KEY_k6okq": "EXAMPLE_VALUE_zatpxvgX1yx96IuMBmeP"},
							IsFavorite:      common.Bool(false)},
						ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
						Name:            common.String("EXAMPLE-name-Value"),
						IsHasContainers: common.Bool(true),
						ObjectStatus:    common.Int(581),
						ObjectVersion:   common.Int(911),
						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")},
					Identifier: common.String("EXAMPLE-identifier-Value"),
					Metadata: &dataintegration.ObjectMetadata{AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(665),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeTask}}},
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_VqHqo": "EXAMPLE_VALUE_tUdtYH0vlWFWYLYAIPfx"},
						IsFavorite:      common.Bool(false),
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(882),
						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")},
						CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
						CreatedByName: common.String("EXAMPLE-createdByName-Value"),
						TimeUpdated:   &common.SDKTime{Time: time.Now()},
						UpdatedBy:     common.String("EXAMPLE-updatedBy-Value"),
						UpdatedByName: common.String("EXAMPLE-updatedByName-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")},
					ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
						Value: common.String("EXAMPLE-value-Value")}},
					Description:  common.String("EXAMPLE-description-Value"),
					IsDefault:    common.Bool(false),
					Key:          common.String("EXAMPLE-key-Value"),
					ModelVersion: common.String("EXAMPLE-modelVersion-Value")},
				ExternalKey:         common.String("EXAMPLE-externalKey-Value"),
				Key:                 common.String("EXAMPLE-key-Value"),
				KeyMap:              map[string]string{"EXAMPLE_KEY_5MuOJ": "EXAMPLE_VALUE_tN7hgKwCjSNtxFZgbPNA"},
				Name:                common.String("EXAMPLE-name-Value"),
				Identifier:          common.String("EXAMPLE-identifier-Value"),
				ManifestFileContent: common.String("EXAMPLE-manifestFileContent-Value"),
				ModelVersion:        common.String("EXAMPLE-modelVersion-Value"),
				ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
					Parent: common.String("EXAMPLE-parent-Value")},
				Description: common.String("EXAMPLE-description-Value")},
			Schema: &dataintegration.Schema{Identifier: common.String("EXAMPLE-identifier-Value"),
				Key: common.String("EXAMPLE-key-Value"),
				Metadata: &dataintegration.ObjectMetadata{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")},
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(683),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeUserDefinedFunction}}},
					CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
					IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
					IsFavorite:      common.Bool(true),
					RegistryVersion: common.Int(247),
					UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
					UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
					AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
					CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
					InfoFields:      map[string]string{"EXAMPLE_KEY_P54gQ": "EXAMPLE_VALUE_Wgvfwi8HSE3wb5MVcX8e"},
					Labels:          []string{"EXAMPLE--Value"},
					TimeCreated:     &common.SDKTime{Time: time.Now()},
					TimeUpdated:     &common.SDKTime{Time: time.Now()}},
				ModelType:    common.String("EXAMPLE-modelType-Value"),
				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")},
				ResourceName:      common.String("EXAMPLE-resourceName-Value"),
				DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
				Description:       common.String("EXAMPLE-description-Value"),
				ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
				IsHasContainers:   common.Bool(false),
				ObjectStatus:      common.Int(237),
				ObjectVersion:     common.Int(22)}},
		Description: common.String("EXAMPLE-description-Value"),
		DisplayName: common.String("EXAMPLE-displayName-Value")},
		OpcRequestId:  common.String("5WMXGT6LRVXKVXQKSKI8<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)
}