// 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{Schema: &dataintegration.Schema{ResourceName: common.String("EXAMPLE-resourceName-Value"),
				DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
				ModelVersion:      common.String("EXAMPLE-modelVersion-Value"),
				ObjectStatus:      common.Int(647),
				ObjectVersion:     common.Int(829),
				Description:       common.String("EXAMPLE-description-Value"),
				Identifier:        common.String("EXAMPLE-identifier-Value"),
				IsHasContainers:   common.Bool(false),
				Key:               common.String("EXAMPLE-key-Value"),
				Metadata: &dataintegration.ObjectMetadata{TimeCreated: &common.SDKTime{Time: time.Now()},
					CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
					Labels:          []string{"EXAMPLE--Value"},
					RegistryVersion: common.Int(248),
					IsFavorite:      common.Bool(false),
					AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
					IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
					InfoFields:      map[string]string{"EXAMPLE_KEY_cyovH": "EXAMPLE_VALUE_OZG6992VZkiMSi4Ws3Ep"},
					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")},
					CreatedByName: common.String("EXAMPLE-createdByName-Value"),
					UpdatedByName: common.String("EXAMPLE-updatedByName-Value"),
					CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset,
						ObjectCount: common.Int64(679)}}}},
				ModelType:   common.String("EXAMPLE-modelType-Value"),
				Name:        common.String("EXAMPLE-name-Value"),
				ExternalKey: common.String("EXAMPLE-externalKey-Value"),
				ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
					Parent: common.String("EXAMPLE-parent-Value")}},
				CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
				Connection: dataintegration.ConnectionFromOracle{IsDefault: common.Bool(false),
					Metadata: &dataintegration.ObjectMetadata{UpdatedBy: common.String("EXAMPLE-updatedBy-Value"),
						TimeUpdated:    &common.SDKTime{Time: time.Now()},
						InfoFields:     map[string]string{"EXAMPLE_KEY_LgI4T": "EXAMPLE_VALUE_a65Y5CGdJxiUS6wRsrwE"},
						IsFavorite:     common.Bool(false),
						Labels:         []string{"EXAMPLE--Value"},
						CreatedByName:  common.String("EXAMPLE-createdByName-Value"),
						TimeCreated:    &common.SDKTime{Time: time.Now()},
						UpdatedByName:  common.String("EXAMPLE-updatedByName-Value"),
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
						AggregatorKey:  common.String("EXAMPLE-aggregatorKey-Value"),
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(229),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset}}},
						CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
						RegistryVersion: common.Int(0),
						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")}},
					ObjectVersion: common.Int(746),
					PasswordSecret: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
						Value: common.String("EXAMPLE-value-Value")},
					ObjectStatus: common.Int(12),
					ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Value: common.String("EXAMPLE-value-Value"),
						Name: common.String("EXAMPLE-name-Value")}},
					Description:  common.String("EXAMPLE-description-Value"),
					Key:          common.String("EXAMPLE-key-Value"),
					KeyMap:       map[string]string{"EXAMPLE_KEY_oAgjZ": "EXAMPLE_VALUE_8aWYbOe9Jb5wPYPUO6qc"},
					ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					Identifier:   common.String("EXAMPLE-identifier-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"),
					PrimarySchema: &dataintegration.Schema{Identifier: common.String("EXAMPLE-identifier-Value"),
						IsHasContainers: common.Bool(false),
						ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
						ObjectVersion:   common.Int(191),
						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"),
						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")},
							CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
							IsFavorite:      common.Bool(false),
							TimeCreated:     &common.SDKTime{Time: time.Now()},
							UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
							CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
							Labels:          []string{"EXAMPLE--Value"},
							RegistryVersion: common.Int(147),
							UpdatedByName:   common.String("EXAMPLE-updatedByName-Value"),
							AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
							InfoFields:      map[string]string{"EXAMPLE_KEY_U3Zli": "EXAMPLE_VALUE_4wXESETEphEWM1ChWCdv"},
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(759),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataFlow}}},
							IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
							TimeUpdated:    &common.SDKTime{Time: time.Now()}},
						Name:              common.String("EXAMPLE-name-Value"),
						ObjectStatus:      common.Int(305),
						Description:       common.String("EXAMPLE-description-Value"),
						Key:               common.String("EXAMPLE-key-Value"),
						DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
						ExternalKey:       common.String("EXAMPLE-externalKey-Value")},
					Username: common.String("EXAMPLE-username-Value")},
				DataAsset: dataintegration.DataAssetFromHdfsDetails{Host: common.String("EXAMPLE-host-Value"),
					NativeTypeSystem: &dataintegration.TypeSystem{ObjectStatus: common.Int(78),
						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"),
						Name:            common.String("EXAMPLE-name-Value"),
						ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
						ObjectVersion:   common.Int(772),
						TypeMappingFrom: map[string]string{"EXAMPLE_KEY_6geb9": "EXAMPLE_VALUE_6X6CsYsJ1spA3RbWfSBX"},
						TypeMappingTo:   map[string]string{"EXAMPLE_KEY_WlnMa": "EXAMPLE_VALUE_rsbneYKUIULEXBLslyoa"},
						Types: []dataintegration.DataType{dataintegration.DataType{ConfigDefinition: &dataintegration.ConfigDefinition{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
							Name:         common.String("EXAMPLE-name-Value"),
							ObjectStatus: common.Int(380),
							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_gCUHp": dataintegration.ConfigParameterDefinition{IsClassFieldValue: common.Bool(false),
								IsStatic:      common.Bool(true),
								ParameterName: common.String("EXAMPLE-parameterName-Value"),
								ParameterType: dataintegration.DerivedType{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(229),
									ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
										RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")}},
								ClassFieldName: common.String("EXAMPLE-classFieldName-Value"),
								DefaultValue:   &defaultValue,
								Description:    common.String("EXAMPLE-description-Value")}},
							IsContained: common.Bool(true),
							Key:         common.String("EXAMPLE-key-Value")},
							DtType:       dataintegration.DataTypeDtTypePrimitive,
							Key:          common.String("EXAMPLE-key-Value"),
							Name:         common.String("EXAMPLE-name-Value"),
							ObjectStatus: common.Int(846),
							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"),
							ModelVersion:   common.String("EXAMPLE-modelVersion-Value")}},
						Description: common.String("EXAMPLE-description-Value"),
						Identifier:  common.String("EXAMPLE-identifier-Value")},
					Port: common.String("EXAMPLE-port-Value"),
					DefaultConnection: &dataintegration.ConnectionFromHdfsDetails{Name: common.String("EXAMPLE-name-Value"),
						ObjectVersion: common.Int(404),
						Description:   common.String("EXAMPLE-description-Value"),
						ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
							RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
						PrimarySchema: &dataintegration.Schema{IsHasContainers: common.Bool(true),
							Name:              common.String("EXAMPLE-name-Value"),
							DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
							ExternalKey:       common.String("EXAMPLE-externalKey-Value"),
							ObjectVersion:     common.Int(637),
							ResourceName:      common.String("EXAMPLE-resourceName-Value"),
							Key:               common.String("EXAMPLE-key-Value"),
							Metadata: &dataintegration.ObjectMetadata{InfoFields: map[string]string{"EXAMPLE_KEY_Bv0YK": "EXAMPLE_VALUE_cJ8eslIXrfZ6mkyaSieI"},
								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")},
								CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
								TimeCreated:     &common.SDKTime{Time: time.Now()},
								AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
								IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
								RegistryVersion: common.Int(590),
								TimeUpdated:     &common.SDKTime{Time: time.Now()},
								UpdatedBy:       common.String("EXAMPLE-updatedBy-Value"),
								CreatedBy:       common.String("EXAMPLE-createdBy-Value"),
								Labels:          []string{"EXAMPLE--Value"},
								CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(896),
									ObjectType: dataintegration.CountStatisticSummaryObjectTypeConnection}}},
								IsFavorite: common.Bool(true)},
							ObjectStatus: common.Int(163),
							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"),
							Identifier:   common.String("EXAMPLE-identifier-Value"),
							ModelVersion: common.String("EXAMPLE-modelVersion-Value")},
						ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
							Value: common.String("EXAMPLE-value-Value")}},
						Identifier: common.String("EXAMPLE-identifier-Value"),
						KeyTabContent: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
							Value: common.String("EXAMPLE-value-Value")},
						Metadata: &dataintegration.ObjectMetadata{TimeCreated: &common.SDKTime{Time: time.Now()},
							TimeUpdated:   &common.SDKTime{Time: time.Now()},
							UpdatedBy:     common.String("EXAMPLE-updatedBy-Value"),
							UpdatedByName: common.String("EXAMPLE-updatedByName-Value"),
							CreatedBy:     common.String("EXAMPLE-createdBy-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")},
							CreatedByName:   common.String("EXAMPLE-createdByName-Value"),
							RegistryVersion: common.Int(123),
							IdentifierPath:  common.String("EXAMPLE-identifierPath-Value"),
							InfoFields:      map[string]string{"EXAMPLE_KEY_fI8pq": "EXAMPLE_VALUE_E7b6vsYYR3oWx7xbYe05"},
							IsFavorite:      common.Bool(false),
							AggregatorKey:   common.String("EXAMPLE-aggregatorKey-Value"),
							CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(313),
								ObjectType: dataintegration.CountStatisticSummaryObjectTypeUserDefinedFunction}}}},
						NameNodePrincipal:     common.String("EXAMPLE-nameNodePrincipal-Value"),
						ObjectStatus:          common.Int(884),
						Realm:                 common.String("EXAMPLE-realm-Value"),
						DataNodePrincipal:     common.String("EXAMPLE-dataNodePrincipal-Value"),
						HdfsPrincipal:         common.String("EXAMPLE-hdfsPrincipal-Value"),
						IsDefault:             common.Bool(false),
						Key:                   common.String("EXAMPLE-key-Value"),
						KeyDistributionCenter: common.String("EXAMPLE-keyDistributionCenter-Value"),
						ModelVersion:          common.String("EXAMPLE-modelVersion-Value")},
					Key: common.String("EXAMPLE-key-Value"),
					Metadata: &dataintegration.ObjectMetadata{RegistryVersion: common.Int(485),
						TimeCreated:   &common.SDKTime{Time: time.Now()},
						AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
						CreatedByName: common.String("EXAMPLE-createdByName-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")},
						UpdatedByName: common.String("EXAMPLE-updatedByName-Value"),
						IsFavorite:    common.Bool(true),
						TimeUpdated:   &common.SDKTime{Time: time.Now()},
						UpdatedBy:     common.String("EXAMPLE-updatedBy-Value"),
						InfoFields:    map[string]string{"EXAMPLE_KEY_1JLoo": "EXAMPLE_VALUE_kNZgdNPr0g09d03OKMnb"},
						CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(311),
							ObjectType: dataintegration.CountStatisticSummaryObjectTypeApplication}}},
						CreatedBy:      common.String("EXAMPLE-createdBy-Value"),
						IdentifierPath: common.String("EXAMPLE-identifierPath-Value")},
					Name:                common.String("EXAMPLE-name-Value"),
					Protocol:            common.String("EXAMPLE-protocol-Value"),
					ValidateCertificate: common.Bool(true),
					AssetProperties:     map[string]string{"EXAMPLE_KEY_xWIqL": "EXAMPLE_VALUE_NqhEqgZgMz386rvquOHz"},
					ExternalKey:         common.String("EXAMPLE-externalKey-Value"),
					Identifier:          common.String("EXAMPLE-identifier-Value"),
					KeyMap:              map[string]string{"EXAMPLE_KEY_DVU3L": "EXAMPLE_VALUE_Kdn8y5jo6fSSz3ILAaVX"},
					ModelVersion:        common.String("EXAMPLE-modelVersion-Value"),
					ObjectStatus:        common.Int(455),
					ObjectVersion:       common.Int(224),
					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")}},
			Description: common.String("EXAMPLE-description-Value"),
			DisplayName: common.String("EXAMPLE-displayName-Value"),
			ResourceConfiguration: &dataintegration.ResourceConfiguration{DriverShape: common.String("EXAMPLE-driverShape-Value"),
				ExecutorShape:  common.String("EXAMPLE-executorShape-Value"),
				SparkVersion:   common.String("EXAMPLE-sparkVersion-Value"),
				TotalExecutors: common.Int(123)}},
		OpcRequestId: common.String("5TCOSV6NHU71M5YPH7K7<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)
}