// 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{DataAsset: dataintegration.DataAssetFromOracleDetails{DefaultConnection: &dataintegration.ConnectionFromOracleDetails{ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
Metadata: &dataintegration.ObjectMetadata{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")},
CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset,
ObjectCount: common.Int64(53)}}},
CreatedByName: common.String("EXAMPLE-createdByName-Value"),
IsFavorite: common.Bool(false),
Labels: []string{"EXAMPLE--Value"},
RegistryVersion: common.Int(445),
TimeCreated: &common.SDKTime{Time: time.Now()},
TimeUpdated: &common.SDKTime{Time: time.Now()},
AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
CreatedBy: common.String("EXAMPLE-createdBy-Value"),
IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
InfoFields: map[string]string{"EXAMPLE_KEY_LsffF": "EXAMPLE_VALUE_O0zuZg13p6sWanzGcfPF"},
UpdatedBy: common.String("EXAMPLE-updatedBy-Value"),
UpdatedByName: common.String("EXAMPLE-updatedByName-Value")},
Password: common.String("EXAMPLE-password-Value"),
ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
Value: common.String("EXAMPLE-value-Value")}},
Key: common.String("EXAMPLE-key-Value"),
ObjectVersion: common.Int(61),
Identifier: common.String("EXAMPLE-identifier-Value"),
IsDefault: common.Bool(true),
PasswordSecret: &dataintegration.SensitiveAttribute{Value: common.String("EXAMPLE-value-Value"),
SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")}},
PrimarySchema: &dataintegration.Schema{ObjectStatus: common.Int(700),
ObjectVersion: common.Int(22),
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"),
Identifier: common.String("EXAMPLE-identifier-Value"),
IsHasContainers: common.Bool(false),
Key: common.String("EXAMPLE-key-Value"),
Metadata: &dataintegration.ObjectMetadata{IsFavorite: common.Bool(false),
TimeCreated: &common.SDKTime{Time: time.Now()},
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")},
AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
InfoFields: map[string]string{"EXAMPLE_KEY_ZZTkB": "EXAMPLE_VALUE_T5n1u8CvxvRJXeVH86r9"},
Labels: []string{"EXAMPLE--Value"},
RegistryVersion: common.Int(329),
TimeUpdated: &common.SDKTime{Time: time.Now()},
UpdatedBy: common.String("EXAMPLE-updatedBy-Value"),
CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(827),
ObjectType: dataintegration.CountStatisticSummaryObjectTypeDataAsset}}},
CreatedBy: common.String("EXAMPLE-createdBy-Value"),
CreatedByName: common.String("EXAMPLE-createdByName-Value")},
ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
Name: common.String("EXAMPLE-name-Value")},
Username: common.String("EXAMPLE-username-Value"),
Description: common.String("EXAMPLE-description-Value"),
ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
Name: common.String("EXAMPLE-name-Value"),
ObjectStatus: common.Int(69)},
Host: common.String("EXAMPLE-host-Value"),
Identifier: common.String("EXAMPLE-identifier-Value"),
KeyMap: map[string]string{"EXAMPLE_KEY_wxMGo": "EXAMPLE_VALUE_pquyE2pCTdToxGMhPXWp"},
ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
Name: common.String("EXAMPLE-name-Value"),
AssetProperties: map[string]string{"EXAMPLE_KEY_KdTtR": "EXAMPLE_VALUE_K4l9pUzXHKli6mVfJw1H"},
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")},
Port: common.String("EXAMPLE-port-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"),
ExternalKey: common.String("EXAMPLE-externalKey-Value"),
Metadata: &dataintegration.ObjectMetadata{CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(542),
ObjectType: dataintegration.CountStatisticSummaryObjectTypeProject}}},
InfoFields: map[string]string{"EXAMPLE_KEY_W1fcf": "EXAMPLE_VALUE_9wqzvCjXPU1AeS1PvuvO"},
IsFavorite: common.Bool(true),
RegistryVersion: common.Int(234),
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"),
CreatedBy: common.String("EXAMPLE-createdBy-Value"),
CreatedByName: common.String("EXAMPLE-createdByName-Value"),
IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
Labels: []string{"EXAMPLE--Value"}},
NativeTypeSystem: &dataintegration.TypeSystem{Name: common.String("EXAMPLE-name-Value"),
TypeMappingFrom: map[string]string{"EXAMPLE_KEY_1GFcO": "EXAMPLE_VALUE_orGmZYgA0rxld6HLDllY"},
TypeMappingTo: map[string]string{"EXAMPLE_KEY_xmLq8": "EXAMPLE_VALUE_vNIjlW56MdTpFs4MweIY"},
Identifier: common.String("EXAMPLE-identifier-Value"),
ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
ObjectStatus: common.Int(225),
ObjectVersion: common.Int(961),
ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
Types: []dataintegration.DataType{dataintegration.DataType{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")},
TypeSystemName: common.String("EXAMPLE-typeSystemName-Value"),
ConfigDefinition: &dataintegration.ConfigDefinition{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
Name: common.String("EXAMPLE-name-Value"),
ObjectStatus: common.Int(99),
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_v8p5N": dataintegration.ConfigParameterDefinition{ParameterName: common.String("EXAMPLE-parameterName-Value"),
ParameterType: dataintegration.MapType{Key: common.String("EXAMPLE-key-Value"),
KeyElementType: common.String("EXAMPLE-keyElementType-Value"),
ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
Name: common.String("EXAMPLE-name-Value"),
ObjectStatus: common.Int(538),
ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
ValueElementType: common.String("EXAMPLE-valueElementType-Value"),
ContainsNull: common.Bool(false),
Description: common.String("EXAMPLE-description-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(true),
Key: common.String("EXAMPLE-key-Value")},
Description: common.String("EXAMPLE-description-Value"),
ObjectStatus: common.Int(783),
DtType: dataintegration.DataTypeDtTypePrimitive,
Key: common.String("EXAMPLE-key-Value")}},
Description: common.String("EXAMPLE-description-Value"),
Key: common.String("EXAMPLE-key-Value")},
ObjectVersion: common.Int(618),
Sid: common.String("EXAMPLE-sid-Value"),
Description: common.String("EXAMPLE-description-Value"),
DriverClass: common.String("EXAMPLE-driverClass-Value"),
ObjectStatus: common.Int(516),
ServiceName: common.String("EXAMPLE-serviceName-Value"),
WalletSecret: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
Value: common.String("EXAMPLE-value-Value")}},
Schema: &dataintegration.Schema{IsHasContainers: common.Bool(true),
ModelType: common.String("EXAMPLE-modelType-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"),
Description: common.String("EXAMPLE-description-Value"),
Identifier: common.String("EXAMPLE-identifier-Value"),
Key: common.String("EXAMPLE-key-Value"),
Metadata: &dataintegration.ObjectMetadata{Labels: []string{"EXAMPLE--Value"},
TimeUpdated: &common.SDKTime{Time: time.Now()},
AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
CreatedBy: common.String("EXAMPLE-createdBy-Value"),
IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
InfoFields: map[string]string{"EXAMPLE_KEY_3O9bG": "EXAMPLE_VALUE_8DXIWfDfIy3dUy7HPask"},
RegistryVersion: common.Int(31),
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")},
CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(510),
ObjectType: dataintegration.CountStatisticSummaryObjectTypeTask}}},
CreatedByName: common.String("EXAMPLE-createdByName-Value"),
IsFavorite: common.Bool(false)},
ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
ObjectStatus: common.Int(634),
ObjectVersion: common.Int(297),
DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
ExternalKey: common.String("EXAMPLE-externalKey-Value")},
CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
Connection: dataintegration.ConnectionFromOAuth2{AccessTokenUrl: common.String("EXAMPLE-accessTokenUrl-Value"),
ConnectionProperties: []dataintegration.ConnectionProperty{dataintegration.ConnectionProperty{Name: common.String("EXAMPLE-name-Value"),
Value: common.String("EXAMPLE-value-Value")}},
Key: common.String("EXAMPLE-key-Value"),
KeyMap: map[string]string{"EXAMPLE_KEY_rBaqE": "EXAMPLE_VALUE_MmxuFjKl1AfqSsZrGNt7"},
Metadata: &dataintegration.ObjectMetadata{RegistryVersion: common.Int(762),
AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
CreatedBy: common.String("EXAMPLE-createdBy-Value"),
CreatedByName: common.String("EXAMPLE-createdByName-Value"),
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")},
CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(672),
ObjectType: dataintegration.CountStatisticSummaryObjectTypeApplication}}},
IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
InfoFields: map[string]string{"EXAMPLE_KEY_2rkWd": "EXAMPLE_VALUE_BTBngbct6TI4DkT6BnYH"},
IsFavorite: common.Bool(true),
Labels: []string{"EXAMPLE--Value"}},
ObjectVersion: common.Int(926),
PrimarySchema: &dataintegration.Schema{Name: common.String("EXAMPLE-name-Value"),
ObjectStatus: common.Int(715),
ObjectVersion: common.Int(85),
DefaultConnection: common.String("EXAMPLE-defaultConnection-Value"),
Description: common.String("EXAMPLE-description-Value"),
ExternalKey: common.String("EXAMPLE-externalKey-Value"),
ModelVersion: common.String("EXAMPLE-modelVersion-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"),
Identifier: common.String("EXAMPLE-identifier-Value"),
IsHasContainers: common.Bool(true),
Key: common.String("EXAMPLE-key-Value"),
Metadata: &dataintegration.ObjectMetadata{Labels: []string{"EXAMPLE--Value"},
RegistryVersion: common.Int(935),
TimeCreated: &common.SDKTime{Time: time.Now()},
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")},
CountStatistics: &dataintegration.CountStatistic{ObjectTypeCountList: []dataintegration.CountStatisticSummary{dataintegration.CountStatisticSummary{ObjectCount: common.Int64(664),
ObjectType: dataintegration.CountStatisticSummaryObjectTypeApplication}}},
CreatedByName: common.String("EXAMPLE-createdByName-Value"),
TimeUpdated: &common.SDKTime{Time: time.Now()},
UpdatedBy: common.String("EXAMPLE-updatedBy-Value"),
UpdatedByName: common.String("EXAMPLE-updatedByName-Value"),
AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
CreatedBy: common.String("EXAMPLE-createdBy-Value"),
IdentifierPath: common.String("EXAMPLE-identifierPath-Value"),
InfoFields: map[string]string{"EXAMPLE_KEY_Kj51i": "EXAMPLE_VALUE_rwInvhvvg7ywY69dTaU0"},
IsFavorite: common.Bool(false)}},
ClientId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-clientId-Value"),
Description: common.String("EXAMPLE-description-Value"),
Name: common.String("EXAMPLE-name-Value"),
Scope: common.String("EXAMPLE-scope-Value"),
ObjectStatus: common.Int(45),
ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
ClientSecret: &dataintegration.SensitiveAttribute{SecretConfig: dataintegration.OciVaultSecretConfig{SecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value")},
Value: common.String("EXAMPLE-value-Value")},
GrantType: dataintegration.ConnectionFromOAuth2GrantTypeClientCredentials,
Identifier: common.String("EXAMPLE-identifier-Value"),
IsDefault: common.Bool(false),
ModelVersion: common.String("EXAMPLE-modelVersion-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(759)}},
OpcRequestId: common.String("HKGGGEBNDWZ2UCSPOANF<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)
}