// 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{OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value"),
		TaskKey:     common.String("EXAMPLE-taskKey-Value"),
		WorkspaceId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-workspaceId-Value"),
		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{DataAsset: dataintegration.DataAssetFromFusionApp{Description: common.String("EXAMPLE-description-Value"),
				ExternalKey: common.String("EXAMPLE-externalKey-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")},
				ServiceUrl:   common.String("EXAMPLE-serviceUrl-Value"),
				ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
				NativeTypeSystem: &dataintegration.TypeSystem{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(182),
					ObjectVersion: common.Int(924),
					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"),
					TypeMappingFrom: map[string]string{"EXAMPLE_KEY_lHAB1": "EXAMPLE_VALUE_7hUIIyQrIlBje4wlKn4p"},
					TypeMappingTo:   map[string]string{"EXAMPLE_KEY_WC4gy": "EXAMPLE_VALUE_63iX8H16lYeOUjpXpqxU"},
					Types: []dataintegration.DataType{dataintegration.DataType{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(755),
						ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
							RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
						ConfigDefinition: &dataintegration.ConfigDefinition{ObjectStatus: common.Int(914),
							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_ip7rz": dataintegration.ConfigParameterDefinition{ParameterName: common.String("EXAMPLE-parameterName-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(false),
							Key:          common.String("EXAMPLE-key-Value"),
							ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
							Name:         common.String("EXAMPLE-name-Value")},
						DtType:         dataintegration.DataTypeDtTypePrimitive,
						TypeSystemName: common.String("EXAMPLE-typeSystemName-Value")}}},
				ObjectVersion:   common.Int(963),
				AssetProperties: map[string]string{"EXAMPLE_KEY_2v0Of": "EXAMPLE_VALUE_3T4ji9OWaKzygy8Smk5X"},
				KeyMap:          map[string]string{"EXAMPLE_KEY_yarzj": "EXAMPLE_VALUE_ZT4fV55gC5fh2LLnP8xZ"},
				ObjectStatus:    common.Int(62),
				DefaultConnection: dataintegration.ConnectionFromLakeDetails{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					ObjectStatus:  common.Int(59),
					ObjectVersion: common.Int(372),
					PrimarySchema: &dataintegration.Schema{Description: common.String("EXAMPLE-description-Value"),
						ExternalKey:     common.String("EXAMPLE-externalKey-Value"),
						IsHasContainers: common.Bool(true),
						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")},
						Identifier: common.String("EXAMPLE-identifier-Value"),
						Metadata: &dataintegration.ObjectMetadata{IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
							RegistryVersion: common.Int(400),
							TimeCreated:     &common.SDKTime{Time: time.Now()},
							TimeUpdated:     &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")},
							AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(959),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeTask}}},
							CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
							CreatedByName: common.String("EXAMPLE-createdByName-Value"),
							InfoFields:    map[string]string{"EXAMPLE_KEY_82SZ6": "EXAMPLE_VALUE_i0sIBj7oBZD0pAPd1SJG"},
							IsFavorite:    common.Bool(false),
							Labels:        []string{"EXAMPLE--Value"}},
						ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
						ObjectStatus:      common.Int(630),
						ObjectVersion:     common.Int(974),
						ResourceName:      common.String("EXAMPLE-resourceName-Value"),
						DefaultConnection: common.String("EXAMPLE-defaultConnection-Value")},
					ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
						Value: common.String("EXAMPLE-value-Value")}},
					Description: common.String("EXAMPLE-description-Value"),
					Identifier:  common.String("EXAMPLE-identifier-Value"),
					IsDefault:   common.Bool(false),
					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")},
					Metadata: &dataintegration.ObjectMetadata{AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
						CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
						CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_fBv4Z": "EXAMPLE_VALUE_5EIAS8yORKpFROJSG9Vj"},
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(640),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(81),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset}}},
						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"),
						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")}}},
				Identifier: common.String("EXAMPLE-identifier-Value"),
				Metadata: &dataintegration.ObjectMetadata{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"),
					CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
					InfoFields:      map[string]string{"EXAMPLE_KEY_mmjtD": "EXAMPLE_VALUE_6z32byvmKeNYUVEycWew"},
					IsFavorite:      common.Bool(true),
					Labels:          []string{"EXAMPLE--Value"},
					RegistryVersion: common.Int(825),
					TimeCreated:     &common.SDKTime{Time: time.Now()},
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(583),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeTask}}},
					CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
					IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
					TimeUpdated:    &common.SDKTime{Time: time.Now()},
					UpdatedBy:      common.String("EXAMPLE-updatedBy-Value")}},
				Schema: &dataintegration.Schema{ObjectStatus: common.Int(478),
					ObjectVersion:   common.Int(360),
					Identifier:      common.String("EXAMPLE-identifier-Value"),
					IsHasContainers: common.Bool(false),
					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")},
					ResourceName:      common.String("EXAMPLE-resourceName-Value"),
					DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
					Description:       common.String("EXAMPLE-description-Value"),
					ExternalKey:       common.String("EXAMPLE-externalKey-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"),
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						RegistryVersion: common.Int(426),
						UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
						UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(956),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeProject}}},
						CreatedBy:   common.String("EXAMPLE-createdBy-Value"),
						InfoFields:  map[string]string{"EXAMPLE_KEY_ZyNkW": "EXAMPLE_VALUE_sg68X3kCmKBvPU42EmUr"},
						IsFavorite:  common.Bool(true),
						Labels:      []string{"EXAMPLE--Value"},
						TimeCreated: &common.SDKTime{Time: time.Now()},
						TimeUpdated: &common.SDKTime{Time: time.Now()}},
					ModelType:    common.String("EXAMPLE-modelType-Value"),
					ModelVersion: common.String("EXAMPLE-modelVersion-Value")},
				CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
				Connection: dataintegration.ConnectionFromRestNoAuth{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					PrimarySchema: &dataintegration.Schema{ObjectStatus: common.Int(598),
						DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
						Identifier:        common.String("EXAMPLE-identifier-Value"),
						Name:              common.String("EXAMPLE-name-Value"),
						ObjectVersion:     common.Int(321),
						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"),
						IsHasContainers: common.Bool(false),
						Key:             common.String("EXAMPLE-key-Value"),
						Metadata: &dataintegration.ObjectMetadata{IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
							InfoFields:      map[string]string{"EXAMPLE_KEY_pANCl": "EXAMPLE_VALUE_wvr1dsPi5j3rRuryX74B"},
							IsFavorite:      common.Bool(true),
							Labels:          []string{"EXAMPLE--Value"},
							AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
							RegistryVersion: common.Int(638),
							TimeCreated:     &common.SDKTime{Time: time.Now()},
							TimeUpdated:     &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(189),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeTask}}},
							CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
							CreatedByName: common.String("EXAMPLE-createdByName-Value")},
						ModelVersion: common.String("EXAMPLE-modelVersion-Value")},
					Identifier:    common.String("EXAMPLE-identifier-Value"),
					IsDefault:     common.Bool(false),
					Key:           common.String("EXAMPLE-key-Value"),
					KeyMap:        map[string]string{"EXAMPLE_KEY_xmZUt": "EXAMPLE_VALUE_OOFJDOiyQkAyiQV6nF0Q"},
					Name:          common.String("EXAMPLE-name-Value"),
					ObjectStatus:  common.Int(87),
					ObjectVersion: common.Int(404),
					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")}},
					Description: common.String("EXAMPLE-description-Value"),
					Metadata: &dataintegration.ObjectMetadata{CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(463),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeTask}}},
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						IsFavorite:     common.Bool(true),
						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")},
						AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
						CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
						CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
						InfoFields:      map[string]string{"EXAMPLE_KEY_jqdPV": "EXAMPLE_VALUE_fJaBufLe18dzAgzktgCV"},
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(225),
						TimeUpdated:     &common.SDKTime{Time: time.Now()}}}},
			Description: common.String("EXAMPLE-description-Value"),
			DisplayName: common.String("EXAMPLE-displayName-Value"),
			ResourceConfiguration: &dataintegration.ResourceConfiguration{SparkVersion: common.String("EXAMPLE-sparkVersion-Value"),
				TotalExecutors: common.Int(947),
				DriverShape:    common.String("EXAMPLE-driverShape-Value"),
				ExecutorShape:  common.String("EXAMPLE-executorShape-Value")}},
		OpcRequestId: common.String("GVEUH04YUPYM9JJDWAB8<unique_ID>")}

	// 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)
}