// 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{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.ConnectionFromOraclePeopleSoft{PasswordSecret: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
				Value: common.String("EXAMPLE-value-Value")},
				ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
				Name:         common.String("EXAMPLE-name-Value"),
				Password:     common.String("EXAMPLE-password-Value"),
				PrimarySchema: &dataintegration.Schema{Key: common.String("EXAMPLE-key-Value"),
					Metadata: &dataintegration.ObjectMetadata{CreatedByName: common.String("EXAMPLE-createdByName-Value"),
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_Z7vdo": "EXAMPLE_VALUE_Y78ekKD5GoZ9Vgh7yieu"},
						UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
						UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
						CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
						IsFavorite:      common.Bool(true),
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(740),
						TimeCreated:     &common.SDKTime{Time: time.Now()},
						TimeUpdated:     &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(479),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset}}}},
					ObjectStatus:  common.Int(389),
					ObjectVersion: common.Int(182),
					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"),
					Identifier:        common.String("EXAMPLE-identifier-Value"),
					IsHasContainers:   common.Bool(false),
					ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
					Name:              common.String("EXAMPLE-name-Value"),
					ResourceName:      common.String("EXAMPLE-resourceName-Value"),
					DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
					Description:       common.String("EXAMPLE-description-Value")},
				ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
					Value: common.String("EXAMPLE-value-Value")}},
				Description:   common.String("EXAMPLE-description-Value"),
				Key:           common.String("EXAMPLE-key-Value"),
				ObjectStatus:  common.Int(45),
				ObjectVersion: common.Int(973),
				Username:      common.String("EXAMPLE-username-Value"),
				Identifier:    common.String("EXAMPLE-identifier-Value"),
				IsDefault:     common.Bool(true),
				KeyMap:        map[string]string{"EXAMPLE_KEY_SzE3q": "EXAMPLE_VALUE_An5VTuWjEGfzsjvNpVjH"},
				Metadata: &dataintegration.ObjectMetadata{CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(35),
					ObjectType: dataintegration.CountStatisticSummaryObjectTypeConnection}}},
					CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
					IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
					InfoFields:      map[string]string{"EXAMPLE_KEY_fMPT6": "EXAMPLE_VALUE_2mRF9XRKfNvS3PgR1ql9"},
					Labels:          []string{"EXAMPLE--Value"},
					RegistryVersion: common.Int(220),
					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"),
					CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
					IsFavorite:    common.Bool(false),
					TimeCreated:   &common.SDKTime{Time: time.Now()},
					TimeUpdated:   &common.SDKTime{Time: time.Now()},
					UpdatedBy:     common.String("EXAMPLE-updatedBy-Value"),
					UpdatedByName: common.String("EXAMPLE-updatedByName-Value")},
				ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
					RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")}},
			DataAsset: dataintegration.DataAssetFromOracleDetails{ExternalKey: common.String("EXAMPLE-externalKey-Value"),
				KeyMap:       map[string]string{"EXAMPLE_KEY_YOIiv": "EXAMPLE_VALUE_mjzvcrVhvNSNiavV47dC"},
				ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
				NativeTypeSystem: &dataintegration.TypeSystem{Description: common.String("EXAMPLE-description-Value"),
					Identifier:      common.String("EXAMPLE-identifier-Value"),
					Key:             common.String("EXAMPLE-key-Value"),
					ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
					Name:            common.String("EXAMPLE-name-Value"),
					ObjectVersion:   common.Int(454),
					TypeMappingFrom: map[string]string{"EXAMPLE_KEY_4bjDk": "EXAMPLE_VALUE_UfHMLw0kFHU4ZDJTBQCk"},
					ObjectStatus:    common.Int(535),
					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_Cks8A": "EXAMPLE_VALUE_YvNPXUa47lA5d9hmG6Vd"},
					Types: []dataintegration.DataType{dataintegration.DataType{Key: common.String("EXAMPLE-key-Value"),
						ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
						ObjectStatus: common.Int(206),
						ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
							Parent: common.String("EXAMPLE-parent-Value")},
						ConfigDefinition: &dataintegration.ConfigDefinition{Name: common.String("EXAMPLE-name-Value"),
							ObjectStatus: common.Int(530),
							ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
								Parent: common.String("EXAMPLE-parent-Value")},
							ConfigParameterDefinitions: map[string]dataintegration.ConfigParameterDefinition{"EXAMPLE_KEY_QIx8m": dataintegration.ConfigParameterDefinition{ParameterName: common.String("EXAMPLE-parameterName-Value"),
								ParameterType: dataintegration.JavaType{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
									Name:         common.String("EXAMPLE-name-Value"),
									ObjectStatus: common.Int(275),
									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"),
									JavaTypeName: common.String("EXAMPLE-javaTypeName-Value"),
									Key:          common.String("EXAMPLE-key-Value")},
								ClassFieldName:    common.String("EXAMPLE-classFieldName-Value"),
								DefaultValue:      &defaultValue,
								Description:       common.String("EXAMPLE-description-Value"),
								IsClassFieldValue: common.Bool(false),
								IsStatic:          common.Bool(true)}},
							IsContained:  common.Bool(true),
							Key:          common.String("EXAMPLE-key-Value"),
							ModelVersion: common.String("EXAMPLE-modelVersion-Value")},
						Description:    common.String("EXAMPLE-description-Value"),
						Name:           common.String("EXAMPLE-name-Value"),
						TypeSystemName: common.String("EXAMPLE-typeSystemName-Value"),
						DtType:         dataintegration.DataTypeDtTypePrimitive}}},
				ServiceName:           common.String("EXAMPLE-serviceName-Value"),
				CredentialFileContent: common.String("EXAMPLE-credentialFileContent-Value"),
				DefaultConnection: &dataintegration.ConnectionFromOracleDetails{Description: common.String("EXAMPLE-description-Value"),
					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")},
						AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(805),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset}}},
						CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
						IsFavorite:      common.Bool(false),
						TimeUpdated:     &common.SDKTime{Time: time.Now()},
						UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
						UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
						CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_0nYCz": "EXAMPLE_VALUE_qSf0SBqqojAXcI8bmXE0"},
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(658),
						TimeCreated:     &common.SDKTime{Time: time.Now()}},
					Name:          common.String("EXAMPLE-name-Value"),
					ObjectStatus:  common.Int(934),
					ObjectVersion: common.Int(60),
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					PasswordSecret: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
						Value: common.String("EXAMPLE-value-Value")},
					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"),
						IsHasContainers: common.Bool(true),
						Key:             common.String("EXAMPLE-key-Value"),
						ObjectStatus:    common.Int(232),
						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")},
							AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(502),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataFlow}}},
							CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
							IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
							InfoFields:      map[string]string{"EXAMPLE_KEY_BXIOK": "EXAMPLE_VALUE_sTz8dBisPEUo7DmnUjsv"},
							IsFavorite:      common.Bool(true),
							Labels:          []string{"EXAMPLE--Value"},
							CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
							RegistryVersion: common.Int(966),
							TimeCreated:     &common.SDKTime{Time: time.Now()},
							TimeUpdated:     &common.SDKTime{Time: time.Now()},
							UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
							UpdatedByName:   common.String("EXAMPLE-updatedByName-Value")},
						ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
						Name:          common.String("EXAMPLE-name-Value"),
						ObjectVersion: common.Int(195),
						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")},
					Username: common.String("EXAMPLE-username-Value"),
					ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
						Value: common.String("EXAMPLE-value-Value")}},
					IsDefault: common.Bool(false),
					Password:  common.String("EXAMPLE-password-Value")},
				Description:   common.String("EXAMPLE-description-Value"),
				Identifier:    common.String("EXAMPLE-identifier-Value"),
				ObjectStatus:  common.Int(969),
				ObjectVersion: common.Int(706),
				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_LxT4H": "EXAMPLE_VALUE_NP1RJ4VNaEmh5QrQ7pPr"},
				Host:            common.String("EXAMPLE-host-Value"),
				Metadata: &dataintegration.ObjectMetadata{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"},
					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")},
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(864),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeUserDefinedFunction}}},
					CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
					InfoFields:      map[string]string{"EXAMPLE_KEY_LiNez": "EXAMPLE_VALUE_TTmFm118GxyCPF4K8mZQ"},
					RegistryVersion: common.Int(819),
					TimeCreated:     &common.SDKTime{Time: time.Now()},
					TimeUpdated:     &common.SDKTime{Time: time.Now()},
					UpdatedBy:       common.String("EXAMPLE-updatedBy-Value")},
				Name:        common.String("EXAMPLE-name-Value"),
				Port:        common.String("EXAMPLE-port-Value"),
				DriverClass: common.String("EXAMPLE-driverClass-Value"),
				Key:         common.String("EXAMPLE-key-Value"),
				Sid:         common.String("EXAMPLE-sid-Value"),
				WalletPasswordSecret: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
					Value: common.String("EXAMPLE-value-Value")},
				WalletSecret: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
					Value: common.String("EXAMPLE-value-Value")}},
			Schema: &dataintegration.Schema{Key: common.String("EXAMPLE-key-Value"),
				Metadata: &dataintegration.ObjectMetadata{CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectType: dataintegration.CountStatisticSummaryObjectTypeProject,
					ObjectCount: common.Int64(60)}}},
					CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
					RegistryVersion: common.Int(921),
					UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
					CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
					IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
					InfoFields:      map[string]string{"EXAMPLE_KEY_Uuxk5": "EXAMPLE_VALUE_mKYsgI6lL9jycVEemHLa"},
					IsFavorite:      common.Bool(true),
					Labels:          []string{"EXAMPLE--Value"},
					TimeCreated:     &common.SDKTime{Time: time.Now()},
					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")},
					AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value")},
				ObjectVersion: common.Int(328),
				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"),
				Description:       common.String("EXAMPLE-description-Value"),
				ModelType:         common.String("EXAMPLE-modelType-Value"),
				ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
				Name:              common.String("EXAMPLE-name-Value"),
				ObjectStatus:      common.Int(662),
				ResourceName:      common.String("EXAMPLE-resourceName-Value"),
				ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
				Identifier:        common.String("EXAMPLE-identifier-Value"),
				IsHasContainers:   common.Bool(false)}},
		Description: common.String("EXAMPLE-description-Value"),
		DisplayName: common.String("EXAMPLE-displayName-Value"),
		ResourceConfiguration: &dataintegration.ResourceConfiguration{TotalExecutors: common.Int(954),
			DriverShape:   common.String("EXAMPLE-driverShape-Value"),
			ExecutorShape: common.String("EXAMPLE-executorShape-Value"),
			SparkVersion:  common.String("EXAMPLE-sparkVersion-Value")}},
		OpcRequestId:  common.String("VJ0DMLC3MY94MVFNJTQ7<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)
}