/** 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).
*/
import com.oracle.bmc.ConfigFileReader;
import com.oracle.bmc.auth.AuthenticationDetailsProvider;
import com.oracle.bmc.auth.ConfigFileAuthenticationDetailsProvider;
import com.oracle.bmc.dataintegration.DataIntegrationClient;
import com.oracle.bmc.dataintegration.model.*;
import com.oracle.bmc.dataintegration.requests.*;
import com.oracle.bmc.dataintegration.responses.*;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Date;
import java.util.UUID;
import java.util.Arrays;
public class CreateExternalPublicationExample {
public static void main(String[] args) throws Exception {
/**
* 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.
*/
final ConfigFileReader.ConfigFile configFile = ConfigFileReader.parseDefault();
final AuthenticationDetailsProvider provider = new ConfigFileAuthenticationDetailsProvider(configFile);
/* Create a service client */
DataIntegrationClient client = DataIntegrationClient.builder().build(provider);
/* Create a request and dependent object(s). */
CreateExternalPublicationDetails createExternalPublicationDetails = CreateExternalPublicationDetails.builder()
.applicationId("ocid1.test.oc1..<unique_ID>EXAMPLE-applicationId-Value")
.applicationCompartmentId("ocid1.test.oc1..<unique_ID>EXAMPLE-applicationCompartmentId-Value")
.displayName("EXAMPLE-displayName-Value")
.description("EXAMPLE-description-Value")
.resourceConfiguration(ResourceConfiguration.builder()
.sparkVersion("EXAMPLE-sparkVersion-Value")
.driverShape("EXAMPLE-driverShape-Value")
.executorShape("EXAMPLE-executorShape-Value")
.totalExecutors(625).build())
.configurationDetails(ConfigurationDetails.builder()
.dataAsset(DataAssetFromHdfsDetails.builder()
.host("EXAMPLE-host-Value")
.port("EXAMPLE-port-Value")
.protocol("EXAMPLE-protocol-Value")
.validateCertificate(true)
.defaultConnection(ConnectionFromHdfsDetails.builder()
.hdfsPrincipal("EXAMPLE-hdfsPrincipal-Value")
.dataNodePrincipal("EXAMPLE-dataNodePrincipal-Value")
.nameNodePrincipal("EXAMPLE-nameNodePrincipal-Value")
.realm("EXAMPLE-realm-Value")
.keyDistributionCenter("EXAMPLE-keyDistributionCenter-Value")
.keyTabContent(SensitiveAttribute.builder()
.secretConfig(OciVaultSecretConfig.builder()
.secretId("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value").build())
.value("EXAMPLE-value-Value").build())
.key("EXAMPLE-key-Value")
.modelVersion("EXAMPLE-modelVersion-Value")
.parentRef(ParentReference.builder()
.parent("EXAMPLE-parent-Value")
.rootDocId("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value").build())
.name("EXAMPLE-name-Value")
.description("EXAMPLE-description-Value")
.objectVersion(545)
.objectStatus(380)
.identifier("EXAMPLE-identifier-Value")
.primarySchema(Schema.builder()
.key("EXAMPLE-key-Value")
.modelType("EXAMPLE-modelType-Value")
.modelVersion("EXAMPLE-modelVersion-Value")
.parentRef(ParentReference.builder()
.parent("EXAMPLE-parent-Value")
.rootDocId("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value").build())
.name("EXAMPLE-name-Value")
.resourceName("EXAMPLE-resourceName-Value")
.description("EXAMPLE-description-Value")
.objectVersion(860)
.externalKey("EXAMPLE-externalKey-Value")
.isHasContainers(false)
.defaultConnection("EXAMPLE-defaultConnection-Value")
.objectStatus(857)
.identifier("EXAMPLE-identifier-Value")
.metadata(ObjectMetadata.builder()
.createdBy("EXAMPLE-createdBy-Value")
.createdByName("EXAMPLE-createdByName-Value")
.updatedBy("EXAMPLE-updatedBy-Value")
.updatedByName("EXAMPLE-updatedByName-Value")
.timeCreated(new Date("Thu Nov 26 14:58:26 UTC 2026"))
.timeUpdated(new Date("Mon Sep 17 23:28:45 UTC 2029"))
.aggregatorKey("EXAMPLE-aggregatorKey-Value")
.aggregator(AggregatorSummary.builder()
.type("EXAMPLE-type-Value")
.key("EXAMPLE-key-Value")
.name("EXAMPLE-name-Value")
.identifier("EXAMPLE-identifier-Value")
.description("EXAMPLE-description-Value").build())
.identifierPath("EXAMPLE-identifierPath-Value")
.infoFields(new HashMap<java.lang.String, java.lang.String>() {
{
put("EXAMPLE_KEY_ofHEe","EXAMPLE_VALUE_d1jQuJTayXhpmm8NX4iV");
}
})
.registryVersion(968)
.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
.isFavorite(false)
.countStatistics(CountStatistic.builder()
.objectTypeCountList(new ArrayList<>(Arrays.asList(CountStatisticSummary.builder()
.objectType(CountStatisticSummary.ObjectType.Application)
.objectCount(954L).build()))).build()).build()).build())
.connectionProperties(new ArrayList<>(Arrays.asList(ConnectionProperty.builder()
.name("EXAMPLE-name-Value")
.value("EXAMPLE-value-Value").build())))
.isDefault(true)
.metadata(ObjectMetadata.builder()
.createdBy("EXAMPLE-createdBy-Value")
.createdByName("EXAMPLE-createdByName-Value")
.updatedBy("EXAMPLE-updatedBy-Value")
.updatedByName("EXAMPLE-updatedByName-Value")
.timeCreated(new Date("Sun Aug 18 02:25:10 UTC 2047"))
.timeUpdated(new Date("Sun Nov 30 17:34:24 UTC 2025"))
.aggregatorKey("EXAMPLE-aggregatorKey-Value")
.aggregator(AggregatorSummary.builder()
.type("EXAMPLE-type-Value")
.key("EXAMPLE-key-Value")
.name("EXAMPLE-name-Value")
.identifier("EXAMPLE-identifier-Value")
.description("EXAMPLE-description-Value").build())
.identifierPath("EXAMPLE-identifierPath-Value")
.infoFields(new HashMap<java.lang.String, java.lang.String>() {
{
put("EXAMPLE_KEY_3R9xU","EXAMPLE_VALUE_gKEliDCGezykfIS1bZRt");
}
})
.registryVersion(868)
.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
.isFavorite(false)
.countStatistics(CountStatistic.builder()
.objectTypeCountList(new ArrayList<>(Arrays.asList(CountStatisticSummary.builder()
.objectType(CountStatisticSummary.ObjectType.UserDefinedFunction)
.objectCount(80L).build()))).build()).build()).build())
.key("EXAMPLE-key-Value")
.modelVersion("EXAMPLE-modelVersion-Value")
.name("EXAMPLE-name-Value")
.description("EXAMPLE-description-Value")
.objectStatus(500)
.identifier("EXAMPLE-identifier-Value")
.externalKey("EXAMPLE-externalKey-Value")
.assetProperties(new HashMap<java.lang.String, java.lang.String>() {
{
put("EXAMPLE_KEY_ZKxuv","EXAMPLE_VALUE_Vju2vY9pd0gI3abpfOcQ");
}
})
.nativeTypeSystem(TypeSystem.builder()
.key("EXAMPLE-key-Value")
.modelType("EXAMPLE-modelType-Value")
.modelVersion("EXAMPLE-modelVersion-Value")
.parentRef(ParentReference.builder()
.parent("EXAMPLE-parent-Value")
.rootDocId("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value").build())
.name("EXAMPLE-name-Value")
.description("EXAMPLE-description-Value")
.objectVersion(472)
.typeMappingTo(new HashMap<java.lang.String, java.lang.String>() {
{
put("EXAMPLE_KEY_2I48a","EXAMPLE_VALUE_aZtlsyc5mXcQakHkNXDy");
}
})
.typeMappingFrom(new HashMap<java.lang.String, java.lang.String>() {
{
put("EXAMPLE_KEY_n4qkP","EXAMPLE_VALUE_IRsL2IzLRbcRVKgmy5Cs");
}
})
.objectStatus(21)
.identifier("EXAMPLE-identifier-Value")
.types(new ArrayList<>(Arrays.asList(DataType.builder()
.dtType(DataType.DtType.Primitive)
.typeSystemName("EXAMPLE-typeSystemName-Value")
.configDefinition(ConfigDefinition.builder()
.key("EXAMPLE-key-Value")
.modelType("EXAMPLE-modelType-Value")
.modelVersion("EXAMPLE-modelVersion-Value")
.parentRef(ParentReference.builder()
.parent("EXAMPLE-parent-Value")
.rootDocId("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value").build())
.name("EXAMPLE-name-Value")
.isContained(false)
.objectStatus(818)
.configParameterDefinitions(new HashMap<java.lang.String, com.oracle.bmc.dataintegration.model.ConfigParameterDefinition>() {
{
put("EXAMPLE_KEY_fhkvM",ConfigParameterDefinition.builder()
.parameterType(ConfiguredType.builder()
.wrappedType("EXAMPLE-wrappedType-Value")
.configValues(ConfigValues.builder()
.configParamValues(new HashMap<java.lang.String, com.oracle.bmc.dataintegration.model.ConfigParameterValue>() {
{
put("EXAMPLE_KEY_NHrck",ConfigParameterValue.builder()
.stringValue("EXAMPLE-stringValue-Value")
.intValue(191)
.objectValue("EXAMPLE-objectValue-Value")
.refValue("EXAMPLE-refValue-Value")
.parameterValue("EXAMPLE-parameterValue-Value")
.rootObjectValue("EXAMPLE-rootObjectValue-Value").build());
}
})
.parentRef(ParentReference.builder()
.parent("EXAMPLE-parent-Value")
.rootDocId("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value").build()).build())
.key("EXAMPLE-key-Value")
.modelVersion("EXAMPLE-modelVersion-Value")
.parentRef(ParentReference.builder()
.parent("EXAMPLE-parent-Value")
.rootDocId("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value").build())
.name("EXAMPLE-name-Value")
.objectStatus(451)
.description("EXAMPLE-description-Value").build())
.parameterName("EXAMPLE-parameterName-Value")
.description("EXAMPLE-description-Value")
.defaultValue("EXAMPLE-defaultValue-Value")
.classFieldName("EXAMPLE-classFieldName-Value")
.isStatic(false)
.isClassFieldValue(false).build());
}
}).build())
.key("EXAMPLE-key-Value")
.modelVersion("EXAMPLE-modelVersion-Value")
.parentRef(ParentReference.builder()
.parent("EXAMPLE-parent-Value")
.rootDocId("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value").build())
.name("EXAMPLE-name-Value")
.objectStatus(355)
.description("EXAMPLE-description-Value").build()))).build())
.objectVersion(897)
.parentRef(ParentReference.builder()
.parent("EXAMPLE-parent-Value")
.rootDocId("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value").build())
.metadata(ObjectMetadata.builder()
.createdBy("EXAMPLE-createdBy-Value")
.createdByName("EXAMPLE-createdByName-Value")
.updatedBy("EXAMPLE-updatedBy-Value")
.updatedByName("EXAMPLE-updatedByName-Value")
.timeCreated(new Date("Tue Apr 25 23:13:47 UTC 2034"))
.timeUpdated(new Date("Thu Sep 21 12:26:33 UTC 2023"))
.aggregatorKey("EXAMPLE-aggregatorKey-Value")
.aggregator(AggregatorSummary.builder()
.type("EXAMPLE-type-Value")
.key("EXAMPLE-key-Value")
.name("EXAMPLE-name-Value")
.identifier("EXAMPLE-identifier-Value")
.description("EXAMPLE-description-Value").build())
.identifierPath("EXAMPLE-identifierPath-Value")
.infoFields(new HashMap<java.lang.String, java.lang.String>() {
{
put("EXAMPLE_KEY_mcAxg","EXAMPLE_VALUE_9frSBpuqZkSDtOGtzEsh");
}
})
.registryVersion(84)
.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
.isFavorite(true)
.countStatistics(CountStatistic.builder()
.objectTypeCountList(new ArrayList<>(Arrays.asList(CountStatisticSummary.builder()
.objectType(CountStatisticSummary.ObjectType.Application)
.objectCount(316L).build()))).build()).build())
.keyMap(new HashMap<java.lang.String, java.lang.String>() {
{
put("EXAMPLE_KEY_xQ5fs","EXAMPLE_VALUE_LTTp41ExYJhOnyyZbI7u");
}
}).build())
.connection(ConnectionFromOracleSiebel.builder()
.username("EXAMPLE-username-Value")
.password("EXAMPLE-password-Value")
.passwordSecret(SensitiveAttribute.builder()
.secretConfig(OciVaultSecretConfig.builder()
.secretId("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value").build())
.value("EXAMPLE-value-Value").build())
.key("EXAMPLE-key-Value")
.modelVersion("EXAMPLE-modelVersion-Value")
.parentRef(ParentReference.builder()
.parent("EXAMPLE-parent-Value")
.rootDocId("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value").build())
.name("EXAMPLE-name-Value")
.description("EXAMPLE-description-Value")
.objectVersion(25)
.objectStatus(727)
.identifier("EXAMPLE-identifier-Value")
.primarySchema(Schema.builder()
.key("EXAMPLE-key-Value")
.modelType("EXAMPLE-modelType-Value")
.modelVersion("EXAMPLE-modelVersion-Value")
.parentRef(ParentReference.builder()
.parent("EXAMPLE-parent-Value")
.rootDocId("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value").build())
.name("EXAMPLE-name-Value")
.resourceName("EXAMPLE-resourceName-Value")
.description("EXAMPLE-description-Value")
.objectVersion(296)
.externalKey("EXAMPLE-externalKey-Value")
.isHasContainers(true)
.defaultConnection("EXAMPLE-defaultConnection-Value")
.objectStatus(837)
.identifier("EXAMPLE-identifier-Value")
.metadata(ObjectMetadata.builder()
.createdBy("EXAMPLE-createdBy-Value")
.createdByName("EXAMPLE-createdByName-Value")
.updatedBy("EXAMPLE-updatedBy-Value")
.updatedByName("EXAMPLE-updatedByName-Value")
.timeCreated(new Date("Wed Mar 23 11:12:23 UTC 2022"))
.timeUpdated(new Date("Wed Dec 18 15:33:11 UTC 2041"))
.aggregatorKey("EXAMPLE-aggregatorKey-Value")
.aggregator(AggregatorSummary.builder()
.type("EXAMPLE-type-Value")
.key("EXAMPLE-key-Value")
.name("EXAMPLE-name-Value")
.identifier("EXAMPLE-identifier-Value")
.description("EXAMPLE-description-Value").build())
.identifierPath("EXAMPLE-identifierPath-Value")
.infoFields(new HashMap<java.lang.String, java.lang.String>() {
{
put("EXAMPLE_KEY_fz63b","EXAMPLE_VALUE_zxZ2xGEOBbHhuVSsNGqL");
}
})
.registryVersion(607)
.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
.isFavorite(false)
.countStatistics(CountStatistic.builder()
.objectTypeCountList(new ArrayList<>(Arrays.asList(CountStatisticSummary.builder()
.objectType(CountStatisticSummary.ObjectType.Application)
.objectCount(596L).build()))).build()).build()).build())
.connectionProperties(new ArrayList<>(Arrays.asList(ConnectionProperty.builder()
.name("EXAMPLE-name-Value")
.value("EXAMPLE-value-Value").build())))
.isDefault(true)
.metadata(ObjectMetadata.builder()
.createdBy("EXAMPLE-createdBy-Value")
.createdByName("EXAMPLE-createdByName-Value")
.updatedBy("EXAMPLE-updatedBy-Value")
.updatedByName("EXAMPLE-updatedByName-Value")
.timeCreated(new Date("Sat Aug 20 17:01:40 UTC 2005"))
.timeUpdated(new Date("Sun Aug 29 07:02:34 UTC 2027"))
.aggregatorKey("EXAMPLE-aggregatorKey-Value")
.aggregator(AggregatorSummary.builder()
.type("EXAMPLE-type-Value")
.key("EXAMPLE-key-Value")
.name("EXAMPLE-name-Value")
.identifier("EXAMPLE-identifier-Value")
.description("EXAMPLE-description-Value").build())
.identifierPath("EXAMPLE-identifierPath-Value")
.infoFields(new HashMap<java.lang.String, java.lang.String>() {
{
put("EXAMPLE_KEY_yRzvm","EXAMPLE_VALUE_1wLRXZuxsAHUDNLfeecE");
}
})
.registryVersion(96)
.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
.isFavorite(false)
.countStatistics(CountStatistic.builder()
.objectTypeCountList(new ArrayList<>(Arrays.asList(CountStatisticSummary.builder()
.objectType(CountStatisticSummary.ObjectType.Application)
.objectCount(681L).build()))).build()).build())
.keyMap(new HashMap<java.lang.String, java.lang.String>() {
{
put("EXAMPLE_KEY_BV8fO","EXAMPLE_VALUE_et1ZFRuttffdBaxS9Fjo");
}
}).build())
.compartmentId("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value")
.schema(Schema.builder()
.key("EXAMPLE-key-Value")
.modelType("EXAMPLE-modelType-Value")
.modelVersion("EXAMPLE-modelVersion-Value")
.parentRef(ParentReference.builder()
.parent("EXAMPLE-parent-Value")
.rootDocId("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value").build())
.name("EXAMPLE-name-Value")
.resourceName("EXAMPLE-resourceName-Value")
.description("EXAMPLE-description-Value")
.objectVersion(565)
.externalKey("EXAMPLE-externalKey-Value")
.isHasContainers(true)
.defaultConnection("EXAMPLE-defaultConnection-Value")
.objectStatus(691)
.identifier("EXAMPLE-identifier-Value")
.metadata(ObjectMetadata.builder()
.createdBy("EXAMPLE-createdBy-Value")
.createdByName("EXAMPLE-createdByName-Value")
.updatedBy("EXAMPLE-updatedBy-Value")
.updatedByName("EXAMPLE-updatedByName-Value")
.timeCreated(new Date("Tue Mar 19 06:18:47 UTC 2047"))
.timeUpdated(new Date("Fri Nov 23 08:15:53 UTC 2001"))
.aggregatorKey("EXAMPLE-aggregatorKey-Value")
.aggregator(AggregatorSummary.builder()
.type("EXAMPLE-type-Value")
.key("EXAMPLE-key-Value")
.name("EXAMPLE-name-Value")
.identifier("EXAMPLE-identifier-Value")
.description("EXAMPLE-description-Value").build())
.identifierPath("EXAMPLE-identifierPath-Value")
.infoFields(new HashMap<java.lang.String, java.lang.String>() {
{
put("EXAMPLE_KEY_L3gY4","EXAMPLE_VALUE_iNVK78JttQERSvyfGlrk");
}
})
.registryVersion(979)
.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
.isFavorite(false)
.countStatistics(CountStatistic.builder()
.objectTypeCountList(new ArrayList<>(Arrays.asList(CountStatisticSummary.builder()
.objectType(CountStatisticSummary.ObjectType.DataAsset)
.objectCount(173L).build()))).build()).build()).build()).build()).build();
CreateExternalPublicationRequest createExternalPublicationRequest = CreateExternalPublicationRequest.builder()
.workspaceId("ocid1.test.oc1..<unique_ID>EXAMPLE-workspaceId-Value")
.taskKey("EXAMPLE-taskKey-Value")
.createExternalPublicationDetails(createExternalPublicationDetails)
.opcRequestId("WU7XUF5V5OTPQGF3BAKG<unique_ID>")
.opcRetryToken("EXAMPLE-opcRetryToken-Value").build();
/* Send request to the Client */
CreateExternalPublicationResponse response = client.createExternalPublication(createExternalPublicationRequest);
}
}