// 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{WorkspaceId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-workspaceId-Value"),
		CreateExternalPublicationDetails: dataintegration.CreateExternalPublicationDetails{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.ConnectionFromMySql{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_dbzUP": "EXAMPLE_VALUE_TeSrc6xwLesZafBPeail"},
					Name:          common.String("EXAMPLE-name-Value"),
					ObjectVersion: common.Int(432),
					ObjectStatus:  common.Int(112),
					ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
						Parent: common.String("EXAMPLE-parent-Value")},
					Username:   common.String("EXAMPLE-username-Value"),
					Identifier: common.String("EXAMPLE-identifier-Value"),
					Metadata: &dataintegration.ObjectMetadata{CreatedBy: common.String("EXAMPLE-createdBy-Value"),
						CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						IsFavorite:     common.Bool(false),
						TimeUpdated:    &common.SDKTime{Time: time.Now()},
						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{ObjectCount: common.Int64(204),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeFolder}}},
						InfoFields:      map[string]string{"EXAMPLE_KEY_Nlya8": "EXAMPLE_VALUE_8iMOd0BtP4EvRwcUqLod"},
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(810),
						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")}},
					ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					Description:  common.String("EXAMPLE-description-Value"),
					IsDefault:    common.Bool(true),
					PrimarySchema: &dataintegration.Schema{ObjectStatus: common.Int(4),
						ObjectVersion:   common.Int(146),
						Description:     common.String("EXAMPLE-description-Value"),
						IsHasContainers: common.Bool(false),
						Metadata: &dataintegration.ObjectMetadata{TimeUpdated: &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")},
							AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(689),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset}}},
							CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
							IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
							IsFavorite:      common.Bool(false),
							Labels:          []string{"EXAMPLE--Value"},
							RegistryVersion: common.Int(723),
							CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
							InfoFields:      map[string]string{"EXAMPLE_KEY_YuA4l": "EXAMPLE_VALUE_s1cDqDeRA6vBOBaw2nN2"},
							TimeCreated:     &common.SDKTime{Time: time.Now()}},
						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"),
						ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
						Identifier:        common.String("EXAMPLE-identifier-Value"),
						Key:               common.String("EXAMPLE-key-Value"),
						ModelVersion:      common.String("EXAMPLE-modelVersion-Value")}},
				DataAsset: dataintegration.DataAssetFromOracleSiebelDetails{ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
					RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					Port:        common.String("EXAMPLE-port-Value"),
					ServiceName: common.String("EXAMPLE-serviceName-Value"),
					WalletSecret: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
						Value: common.String("EXAMPLE-value-Value")},
					Description:     common.String("EXAMPLE-description-Value"),
					KeyMap:          map[string]string{"EXAMPLE_KEY_OKMtl": "EXAMPLE_VALUE_ruZfHPxkevYGLmKbzb1M"},
					Name:            common.String("EXAMPLE-name-Value"),
					ObjectStatus:    common.Int(833),
					AssetProperties: map[string]string{"EXAMPLE_KEY_jKl1A": "EXAMPLE_VALUE_fqSsZrGNt7eyf0m4xb8C"},
					DriverClass:     common.String("EXAMPLE-driverClass-Value"),
					Identifier:      common.String("EXAMPLE-identifier-Value"),
					NativeTypeSystem: &dataintegration.TypeSystem{TypeMappingFrom: map[string]string{"EXAMPLE_KEY_askNv": "EXAMPLE_VALUE_xMVNHkGggEBNDWz2ucsp"},
						TypeMappingTo: map[string]string{"EXAMPLE_KEY_tb93O": "EXAMPLE_VALUE_9bG8DXIWfDfIy3dUy7HP"},
						Types: []dataintegration.DataType{dataintegration.DataType{Description: common.String("EXAMPLE-description-Value"),
							DtType:       dataintegration.DataTypeDtTypePrimitive,
							ObjectStatus: common.Int(232),
							ConfigDefinition: &dataintegration.ConfigDefinition{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
								Name:         common.String("EXAMPLE-name-Value"),
								ObjectStatus: common.Int(483),
								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_rAWUH": dataintegration.ConfigParameterDefinition{ClassFieldName: common.String("EXAMPLE-classFieldName-Value"),
									DefaultValue:      &defaultValue,
									Description:       common.String("EXAMPLE-description-Value"),
									IsClassFieldValue: common.Bool(false),
									IsStatic:          common.Bool(true),
									ParameterName:     common.String("EXAMPLE-parameterName-Value"),
									ParameterType: dataintegration.MaterializedCompositeType{Key: common.String("EXAMPLE-key-Value"),
										Name:         common.String("EXAMPLE-name-Value"),
										ObjectStatus: common.Int(769),
										PathNames:    []string{"EXAMPLE--Value"},
										Description:  common.String("EXAMPLE-description-Value"),
										Elements:     []string{"EXAMPLE--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")}}}},
								IsContained: common.Bool(true),
								Key:         common.String("EXAMPLE-key-Value")},
							Key:          common.String("EXAMPLE-key-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")},
							TypeSystemName: common.String("EXAMPLE-typeSystemName-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"),
						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"),
						ObjectStatus:  common.Int(624),
						ObjectVersion: common.Int(131)},
					ObjectVersion: common.Int(653),
					Key:           common.String("EXAMPLE-key-Value"),
					Metadata: &dataintegration.ObjectMetadata{CreatedBy: common.String("EXAMPLE-createdBy-Value"),
						CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_IEjPe": "EXAMPLE_VALUE_guyGNOvbu1g2WkCOOTSE"},
						RegistryVersion: common.Int(975),
						TimeCreated:     &common.SDKTime{Time: time.Now()},
						TimeUpdated:     &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(143),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeApplication}}},
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						IsFavorite:     common.Bool(true),
						Labels:         []string{"EXAMPLE--Value"},
						UpdatedBy:      common.String("EXAMPLE-updatedBy-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")}},
					ModelVersion: common.String("EXAMPLE-modelVersion-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")},
					DefaultConnection: &dataintegration.ConnectionFromOracleSiebelDetails{Username: common.String("EXAMPLE-username-Value"),
						ObjectStatus: common.Int(177),
						ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
							RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
						Password: common.String("EXAMPLE-password-Value"),
						PrimarySchema: &dataintegration.Schema{Identifier: common.String("EXAMPLE-identifier-Value"),
							ObjectVersion: common.Int(722),
							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"),
							IsHasContainers:   common.Bool(true),
							Key:               common.String("EXAMPLE-key-Value"),
							Metadata: &dataintegration.ObjectMetadata{TimeUpdated: &common.SDKTime{Time: time.Now()},
								AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
								CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(626),
									ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataFlow}}},
								InfoFields:    map[string]string{"EXAMPLE_KEY_wInvh": "EXAMPLE_VALUE_vvg7ywY69dTaU0duGSfV"},
								IsFavorite:    common.Bool(false),
								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")},
								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(359),
								TimeCreated:     &common.SDKTime{Time: time.Now()}},
							ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
							Name:         common.String("EXAMPLE-name-Value"),
							ObjectStatus: common.Int(828),
							ExternalKey:  common.String("EXAMPLE-externalKey-Value")},
						ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Value: common.String("EXAMPLE-value-Value"),
							Name: common.String("EXAMPLE-name-Value")}},
						IsDefault:    common.Bool(true),
						ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
						Name:         common.String("EXAMPLE-name-Value"),
						Key:          common.String("EXAMPLE-key-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")},
							AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
							CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
							InfoFields:      map[string]string{"EXAMPLE_KEY_ngbct": "EXAMPLE_VALUE_6TI4DkT6BnYHCC1cH9rB"},
							RegistryVersion: common.Int(164),
							UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(19),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset}}},
							CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
							IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
							IsFavorite:     common.Bool(false),
							Labels:         []string{"EXAMPLE--Value"},
							TimeCreated:    &common.SDKTime{Time: time.Now()},
							TimeUpdated:    &common.SDKTime{Time: time.Now()},
							UpdatedByName:  common.String("EXAMPLE-updatedByName-Value")},
						PasswordSecret: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
							Value: common.String("EXAMPLE-value-Value")},
						Description:   common.String("EXAMPLE-description-Value"),
						Identifier:    common.String("EXAMPLE-identifier-Value"),
						ObjectVersion: common.Int(751)},
					ExternalKey: common.String("EXAMPLE-externalKey-Value"),
					Host:        common.String("EXAMPLE-host-Value")},
				Schema: &dataintegration.Schema{Name: common.String("EXAMPLE-name-Value"),
					ObjectStatus:      common.Int(970),
					ObjectVersion:     common.Int(736),
					ResourceName:      common.String("EXAMPLE-resourceName-Value"),
					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(false),
					Metadata: &dataintegration.ObjectMetadata{InfoFields: map[string]string{"EXAMPLE_KEY_asHvv": "EXAMPLE_VALUE_9FrzeoplrUXcZznVxM6n"},
						IsFavorite:    common.Bool(true),
						UpdatedBy:     common.String("EXAMPLE-updatedBy-Value"),
						UpdatedByName: common.String("EXAMPLE-updatedByName-Value"),
						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(422),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeUserDefinedFunction}}},
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(19),
						TimeCreated:     &common.SDKTime{Time: time.Now()},
						TimeUpdated:     &common.SDKTime{Time: time.Now()},
						CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
						CreatedByName:   common.String("EXAMPLE-createdByName-Value")},
					ModelType: common.String("EXAMPLE-modelType-Value"),
					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"),
					ModelVersion: common.String("EXAMPLE-modelVersion-Value")}},
			Description: common.String("EXAMPLE-description-Value"),
			DisplayName: common.String("EXAMPLE-displayName-Value"),
			ResourceConfiguration: &dataintegration.ResourceConfiguration{ExecutorShape: common.String("EXAMPLE-executorShape-Value"),
				SparkVersion:   common.String("EXAMPLE-sparkVersion-Value"),
				TotalExecutors: common.Int(462),
				DriverShape:    common.String("EXAMPLE-driverShape-Value")},
			ApplicationCompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-applicationCompartmentId-Value")},
		OpcRequestId:  common.String("O7QQIKHOEZFMK98JK6FL<unique_ID>"),
		OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value"),
		TaskKey:       common.String("EXAMPLE-taskKey-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)
}