// 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{Description: common.String("EXAMPLE-description-Value"),
			DisplayName: common.String("EXAMPLE-displayName-Value"),
			ResourceConfiguration: &dataintegration.ResourceConfiguration{TotalExecutors: common.Int(603),
				DriverShape:   common.String("EXAMPLE-driverShape-Value"),
				ExecutorShape: common.String("EXAMPLE-executorShape-Value"),
				SparkVersion:  common.String("EXAMPLE-sparkVersion-Value")},
			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.ConnectionFromMySql{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					PrimarySchema: &dataintegration.Schema{ObjectStatus: common.Int(204),
						ObjectVersion:     common.Int(149),
						DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
						Identifier:        common.String("EXAMPLE-identifier-Value"),
						IsHasContainers:   common.Bool(false),
						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")},
						ResourceName: common.String("EXAMPLE-resourceName-Value"),
						Description:  common.String("EXAMPLE-description-Value"),
						ExternalKey:  common.String("EXAMPLE-externalKey-Value"),
						Metadata: &dataintegration.ObjectMetadata{AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
							CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
							CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
							Labels:          []string{"EXAMPLE--Value"},
							RegistryVersion: common.Int(890),
							TimeCreated:     &common.SDKTime{Time: time.Now()},
							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")},
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(753),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeConnection}}},
							IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
							InfoFields:     map[string]string{"EXAMPLE_KEY_VHmS8": "EXAMPLE_VALUE_g5oE8oi4zJhMLhI45gJa"},
							IsFavorite:     common.Bool(false),
							TimeUpdated:    &common.SDKTime{Time: time.Now()}},
						ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
						Name:         common.String("EXAMPLE-name-Value")},
					Description:   common.String("EXAMPLE-description-Value"),
					IsDefault:     common.Bool(false),
					Key:           common.String("EXAMPLE-key-Value"),
					ObjectVersion: common.Int(441),
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					KeyMap: map[string]string{"EXAMPLE_KEY_CCsyf": "EXAMPLE_VALUE_07SsFDffd1CS8gcbwGJj"},
					Metadata: &dataintegration.ObjectMetadata{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(270),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeFunctionLibrary}}},
						CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_X6cdj": "EXAMPLE_VALUE_Tp9iZLw6uGss5fU2Nv3w"},
						Labels:          []string{"EXAMPLE--Value"},
						TimeCreated:     &common.SDKTime{Time: time.Now()},
						UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
						AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
						CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
						IsFavorite:      common.Bool(false),
						RegistryVersion: common.Int(352),
						TimeUpdated:     &common.SDKTime{Time: time.Now()},
						UpdatedByName:   common.String("EXAMPLE-updatedByName-Value")},
					Identifier:   common.String("EXAMPLE-identifier-Value"),
					Name:         common.String("EXAMPLE-name-Value"),
					ObjectStatus: common.Int(95),
					Username:     common.String("EXAMPLE-username-Value"),
					ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Value: common.String("EXAMPLE-value-Value"),
						Name: common.String("EXAMPLE-name-Value")}}},
				DataAsset: dataintegration.DataAssetFromFusionApp{ExternalKey: common.String("EXAMPLE-externalKey-Value"),
					Identifier: common.String("EXAMPLE-identifier-Value"),
					KeyMap:     map[string]string{"EXAMPLE_KEY_LBILF": "EXAMPLE_VALUE_wKTdshRn5pUBANciOzaH"},
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					ServiceUrl:      common.String("EXAMPLE-serviceUrl-Value"),
					AssetProperties: map[string]string{"EXAMPLE_KEY_SC84k": "EXAMPLE_VALUE_8FJ5uyhrOz1bmqzKDhXX"},
					DefaultConnection: dataintegration.ConnectionFromAmazonS3Details{AccessKey: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
						Value: common.String("EXAMPLE-value-Value")},
						Key: common.String("EXAMPLE-key-Value"),
						Metadata: &dataintegration.ObjectMetadata{AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
							CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
							InfoFields:      map[string]string{"EXAMPLE_KEY_n5IuC": "EXAMPLE_VALUE_W4XsKfXuxd7tHQnWF6hP"},
							RegistryVersion: common.Int(882),
							TimeCreated:     &common.SDKTime{Time: time.Now()},
							UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(797),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeConnection}}},
							CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
							IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
							IsFavorite:     common.Bool(true),
							Labels:         []string{"EXAMPLE--Value"},
							TimeUpdated:    &common.SDKTime{Time: time.Now()},
							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")}},
						ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
							RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
						PrimarySchema: &dataintegration.Schema{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
							Name:         common.String("EXAMPLE-name-Value"),
							ObjectStatus: common.Int(249),
							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(true),
							ObjectVersion:     common.Int(64),
							Identifier:        common.String("EXAMPLE-identifier-Value"),
							Key:               common.String("EXAMPLE-key-Value"),
							Metadata: &dataintegration.ObjectMetadata{Labels: []string{"EXAMPLE--Value"},
								TimeCreated: &common.SDKTime{Time: time.Now()},
								TimeUpdated: &common.SDKTime{Time: time.Now()},
								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"),
								CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
								IsFavorite:      common.Bool(true),
								RegistryVersion: common.Int(347),
								UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
								UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
								CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(613),
									ObjectType: dataintegration.CountStatisticSummaryObjectTypeFolder}}},
								IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
								InfoFields:     map[string]string{"EXAMPLE_KEY_Ol1SK": "EXAMPLE_VALUE_1nhdrbuKLxJoqWm0LveO"}}},
						Identifier:   common.String("EXAMPLE-identifier-Value"),
						IsDefault:    common.Bool(true),
						ObjectStatus: common.Int(144),
						SecretKey: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
							Value: common.String("EXAMPLE-value-Value")},
						ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
							Value: common.String("EXAMPLE-value-Value")}},
						Description:   common.String("EXAMPLE-description-Value"),
						ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
						Name:          common.String("EXAMPLE-name-Value"),
						ObjectVersion: common.Int(44)},
					Metadata: &dataintegration.ObjectMetadata{IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(735),
						UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
						AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(192),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset}}},
						CreatedByName: common.String("EXAMPLE-createdByName-Value"),
						InfoFields:    map[string]string{"EXAMPLE_KEY_WzB7m": "EXAMPLE_VALUE_XZOD1zEuthtdvSM04Kz4"},
						IsFavorite:    common.Bool(false),
						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")},
						CreatedBy: common.String("EXAMPLE-createdBy-Value")},
					ObjectVersion: common.Int(852),
					Key:           common.String("EXAMPLE-key-Value"),
					ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
					Description:   common.String("EXAMPLE-description-Value"),
					Name:          common.String("EXAMPLE-name-Value"),
					NativeTypeSystem: &dataintegration.TypeSystem{Identifier: common.String("EXAMPLE-identifier-Value"),
						ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
						ObjectStatus:  common.Int(690),
						ObjectVersion: common.Int(181),
						TypeMappingTo: map[string]string{"EXAMPLE_KEY_FDWRW": "EXAMPLE_VALUE_D7ywwVoSBSCrYnqBeO43"},
						Types: []dataintegration.DataType{dataintegration.DataType{Description: common.String("EXAMPLE-description-Value"),
							Key:          common.String("EXAMPLE-key-Value"),
							Name:         common.String("EXAMPLE-name-Value"),
							ObjectStatus: common.Int(742),
							ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
								Parent: common.String("EXAMPLE-parent-Value")},
							TypeSystemName: common.String("EXAMPLE-typeSystemName-Value"),
							DtType:         dataintegration.DataTypeDtTypePrimitive,
							ModelVersion:   common.String("EXAMPLE-modelVersion-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_9XY02": dataintegration.ConfigParameterDefinition{IsClassFieldValue: common.Bool(false),
									IsStatic:      common.Bool(false),
									ParameterName: common.String("EXAMPLE-parameterName-Value"),
									ParameterType: dataintegration.DerivedType{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"),
										ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
										Name:         common.String("EXAMPLE-name-Value"),
										ObjectStatus: common.Int(131)},
									ClassFieldName: common.String("EXAMPLE-classFieldName-Value"),
									DefaultValue:   &defaultValue,
									Description:    common.String("EXAMPLE-description-Value")}},
								IsContained:  common.Bool(true),
								Key:          common.String("EXAMPLE-key-Value"),
								ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
								Name:         common.String("EXAMPLE-name-Value"),
								ObjectStatus: common.Int(254)}}},
						Description: common.String("EXAMPLE-description-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")},
						TypeMappingFrom: map[string]string{"EXAMPLE_KEY_DDmOg": "EXAMPLE_VALUE_5tAKOyJHLH2YBruOr4yN"}},
					ObjectStatus: common.Int(192)},
				Schema: &dataintegration.Schema{ResourceName: common.String("EXAMPLE-resourceName-Value"),
					Description:     common.String("EXAMPLE-description-Value"),
					ExternalKey:     common.String("EXAMPLE-externalKey-Value"),
					IsHasContainers: common.Bool(false),
					Key:             common.String("EXAMPLE-key-Value"),
					Metadata: &dataintegration.ObjectMetadata{AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
						CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_wtBun": "EXAMPLE_VALUE_oh7mtjCqQc3BZDjnT4Dg"},
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(589),
						TimeCreated:     &common.SDKTime{Time: time.Now()},
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(316),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataFlow}}},
						CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
						IsFavorite:    common.Bool(true),
						TimeUpdated:   &common.SDKTime{Time: time.Now()},
						UpdatedBy:     common.String("EXAMPLE-updatedBy-Value"),
						UpdatedByName: common.String("EXAMPLE-updatedByName-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")}},
					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")},
					DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
					Identifier:        common.String("EXAMPLE-identifier-Value"),
					ModelType:         common.String("EXAMPLE-modelType-Value"),
					ObjectStatus:      common.Int(11),
					ObjectVersion:     common.Int(759)}}},
		OpcRequestId:  common.String("ULTOFQZHEPQTW59RCFRQ<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)
}