/** 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(123).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(404)
.objectStatus(884)
.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(637)
.externalKey("EXAMPLE-externalKey-Value")
.isHasContainers(true)
.defaultConnection("EXAMPLE-defaultConnection-Value")
.objectStatus(163)
.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("Sat Sep 27 16:57:18 UTC 2014"))
.timeUpdated(new Date("Sat Dec 06 17:04: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_Bv0YK","EXAMPLE_VALUE_cJ8eslIXrfZ6mkyaSieI");
}
})
.registryVersion(590)
.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
.isFavorite(true)
.countStatistics(CountStatistic.builder()
.objectTypeCountList(new ArrayList<>(Arrays.asList(CountStatisticSummary.builder()
.objectType(CountStatisticSummary.ObjectType.Connection)
.objectCount(896L).build()))).build()).build()).build())
.connectionProperties(new ArrayList<>(Arrays.asList(ConnectionProperty.builder()
.name("EXAMPLE-name-Value")
.value("EXAMPLE-value-Value").build())))
.isDefault(false)
.metadata(ObjectMetadata.builder()
.createdBy("EXAMPLE-createdBy-Value")
.createdByName("EXAMPLE-createdByName-Value")
.updatedBy("EXAMPLE-updatedBy-Value")
.updatedByName("EXAMPLE-updatedByName-Value")
.timeCreated(new Date("Fri Nov 26 13:27:36 UTC 2004"))
.timeUpdated(new Date("Thu Mar 10 15:45:28 UTC 2005"))
.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_fI8pq","EXAMPLE_VALUE_E7b6vsYYR3oWx7xbYe05");
}
})
.registryVersion(123)
.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
.isFavorite(false)
.countStatistics(CountStatistic.builder()
.objectTypeCountList(new ArrayList<>(Arrays.asList(CountStatisticSummary.builder()
.objectType(CountStatisticSummary.ObjectType.UserDefinedFunction)
.objectCount(313L).build()))).build()).build()).build())
.key("EXAMPLE-key-Value")
.modelVersion("EXAMPLE-modelVersion-Value")
.name("EXAMPLE-name-Value")
.description("EXAMPLE-description-Value")
.objectStatus(455)
.identifier("EXAMPLE-identifier-Value")
.externalKey("EXAMPLE-externalKey-Value")
.assetProperties(new HashMap<java.lang.String, java.lang.String>() {
{
put("EXAMPLE_KEY_xWIqL","EXAMPLE_VALUE_NqhEqgZgMz386rvquOHz");
}
})
.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(772)
.typeMappingTo(new HashMap<java.lang.String, java.lang.String>() {
{
put("EXAMPLE_KEY_WlnMa","EXAMPLE_VALUE_rsbneYKUIULEXBLslyoa");
}
})
.typeMappingFrom(new HashMap<java.lang.String, java.lang.String>() {
{
put("EXAMPLE_KEY_6geb9","EXAMPLE_VALUE_6X6CsYsJ1spA3RbWfSBX");
}
})
.objectStatus(78)
.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(true)
.objectStatus(380)
.configParameterDefinitions(new HashMap<java.lang.String, com.oracle.bmc.dataintegration.model.ConfigParameterDefinition>() {
{
put("EXAMPLE_KEY_gCUHp",ConfigParameterDefinition.builder()
.parameterType(DerivedType.builder()
.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(229)
.description("EXAMPLE-description-Value").build())
.parameterName("EXAMPLE-parameterName-Value")
.description("EXAMPLE-description-Value")
.defaultValue("EXAMPLE-defaultValue-Value")
.classFieldName("EXAMPLE-classFieldName-Value")
.isStatic(true)
.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(846)
.description("EXAMPLE-description-Value").build()))).build())
.objectVersion(224)
.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("Thu Jul 26 14:06:55 UTC 2001"))
.timeUpdated(new Date("Sat Mar 14 16:30:25 UTC 2043"))
.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_1JLoo","EXAMPLE_VALUE_kNZgdNPr0g09d03OKMnb");
}
})
.registryVersion(485)
.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
.isFavorite(true)
.countStatistics(CountStatistic.builder()
.objectTypeCountList(new ArrayList<>(Arrays.asList(CountStatisticSummary.builder()
.objectType(CountStatisticSummary.ObjectType.Application)
.objectCount(311L).build()))).build()).build())
.keyMap(new HashMap<java.lang.String, java.lang.String>() {
{
put("EXAMPLE_KEY_DVU3L","EXAMPLE_VALUE_Kdn8y5jo6fSSz3ILAaVX");
}
}).build())
.connection(ConnectionFromOracle.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(746)
.objectStatus(12)
.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(191)
.externalKey("EXAMPLE-externalKey-Value")
.isHasContainers(false)
.defaultConnection("EXAMPLE-defaultConnection-Value")
.objectStatus(305)
.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 Dec 19 12:01:29 UTC 2035"))
.timeUpdated(new Date("Sat Oct 27 08:53:46 UTC 2040"))
.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_U3Zli","EXAMPLE_VALUE_4wXESETEphEWM1ChWCdv");
}
})
.registryVersion(147)
.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
.isFavorite(false)
.countStatistics(CountStatistic.builder()
.objectTypeCountList(new ArrayList<>(Arrays.asList(CountStatisticSummary.builder()
.objectType(CountStatisticSummary.ObjectType.DataFlow)
.objectCount(759L).build()))).build()).build()).build())
.connectionProperties(new ArrayList<>(Arrays.asList(ConnectionProperty.builder()
.name("EXAMPLE-name-Value")
.value("EXAMPLE-value-Value").build())))
.isDefault(false)
.metadata(ObjectMetadata.builder()
.createdBy("EXAMPLE-createdBy-Value")
.createdByName("EXAMPLE-createdByName-Value")
.updatedBy("EXAMPLE-updatedBy-Value")
.updatedByName("EXAMPLE-updatedByName-Value")
.timeCreated(new Date("Sun Mar 14 12:25:06 UTC 2004"))
.timeUpdated(new Date("Tue Oct 16 10:36:42 UTC 2040"))
.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_LgI4T","EXAMPLE_VALUE_a65Y5CGdJxiUS6wRsrwE");
}
})
.registryVersion(0)
.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
.isFavorite(false)
.countStatistics(CountStatistic.builder()
.objectTypeCountList(new ArrayList<>(Arrays.asList(CountStatisticSummary.builder()
.objectType(CountStatisticSummary.ObjectType.DataAsset)
.objectCount(229L).build()))).build()).build())
.keyMap(new HashMap<java.lang.String, java.lang.String>() {
{
put("EXAMPLE_KEY_oAgjZ","EXAMPLE_VALUE_8aWYbOe9Jb5wPYPUO6qc");
}
}).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(829)
.externalKey("EXAMPLE-externalKey-Value")
.isHasContainers(false)
.defaultConnection("EXAMPLE-defaultConnection-Value")
.objectStatus(647)
.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("Mon Nov 21 04:36:19 UTC 2039"))
.timeUpdated(new Date("Tue Apr 12 19:53:02 UTC 2011"))
.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_cyovH","EXAMPLE_VALUE_OZG6992VZkiMSi4Ws3Ep");
}
})
.registryVersion(248)
.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
.isFavorite(false)
.countStatistics(CountStatistic.builder()
.objectTypeCountList(new ArrayList<>(Arrays.asList(CountStatisticSummary.builder()
.objectType(CountStatisticSummary.ObjectType.DataAsset)
.objectCount(679L).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("5TCOSV6NHU71M5YPH7K7<unique_ID>")
.opcRetryToken("EXAMPLE-opcRetryToken-Value").build();
/* Send request to the Client */
CreateExternalPublicationResponse response = client.createExternalPublication(createExternalPublicationRequest);
}
}