// 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 refValue interface{}
	refValue = "EXAMPLE-refValue-Value"
	var rootObjectValue interface{}
	rootObjectValue = "EXAMPLE-rootObjectValue-Value"
	var objectValue interface{}
	objectValue = "EXAMPLE-objectValue-Value"
	var defaultValue interface{}
	defaultValue = "EXAMPLE-defaultValue-Value"
	req := dataintegration.CreateExternalPublicationRequest{CreateExternalPublicationDetails: dataintegration.CreateExternalPublicationDetails{ConfigurationDetails: &dataintegration.ConfigurationDetails{DataAsset: dataintegration.DataAssetFromAmazonS3{ObjectVersion: common.Int(876),
		ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
			RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
		Name:            common.String("EXAMPLE-name-Value"),
		ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
		ObjectStatus:    common.Int(960),
		Region:          common.String("EXAMPLE-region-Value"),
		Description:     common.String("EXAMPLE-description-Value"),
		ExternalKey:     common.String("EXAMPLE-externalKey-Value"),
		Identifier:      common.String("EXAMPLE-identifier-Value"),
		KeyMap:          map[string]string{"EXAMPLE_KEY_8NtE8": "EXAMPLE_VALUE_eQDN7uGbh53sHUcdn3eu"},
		AssetProperties: map[string]string{"EXAMPLE_KEY_u4S7L": "EXAMPLE_VALUE_SKL21nt68Di5NGxzXvDW"},
		DefaultConnection: &dataintegration.ConnectionSummaryFromAmazonS3{AccessKey: &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"),
			Key:          common.String("EXAMPLE-key-Value"),
			ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
			Metadata: &dataintegration.ObjectMetadata{AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
				CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(642),
					ObjectType: dataintegration.CountStatisticSummaryObjectTypeFunctionLibrary}}},
				RegistryVersion: common.Int(172),
				UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
				CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
				InfoFields:      map[string]string{"EXAMPLE_KEY_taUT8": "EXAMPLE_VALUE_zm8i9QH8ITz2hrLDwWn0"},
				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"),
				IsFavorite:     common.Bool(true),
				TimeUpdated:    &common.SDKTime{Time: time.Now()},
				CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
				Labels:         []string{"EXAMPLE--Value"},
				TimeCreated:    &common.SDKTime{Time: time.Now()}},
			ObjectStatus: common.Int(206),
			PrimarySchema: &dataintegration.Schema{Description: common.String("EXAMPLE-description-Value"),
				ExternalKey:   common.String("EXAMPLE-externalKey-Value"),
				Key:           common.String("EXAMPLE-key-Value"),
				ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
				Name:          common.String("EXAMPLE-name-Value"),
				ObjectVersion: common.Int(955),
				ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
					Parent: common.String("EXAMPLE-parent-Value")},
				ResourceName:      common.String("EXAMPLE-resourceName-Value"),
				IsHasContainers:   common.Bool(true),
				ObjectStatus:      common.Int(976),
				DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
				Identifier:        common.String("EXAMPLE-identifier-Value"),
				Metadata: &dataintegration.ObjectMetadata{CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(540),
					ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset}}},
					IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
					InfoFields:     map[string]string{"EXAMPLE_KEY_zfgGz": "EXAMPLE_VALUE_FoEpfWX28Nnxp7xIrUOk"},
					TimeCreated:    &common.SDKTime{Time: time.Now()},
					UpdatedBy:      common.String("EXAMPLE-updatedBy-Value"),
					UpdatedByName:  common.String("EXAMPLE-updatedByName-Value"),
					CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
					CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
					IsFavorite:     common.Bool(false),
					AggregatorKey:  common.String("EXAMPLE-aggregatorKey-Value"),
					Labels:         []string{"EXAMPLE--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")},
					RegistryVersion: common.Int(747),
					TimeUpdated:     &common.SDKTime{Time: time.Now()}}},
			Identifier:    common.String("EXAMPLE-identifier-Value"),
			ObjectVersion: common.Int(405),
			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")}},
			IsDefault: common.Bool(false),
			KeyMap:    map[string]string{"EXAMPLE_KEY_Let9p": "EXAMPLE_VALUE_Um2MPknXDzRtt44RXcji"},
			Name:      common.String("EXAMPLE-name-Value"),
			SecretKey: &dataintegration.SensitiveAttribute{Value: common.String("EXAMPLE-value-Value"),
				SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")}}},
		Key: common.String("EXAMPLE-key-Value"),
		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")},
			UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
			CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
			IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
			InfoFields:      map[string]string{"EXAMPLE_KEY_PHbVe": "EXAMPLE_VALUE_2jFOuy0qtHqHu3VMd3EO"},
			UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
			CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
			Labels:          []string{"EXAMPLE--Value"},
			RegistryVersion: common.Int(389),
			AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
			CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectType: dataintegration.CountStatisticSummaryObjectTypeFunctionLibrary,
				ObjectCount: common.Int64(644)}}},
			IsFavorite:  common.Bool(true),
			TimeCreated: &common.SDKTime{Time: time.Now()},
			TimeUpdated: &common.SDKTime{Time: time.Now()}},
		NativeTypeSystem: &dataintegration.TypeSystem{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
			ObjectStatus:  common.Int(945),
			TypeMappingTo: map[string]string{"EXAMPLE_KEY_Wt7aJ": "EXAMPLE_VALUE_0QIrXlj1OqCRoeBXKEnx"},
			Types: []dataintegration.DataType{dataintegration.DataType{Key: common.String("EXAMPLE-key-Value"),
				ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
				ObjectStatus: common.Int(721),
				DtType:       dataintegration.DataTypeDtTypeStructured,
				Description:  common.String("EXAMPLE-description-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"),
				ConfigDefinition: &dataintegration.ConfigDefinition{Key: common.String("EXAMPLE-key-Value"),
					ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					Name:         common.String("EXAMPLE-name-Value"),
					ObjectStatus: common.Int(348),
					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_yhoe4": dataintegration.ConfigParameterDefinition{ParameterName: common.String("EXAMPLE-parameterName-Value"),
						ParameterType: dataintegration.CompositeType{ObjectStatus: common.Int(81),
							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"),
							Elements: []dataintegration.TypedObject{dataintegration.DecisionOutputPort{ConfigValues: &dataintegration.ConfigValues{ConfigParamValues: map[string]dataintegration.ConfigParameterValue{"EXAMPLE_KEY_7oLc6": dataintegration.ConfigParameterValue{RefValue: &refValue,
								RootObjectValue: &rootObjectValue,
								StringValue:     common.String("EXAMPLE-stringValue-Value"),
								IntValue:        common.Int(454),
								ObjectValue:     &objectValue,
								ParameterValue:  common.String("EXAMPLE-parameterValue-Value")}},
								ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
									RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")}},
								Name:         common.String("EXAMPLE-name-Value"),
								PortType:     dataintegration.DecisionOutputPortPortTypeModel,
								ObjectStatus: common.Int(709),
								ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
									RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
								DecisionOutputPortType: dataintegration.DecisionOutputPortDecisionOutputPortTypeTrue,
								Description:            common.String("EXAMPLE-description-Value"),
								Key:                    common.String("EXAMPLE-key-Value"),
								ModelVersion:           common.String("EXAMPLE-modelVersion-Value")}},
							Key:          common.String("EXAMPLE-key-Value"),
							ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
							Name:         common.String("EXAMPLE-name-Value")},
						ClassFieldName:    common.String("EXAMPLE-classFieldName-Value"),
						DefaultValue:      &defaultValue,
						Description:       common.String("EXAMPLE-description-Value"),
						IsClassFieldValue: common.Bool(true),
						IsStatic:          common.Bool(true)}},
					IsContained: common.Bool(false)}}},
			Description:   common.String("EXAMPLE-description-Value"),
			Identifier:    common.String("EXAMPLE-identifier-Value"),
			Name:          common.String("EXAMPLE-name-Value"),
			ObjectVersion: common.Int(699),
			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_QTHPY": "EXAMPLE_VALUE_QZyGXoJWuHC6KiRyrI0T"},
			Key:             common.String("EXAMPLE-key-Value")}},
		Schema: &dataintegration.Schema{Description: common.String("EXAMPLE-description-Value"),
			IsHasContainers: common.Bool(false),
			Key:             common.String("EXAMPLE-key-Value"),
			ObjectVersion:   common.Int(479),
			ExternalKey:     common.String("EXAMPLE-externalKey-Value"),
			ObjectStatus:    common.Int(869),
			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"),
			Metadata: &dataintegration.ObjectMetadata{InfoFields: map[string]string{"EXAMPLE_KEY_bYhli": "EXAMPLE_VALUE_YETxDdNkrwxd9JcOhsTd"},
				IsFavorite: common.Bool(true),
				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(395),
					ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset}}},
				CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
				AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
				UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
				TimeUpdated:     &common.SDKTime{Time: time.Now()},
				CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
				IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
				RegistryVersion: common.Int(951),
				Labels:          []string{"EXAMPLE--Value"},
				TimeCreated:     &common.SDKTime{Time: time.Now()},
				UpdatedByName:   common.String("EXAMPLE-updatedByName-Value")},
			ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
			ModelType:    common.String("EXAMPLE-modelType-Value"),
			Name:         common.String("EXAMPLE-name-Value"),
			ResourceName: common.String("EXAMPLE-resourceName-Value")},
		CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
		Connection: dataintegration.ConnectionFromMySql{KeyMap: map[string]string{"EXAMPLE_KEY_Piu17": "EXAMPLE_VALUE_nSX4fFeCCIYVL7iw91Yu"},
			ObjectStatus: common.Int(803),
			ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
				RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
			PrimarySchema: &dataintegration.Schema{ObjectStatus: common.Int(465),
				DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
				ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
				Name:              common.String("EXAMPLE-name-Value"),
				IsHasContainers:   common.Bool(false),
				Metadata: &dataintegration.ObjectMetadata{UpdatedBy: common.String("EXAMPLE-updatedBy-Value"),
					AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectType: dataintegration.CountStatisticSummaryObjectTypeTask,
						ObjectCount: common.Int64(217)}}},
					CreatedBy:   common.String("EXAMPLE-createdBy-Value"),
					IsFavorite:  common.Bool(false),
					Labels:      []string{"EXAMPLE--Value"},
					TimeCreated: &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")},
					CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
					RegistryVersion: common.Int(894),
					TimeUpdated:     &common.SDKTime{Time: time.Now()},
					UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
					IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
					InfoFields:      map[string]string{"EXAMPLE_KEY_FBJMm": "EXAMPLE_VALUE_nIDpnUeYtowZ5sKtwEbi"}},
				ResourceName:  common.String("EXAMPLE-resourceName-Value"),
				Description:   common.String("EXAMPLE-description-Value"),
				Key:           common.String("EXAMPLE-key-Value"),
				ObjectVersion: common.Int(690),
				ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
					RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
				Identifier:   common.String("EXAMPLE-identifier-Value"),
				ModelVersion: common.String("EXAMPLE-modelVersion-Value")},
			IsDefault:    common.Bool(true),
			ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
			Username:     common.String("EXAMPLE-username-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"),
			Name:        common.String("EXAMPLE-name-Value"),
			Identifier:  common.String("EXAMPLE-identifier-Value"),
			Metadata: &dataintegration.ObjectMetadata{CreatedBy: common.String("EXAMPLE-createdBy-Value"),
				RegistryVersion: common.Int(153),
				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{ObjectType: dataintegration.CountStatisticSummaryObjectTypeUserDefinedFunction,
					ObjectCount: common.Int64(690)}}},
				AggregatorKey:  common.String("EXAMPLE-aggregatorKey-Value"),
				InfoFields:     map[string]string{"EXAMPLE_KEY_2OGAQ": "EXAMPLE_VALUE_TROO5CBtl95NawHek6NX"},
				TimeUpdated:    &common.SDKTime{Time: time.Now()},
				Labels:         []string{"EXAMPLE--Value"},
				TimeCreated:    &common.SDKTime{Time: time.Now()},
				UpdatedBy:      common.String("EXAMPLE-updatedBy-Value"),
				UpdatedByName:  common.String("EXAMPLE-updatedByName-Value"),
				CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
				IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
				IsFavorite:     common.Bool(true)},
			ObjectVersion: common.Int(182)}},
		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(314),
			DriverShape:    common.String("EXAMPLE-driverShape-Value")},
		ApplicationCompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-applicationCompartmentId-Value"),
		ApplicationId:            common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-applicationId-Value")},
		OpcRequestId:  common.String("Z8RX68GSTODYTFJ79OCC<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)
}