// 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{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(660)},
		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.ConnectionFromOracleSiebel{PrimarySchema: &dataintegration.Schema{IsHasContainers: common.Bool(true),
				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")},
					CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
					InfoFields:      map[string]string{"EXAMPLE_KEY_2KP33": "EXAMPLE_VALUE_OSDvXsDefbkMkJ3Sqm7b"},
					Labels:          []string{"EXAMPLE--Value"},
					RegistryVersion: common.Int(358),
					TimeCreated:     &common.SDKTime{Time: time.Now()},
					UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
					AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(746),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeFunctionLibrary}}},
					CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
					IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
					IsFavorite:     common.Bool(true),
					TimeUpdated:    &common.SDKTime{Time: time.Now()}},
				Name:          common.String("EXAMPLE-name-Value"),
				ObjectVersion: common.Int(485),
				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"),
				Identifier:        common.String("EXAMPLE-identifier-Value"),
				Key:               common.String("EXAMPLE-key-Value"),
				ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
				ObjectStatus:      common.Int(444),
				ResourceName:      common.String("EXAMPLE-resourceName-Value"),
				ExternalKey:       common.String("EXAMPLE-externalKey-Value")},
				ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
					Value: common.String("EXAMPLE-value-Value")}},
				Key:          common.String("EXAMPLE-key-Value"),
				KeyMap:       map[string]string{"EXAMPLE_KEY_9k9KT": "EXAMPLE_VALUE_itA1oBpeowZnwmh3iebr"},
				ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
				Name:         common.String("EXAMPLE-name-Value"),
				Username:     common.String("EXAMPLE-username-Value"),
				IsDefault:    common.Bool(false),
				Metadata: &dataintegration.ObjectMetadata{AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(289),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeFunctionLibrary}}},
					CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
					CreatedByName: common.String("EXAMPLE-createdByName-Value"),
					InfoFields:    map[string]string{"EXAMPLE_KEY_1UhMY": "EXAMPLE_VALUE_DEFMB7WRB2zS5jh3ThXm"},
					IsFavorite:    common.Bool(true),
					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")},
					IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
					Labels:          []string{"EXAMPLE--Value"},
					RegistryVersion: common.Int(811),
					TimeCreated:     &common.SDKTime{Time: time.Now()},
					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")},
				PasswordSecret: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
					Value: common.String("EXAMPLE-value-Value")},
				ObjectStatus:  common.Int(15),
				ObjectVersion: common.Int(177),
				Description:   common.String("EXAMPLE-description-Value"),
				Identifier:    common.String("EXAMPLE-identifier-Value"),
				Password:      common.String("EXAMPLE-password-Value")},
			DataAsset: dataintegration.DataAssetFromJdbc{DataAssetType: common.String("EXAMPLE-dataAssetType-Value"),
				DefaultConnection: &dataintegration.ConnectionFromJdbcDetails{ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
					Value: common.String("EXAMPLE-value-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")},
					PrimarySchema: &dataintegration.Schema{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"),
						IsHasContainers:   common.Bool(true),
						ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
						Name:              common.String("EXAMPLE-name-Value"),
						ObjectStatus:      common.Int(967),
						ObjectVersion:     common.Int(187),
						ResourceName:      common.String("EXAMPLE-resourceName-Value"),
						DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
						ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
						Identifier:        common.String("EXAMPLE-identifier-Value"),
						Key:               common.String("EXAMPLE-key-Value"),
						Metadata: &dataintegration.ObjectMetadata{CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(568),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeFunctionLibrary}}},
							CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
							CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
							UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
							IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
							InfoFields:      map[string]string{"EXAMPLE_KEY_siy8m": "EXAMPLE_VALUE_FQF1X6H2XoMSbR7rmruc"},
							IsFavorite:      common.Bool(true),
							Labels:          []string{"EXAMPLE--Value"},
							RegistryVersion: common.Int(19),
							TimeCreated:     &common.SDKTime{Time: time.Now()},
							TimeUpdated:     &common.SDKTime{Time: time.Now()},
							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")}},
					Username:   common.String("EXAMPLE-username-Value"),
					Identifier: common.String("EXAMPLE-identifier-Value"),
					IsDefault:  common.Bool(true),
					Key:        common.String("EXAMPLE-key-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")},
						CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						IsFavorite:     common.Bool(true),
						Labels:         []string{"EXAMPLE--Value"},
						TimeCreated:    &common.SDKTime{Time: time.Now()},
						TimeUpdated:    &common.SDKTime{Time: time.Now()},
						UpdatedBy:      common.String("EXAMPLE-updatedBy-Value"),
						AggregatorKey:  common.String("EXAMPLE-aggregatorKey-Value"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(584),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeApplication}}},
						CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_s9nfA": "EXAMPLE_VALUE_fH1SUil2x2JAAYoCKFki"},
						RegistryVersion: common.Int(807)},
					ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
					Name:          common.String("EXAMPLE-name-Value"),
					ObjectStatus:  common.Int(668),
					ObjectVersion: common.Int(824)},
				Key:          common.String("EXAMPLE-key-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")},
				Description:     common.String("EXAMPLE-description-Value"),
				ExternalKey:     common.String("EXAMPLE-externalKey-Value"),
				Identifier:      common.String("EXAMPLE-identifier-Value"),
				ObjectStatus:    common.Int(49),
				AssetProperties: map[string]string{"EXAMPLE_KEY_PY9zc": "EXAMPLE_VALUE_iMqRDUERK0BzfUyZRATc"},
				Host:            common.String("EXAMPLE-host-Value"),
				NativeTypeSystem: &dataintegration.TypeSystem{Identifier: common.String("EXAMPLE-identifier-Value"),
					Key:  common.String("EXAMPLE-key-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")},
					TypeMappingTo:   map[string]string{"EXAMPLE_KEY_5DqsP": "EXAMPLE_VALUE_jFyB9QEST3IOei5gybe2"},
					ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
					ObjectStatus:    common.Int(871),
					ObjectVersion:   common.Int(876),
					TypeMappingFrom: map[string]string{"EXAMPLE_KEY_dbBlj": "EXAMPLE_VALUE_q3EImGNrWiWBSAUVd5tT"},
					Types: []dataintegration.DataType{dataintegration.DataType{ObjectStatus: common.Int(39),
						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"),
						DtType:         dataintegration.DataTypeDtTypeStructured,
						Key:            common.String("EXAMPLE-key-Value"),
						Name:           common.String("EXAMPLE-name-Value"),
						TypeSystemName: common.String("EXAMPLE-typeSystemName-Value"),
						ConfigDefinition: &dataintegration.ConfigDefinition{Key: common.String("EXAMPLE-key-Value"),
							ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
							Name:         common.String("EXAMPLE-name-Value"),
							ObjectStatus: common.Int(378),
							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_ZU2XY": dataintegration.ConfigParameterDefinition{IsClassFieldValue: common.Bool(true),
								IsStatic:       common.Bool(true),
								ParameterName:  common.String("EXAMPLE-parameterName-Value"),
								ClassFieldName: common.String("EXAMPLE-classFieldName-Value"),
								DefaultValue:   &defaultValue,
								Description:    common.String("EXAMPLE-description-Value")}},
							IsContained: common.Bool(false)},
						ModelVersion: common.String("EXAMPLE-modelVersion-Value")}},
					Description: common.String("EXAMPLE-description-Value")},
				ObjectVersion: common.Int(536),
				Port:          common.String("EXAMPLE-port-Value"),
				KeyMap:        map[string]string{"EXAMPLE_KEY_qkLyi": "EXAMPLE_VALUE_dAIXuSBAKToERb1kgyuc"},
				Metadata: &dataintegration.ObjectMetadata{TimeUpdated: &common.SDKTime{Time: time.Now()},
					AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
					CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
					RegistryVersion: common.Int(419),
					TimeCreated:     &common.SDKTime{Time: time.Now()},
					UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
					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")},
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(652),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeApplication}}},
					CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
					IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
					InfoFields:     map[string]string{"EXAMPLE_KEY_smbh7": "EXAMPLE_VALUE_4VN8Bz4MelyeIcvdQww7"},
					IsFavorite:     common.Bool(false),
					Labels:         []string{"EXAMPLE--Value"}},
				Name: common.String("EXAMPLE-name-Value")},
			Schema: &dataintegration.Schema{ObjectVersion: common.Int(129),
				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"),
				ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
				IsHasContainers:   common.Bool(true),
				Key:               common.String("EXAMPLE-key-Value"),
				ModelType:         common.String("EXAMPLE-modelType-Value"),
				Name:              common.String("EXAMPLE-name-Value"),
				ResourceName:      common.String("EXAMPLE-resourceName-Value"),
				DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
				Identifier:        common.String("EXAMPLE-identifier-Value"),
				Metadata: &dataintegration.ObjectMetadata{UpdatedByName: common.String("EXAMPLE-updatedByName-Value"),
					CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
					InfoFields:      map[string]string{"EXAMPLE_KEY_hrxn4": "EXAMPLE_VALUE_HEO6Ui1ipJ3FVphB38Ro"},
					IsFavorite:      common.Bool(false),
					Labels:          []string{"EXAMPLE--Value"},
					RegistryVersion: common.Int(334),
					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")},
					AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(771),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeConnection}}},
					CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
					IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
					TimeCreated:    &common.SDKTime{Time: time.Now()},
					TimeUpdated:    &common.SDKTime{Time: time.Now()}},
				ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
				ObjectStatus: common.Int(212)}},
		Description: common.String("EXAMPLE-description-Value")},
		OpcRequestId:  common.String("2MIQERDMFQ78KDQS6DR6<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)
}