// 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{ResourceConfiguration: &dataintegration.ResourceConfiguration{ExecutorShape: common.String("EXAMPLE-executorShape-Value"),
		SparkVersion:   common.String("EXAMPLE-sparkVersion-Value"),
		TotalExecutors: common.Int(548),
		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"),
		ConfigurationDetails: &dataintegration.ConfigurationDetails{Schema: &dataintegration.Schema{Key: common.String("EXAMPLE-key-Value"),
			ObjectStatus: common.Int(899),
			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"),
			ExternalKey:  common.String("EXAMPLE-externalKey-Value"),
			Identifier:   common.String("EXAMPLE-identifier-Value"),
			Metadata: &dataintegration.ObjectMetadata{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")},
				CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(636),
					ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset}}},
				CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
				IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
				InfoFields:      map[string]string{"EXAMPLE_KEY_B7WRB": "EXAMPLE_VALUE_2zS5jh3ThXm9leeIG9k9"},
				TimeUpdated:     &common.SDKTime{Time: time.Now()},
				UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
				AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
				CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
				IsFavorite:      common.Bool(true),
				Labels:          []string{"EXAMPLE--Value"},
				RegistryVersion: common.Int(384),
				TimeCreated:     &common.SDKTime{Time: time.Now()}},
			ModelType:         common.String("EXAMPLE-modelType-Value"),
			ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
			Name:              common.String("EXAMPLE-name-Value"),
			ObjectVersion:     common.Int(473),
			DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
			Description:       common.String("EXAMPLE-description-Value"),
			IsHasContainers:   common.Bool(false)},
			CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
			Connection: dataintegration.ConnectionFromMySqlHeatWave{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")},
				CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
				IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
				IsFavorite:      common.Bool(false),
				Labels:          []string{"EXAMPLE--Value"},
				RegistryVersion: common.Int(336),
				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(281),
					ObjectType: dataintegration.CountStatisticSummaryObjectTypeApplication}}},
				CreatedBy:   common.String("EXAMPLE-createdBy-Value"),
				InfoFields:  map[string]string{"EXAMPLE_KEY_vYt3b": "EXAMPLE_VALUE_flb50yI5LVk2YT2KP33O"},
				TimeUpdated: &common.SDKTime{Time: time.Now()},
				UpdatedBy:   common.String("EXAMPLE-updatedBy-Value")},
				ObjectVersion: common.Int(267),
				PrimarySchema: &dataintegration.Schema{Description: common.String("EXAMPLE-description-Value"),
					ExternalKey:     common.String("EXAMPLE-externalKey-Value"),
					Identifier:      common.String("EXAMPLE-identifier-Value"),
					IsHasContainers: common.Bool(true),
					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_4zmd2": "EXAMPLE_VALUE_3JBTHtBus9nfAfH1SUil"},
						IsFavorite:     common.Bool(true),
						TimeUpdated:    &common.SDKTime{Time: time.Now()},
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectType: dataintegration.CountStatisticSummaryObjectTypeApplication,
							ObjectCount: common.Int64(744)}}},
						CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
						Labels:          []string{"EXAMPLE--Value"},
						RegistryVersion: common.Int(86),
						TimeCreated:     &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"),
					DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
					ObjectStatus:      common.Int(531),
					ObjectVersion:     common.Int(154),
					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")},
				ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
					Value: common.String("EXAMPLE-value-Value")}},
				Key:          common.String("EXAMPLE-key-Value"),
				Username:     common.String("EXAMPLE-username-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")},
				Password:     common.String("EXAMPLE-password-Value"),
				Description:  common.String("EXAMPLE-description-Value"),
				ObjectStatus: common.Int(850),
				PasswordSecret: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
					Value: common.String("EXAMPLE-value-Value")},
				Identifier: common.String("EXAMPLE-identifier-Value"),
				IsDefault:  common.Bool(true),
				KeyMap:     map[string]string{"EXAMPLE_KEY_efbkM": "EXAMPLE_VALUE_kJ3Sqm7bcqHaHAiTmcZ5"}},
			DataAsset: dataintegration.DataAssetFromOracleDetails{Identifier: common.String("EXAMPLE-identifier-Value"),
				NativeTypeSystem: &dataintegration.TypeSystem{Description: common.String("EXAMPLE-description-Value"),
					Key:           common.String("EXAMPLE-key-Value"),
					Name:          common.String("EXAMPLE-name-Value"),
					ObjectVersion: common.Int(236),
					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_3Rj33": "EXAMPLE_VALUE_VpdpEw2IKlHtcg2pjPqb"},
					Types: []dataintegration.DataType{dataintegration.DataType{DtType: dataintegration.DataTypeDtTypeStructured,
						ModelVersion:   common.String("EXAMPLE-modelVersion-Value"),
						TypeSystemName: common.String("EXAMPLE-typeSystemName-Value"),
						Description:    common.String("EXAMPLE-description-Value"),
						Key:            common.String("EXAMPLE-key-Value"),
						Name:           common.String("EXAMPLE-name-Value"),
						ObjectStatus:   common.Int(836),
						ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
							Parent: common.String("EXAMPLE-parent-Value")},
						ConfigDefinition: &dataintegration.ConfigDefinition{ConfigParameterDefinitions: map[string]dataintegration.ConfigParameterDefinition{"EXAMPLE_KEY_i5gyb": dataintegration.ConfigParameterDefinition{ClassFieldName: common.String("EXAMPLE-classFieldName-Value"),
							DefaultValue:      &defaultValue,
							Description:       common.String("EXAMPLE-description-Value"),
							IsClassFieldValue: common.Bool(true),
							IsStatic:          common.Bool(true),
							ParameterName:     common.String("EXAMPLE-parameterName-Value")}},
							IsContained:  common.Bool(false),
							Key:          common.String("EXAMPLE-key-Value"),
							ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
							Name:         common.String("EXAMPLE-name-Value"),
							ObjectStatus: common.Int(556),
							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"),
					ObjectStatus:    common.Int(814),
					TypeMappingFrom: map[string]string{"EXAMPLE_KEY_pIo6O": "EXAMPLE_VALUE_xZl8slnPY9zciMqRDUER"}},
				Name:         common.String("EXAMPLE-name-Value"),
				Description:  common.String("EXAMPLE-description-Value"),
				DriverClass:  common.String("EXAMPLE-driverClass-Value"),
				ExternalKey:  common.String("EXAMPLE-externalKey-Value"),
				Host:         common.String("EXAMPLE-host-Value"),
				Key:          common.String("EXAMPLE-key-Value"),
				ObjectStatus: common.Int(283),
				ServiceName:  common.String("EXAMPLE-serviceName-Value"),
				Metadata: &dataintegration.ObjectMetadata{IsFavorite: common.Bool(false),
					UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
					InfoFields:      map[string]string{"EXAMPLE_KEY_EImGN": "EXAMPLE_VALUE_rWiWBSAUVd5tT1HhFVQw"},
					Labels:          []string{"EXAMPLE--Value"},
					RegistryVersion: common.Int(262),
					TimeCreated:     &common.SDKTime{Time: time.Now()},
					TimeUpdated:     &common.SDKTime{Time: time.Now()},
					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"),
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(585),
						ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataFlow}}},
					CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
					CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
					IdentifierPath: common.String("EXAMPLE-identifierPath-Value")},
				Port: common.String("EXAMPLE-port-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")},
				CredentialFileContent: common.String("EXAMPLE-credentialFileContent-Value"),
				KeyMap:                map[string]string{"EXAMPLE_KEY_zzOlW": "EXAMPLE_VALUE_VQRGMki9PmJKUZU2XYqR"},
				ModelVersion:          common.String("EXAMPLE-modelVersion-Value"),
				ObjectVersion:         common.Int(374),
				ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
					RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
				WalletSecret: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
					Value: common.String("EXAMPLE-value-Value")},
				AssetProperties: map[string]string{"EXAMPLE_KEY_r7BYX": "EXAMPLE_VALUE_mcZxFiT0zBPpRvjkHTXw"},
				DefaultConnection: &dataintegration.ConnectionFromOracleDetails{ObjectStatus: common.Int(180),
					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"),
					ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					Name:         common.String("EXAMPLE-name-Value"),
					PrimarySchema: &dataintegration.Schema{DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
						Description:     common.String("EXAMPLE-description-Value"),
						ExternalKey:     common.String("EXAMPLE-externalKey-Value"),
						IsHasContainers: common.Bool(false),
						Metadata: &dataintegration.ObjectMetadata{IsFavorite: common.Bool(true),
							Labels:          []string{"EXAMPLE--Value"},
							RegistryVersion: common.Int(904),
							UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
							AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(775),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeProject}}},
							CreatedByName: common.String("EXAMPLE-createdByName-Value"),
							TimeCreated:   &common.SDKTime{Time: time.Now()},
							TimeUpdated:   &common.SDKTime{Time: time.Now()},
							UpdatedBy:     common.String("EXAMPLE-updatedBy-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")},
							CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
							IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
							InfoFields:     map[string]string{"EXAMPLE_KEY_Bz4Me": "EXAMPLE_VALUE_lyeIcvdQww7NKb6R0qkL"}},
						ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
						ObjectVersion: common.Int(680),
						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"),
						Key:          common.String("EXAMPLE-key-Value"),
						Name:         common.String("EXAMPLE-name-Value"),
						ObjectStatus: common.Int(152),
						ResourceName: common.String("EXAMPLE-resourceName-Value")},
					Username:      common.String("EXAMPLE-username-Value"),
					Identifier:    common.String("EXAMPLE-identifier-Value"),
					IsDefault:     common.Bool(true),
					ObjectVersion: common.Int(802),
					ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
						Value: common.String("EXAMPLE-value-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"),
						IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
						RegistryVersion: common.Int(827),
						TimeCreated:     &common.SDKTime{Time: time.Now()},
						UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
						UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(552),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeTask}}},
						CreatedBy:     common.String("EXAMPLE-createdBy-Value"),
						CreatedByName: common.String("EXAMPLE-createdByName-Value"),
						InfoFields:    map[string]string{"EXAMPLE_KEY_1kgyu": "EXAMPLE_VALUE_c8YRaX70CB6RYnysiy8m"},
						IsFavorite:    common.Bool(true),
						Labels:        []string{"EXAMPLE--Value"},
						TimeUpdated:   &common.SDKTime{Time: time.Now()}},
					ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
						Parent: common.String("EXAMPLE-parent-Value")},
					Password: common.String("EXAMPLE-password-Value")}}},
		Description: common.String("EXAMPLE-description-Value"),
		DisplayName: common.String("EXAMPLE-displayName-Value")},
		OpcRequestId:  common.String("OBPEOWZNWMH3IEBR1BS3<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)
}