// 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{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.ConnectionFromOAuth2{ClientId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-clientId-Value"),
IsDefault: common.Bool(false),
Key: common.String("EXAMPLE-key-Value"),
ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
Name: common.String("EXAMPLE-name-Value"),
PrimarySchema: &dataintegration.Schema{ResourceName: common.String("EXAMPLE-resourceName-Value"),
DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
Description: common.String("EXAMPLE-description-Value"),
ExternalKey: common.String("EXAMPLE-externalKey-Value"),
Identifier: common.String("EXAMPLE-identifier-Value"),
IsHasContainers: common.Bool(true),
Metadata: &dataintegration.ObjectMetadata{TimeUpdated: &common.SDKTime{Time: time.Now()},
UpdatedBy: common.String("EXAMPLE-updatedBy-Value"),
UpdatedByName: common.String("EXAMPLE-updatedByName-Value"),
AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(960),
ObjectType: dataintegration.CountStatisticSummaryObjectTypeApplication}}},
CreatedBy: common.String("EXAMPLE-createdBy-Value"),
CreatedByName: common.String("EXAMPLE-createdByName-Value"),
InfoFields: map[string]string{"EXAMPLE_KEY_lPQyY": "EXAMPLE_VALUE_QXILxPye4ITbuF8ijbQ1"},
IsFavorite: common.Bool(true),
Labels: []string{"EXAMPLE--Value"},
RegistryVersion: common.Int(520),
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")},
IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
TimeCreated: &common.SDKTime{Time: time.Now()}},
Name: common.String("EXAMPLE-name-Value"),
Key: common.String("EXAMPLE-key-Value"),
ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
ObjectStatus: common.Int(252),
ObjectVersion: common.Int(679),
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"),
GrantType: dataintegration.ConnectionFromOAuth2GrantTypeClientCredentials,
Identifier: common.String("EXAMPLE-identifier-Value"),
Scope: common.String("EXAMPLE-scope-Value"),
ClientSecret: &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()},
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"),
IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
InfoFields: map[string]string{"EXAMPLE_KEY_9eTgT": "EXAMPLE_VALUE_Oo6hBIOi4TnDR0UZ5xTz"},
IsFavorite: common.Bool(true),
TimeUpdated: &common.SDKTime{Time: time.Now()},
UpdatedBy: common.String("EXAMPLE-updatedBy-Value"),
CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(485),
ObjectType: dataintegration.CountStatisticSummaryObjectTypeProject}}},
CreatedBy: common.String("EXAMPLE-createdBy-Value"),
CreatedByName: common.String("EXAMPLE-createdByName-Value"),
Labels: []string{"EXAMPLE--Value"},
RegistryVersion: common.Int(843)},
ObjectStatus: common.Int(725),
ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
AccessTokenUrl: common.String("EXAMPLE-accessTokenUrl-Value"),
KeyMap: map[string]string{"EXAMPLE_KEY_MC9ju": "EXAMPLE_VALUE_8zspyK6ZNIyENriBB5yL"},
ObjectVersion: common.Int(357)},
DataAsset: dataintegration.DataAssetFromAmazonS3{Description: common.String("EXAMPLE-description-Value"),
AssetProperties: map[string]string{"EXAMPLE_KEY_OcZhj": "EXAMPLE_VALUE_jLC6uqG2hZDa7cazVyfy"},
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")},
Region: common.String("EXAMPLE-region-Value"),
ExternalKey: common.String("EXAMPLE-externalKey-Value"),
KeyMap: map[string]string{"EXAMPLE_KEY_BcMzo": "EXAMPLE_VALUE_LIuxZMmjcBwfEg3QXEpp"},
Metadata: &dataintegration.ObjectMetadata{RegistryVersion: common.Int(742),
TimeCreated: &common.SDKTime{Time: time.Now()},
TimeUpdated: &common.SDKTime{Time: time.Now()},
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(193),
ObjectType: dataintegration.CountStatisticSummaryObjectTypeFunctionLibrary}}},
InfoFields: map[string]string{"EXAMPLE_KEY_iDmDo": "EXAMPLE_VALUE_AsMhZo1FHHgFJWCZxbLe"},
Labels: []string{"EXAMPLE--Value"},
UpdatedBy: common.String("EXAMPLE-updatedBy-Value"),
UpdatedByName: common.String("EXAMPLE-updatedByName-Value"),
AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
CreatedBy: common.String("EXAMPLE-createdBy-Value"),
CreatedByName: common.String("EXAMPLE-createdByName-Value"),
IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
IsFavorite: common.Bool(false)},
ObjectStatus: common.Int(150),
DefaultConnection: &dataintegration.ConnectionSummaryFromAmazonS3{Description: common.String("EXAMPLE-description-Value"),
Name: common.String("EXAMPLE-name-Value"),
ObjectStatus: common.Int(135),
ObjectVersion: common.Int(194),
ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
Value: common.String("EXAMPLE-value-Value")}},
IsDefault: 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")},
PrimarySchema: &dataintegration.Schema{Name: common.String("EXAMPLE-name-Value"),
ObjectVersion: common.Int(984),
DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
ExternalKey: common.String("EXAMPLE-externalKey-Value"),
Metadata: &dataintegration.ObjectMetadata{IsFavorite: common.Bool(false),
Labels: []string{"EXAMPLE--Value"},
TimeCreated: &common.SDKTime{Time: time.Now()},
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")},
AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(398),
ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataFlow}}},
CreatedBy: common.String("EXAMPLE-createdBy-Value"),
IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
RegistryVersion: common.Int(645),
TimeUpdated: &common.SDKTime{Time: time.Now()},
UpdatedByName: common.String("EXAMPLE-updatedByName-Value"),
CreatedByName: common.String("EXAMPLE-createdByName-Value"),
InfoFields: map[string]string{"EXAMPLE_KEY_Mdb57": "EXAMPLE_VALUE_Tg636IDIDbEqfA7ZaJvV"}},
ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
ObjectStatus: common.Int(855),
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"),
Identifier: common.String("EXAMPLE-identifier-Value"),
IsHasContainers: common.Bool(true),
Key: common.String("EXAMPLE-key-Value")},
AccessKey: &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"),
KeyMap: map[string]string{"EXAMPLE_KEY_jUSYe": "EXAMPLE_VALUE_C4xX93YGvaNEjK3K4CGF"},
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(933),
ObjectType: dataintegration.CountStatisticSummaryObjectTypeFolder}}},
CreatedBy: common.String("EXAMPLE-createdBy-Value"),
CreatedByName: common.String("EXAMPLE-createdByName-Value"),
RegistryVersion: common.Int(422),
TimeCreated: &common.SDKTime{Time: time.Now()},
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")},
IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
InfoFields: map[string]string{"EXAMPLE_KEY_rUUb1": "EXAMPLE_VALUE_W3ANmKPgGviyxJ24qdae"},
IsFavorite: common.Bool(true),
Labels: []string{"EXAMPLE--Value"},
UpdatedBy: common.String("EXAMPLE-updatedBy-Value")},
SecretKey: &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"),
ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
Name: common.String("EXAMPLE-name-Value"),
NativeTypeSystem: &dataintegration.TypeSystem{Description: common.String("EXAMPLE-description-Value"),
Name: common.String("EXAMPLE-name-Value"),
ObjectStatus: common.Int(3),
ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
Parent: common.String("EXAMPLE-parent-Value")},
Identifier: common.String("EXAMPLE-identifier-Value"),
Key: common.String("EXAMPLE-key-Value"),
ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
ObjectVersion: common.Int(335),
TypeMappingFrom: map[string]string{"EXAMPLE_KEY_GEAIC": "EXAMPLE_VALUE_Np2LIRN0J5Qr2ZVnIu9y"},
TypeMappingTo: map[string]string{"EXAMPLE_KEY_xpggS": "EXAMPLE_VALUE_pX9grLltN7HQhi532GMb"},
Types: []dataintegration.DataType{dataintegration.DataType{ConfigDefinition: &dataintegration.ConfigDefinition{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
Name: common.String("EXAMPLE-name-Value"),
ObjectStatus: common.Int(967),
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_1M7oQ": dataintegration.ConfigParameterDefinition{Description: common.String("EXAMPLE-description-Value"),
IsClassFieldValue: common.Bool(true),
IsStatic: common.Bool(true),
ParameterName: common.String("EXAMPLE-parameterName-Value"),
ParameterType: dataintegration.ArrayType{Key: common.String("EXAMPLE-key-Value"),
ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
Name: common.String("EXAMPLE-name-Value"),
ObjectStatus: common.Int(109),
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"),
ElementType: common.String("EXAMPLE-elementType-Value")},
ClassFieldName: common.String("EXAMPLE-classFieldName-Value"),
DefaultValue: &defaultValue}},
IsContained: common.Bool(false),
Key: common.String("EXAMPLE-key-Value")},
DtType: dataintegration.DataTypeDtTypePrimitive,
ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
ObjectStatus: common.Int(698),
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")},
TypeSystemName: common.String("EXAMPLE-typeSystemName-Value")}}},
ObjectVersion: common.Int(568)},
Schema: &dataintegration.Schema{ResourceName: common.String("EXAMPLE-resourceName-Value"),
DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
ExternalKey: common.String("EXAMPLE-externalKey-Value"),
Identifier: common.String("EXAMPLE-identifier-Value"),
ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
Name: common.String("EXAMPLE-name-Value"),
ObjectStatus: common.Int(227),
ObjectVersion: common.Int(718),
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"),
IsHasContainers: common.Bool(false),
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"),
CreatedByName: common.String("EXAMPLE-createdByName-Value"),
InfoFields: map[string]string{"EXAMPLE_KEY_odEWd": "EXAMPLE_VALUE_mYMQ585T17LbNBgWoNJH"},
IsFavorite: common.Bool(false),
RegistryVersion: common.Int(724),
TimeCreated: &common.SDKTime{Time: time.Now()},
TimeUpdated: &common.SDKTime{Time: time.Now()},
CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(631),
ObjectType: dataintegration.CountStatisticSummaryObjectTypeProject}}},
CreatedBy: common.String("EXAMPLE-createdBy-Value"),
IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
Labels: []string{"EXAMPLE--Value"},
UpdatedBy: common.String("EXAMPLE-updatedBy-Value"),
UpdatedByName: common.String("EXAMPLE-updatedByName-Value")},
ModelType: common.String("EXAMPLE-modelType-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(904)}},
OpcRequestId: common.String("WNDKI1FKQ4K5XWNIBDNC<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)
}