/** 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(206).build())
.configurationDetails(ConfigurationDetails.builder()
.dataAsset(DataAssetFromAmazonS3.builder()
.region("EXAMPLE-region-Value")
.defaultConnection(ConnectionSummaryFromAmazonS3.builder()
.accessKey(SensitiveAttribute.builder()
.secretConfig(OciVaultSecretConfig.builder()
.secretId("ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value").build())
.value("EXAMPLE-value-Value").build())
.secretKey(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(431)
.objectStatus(493)
.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(429)
.externalKey("EXAMPLE-externalKey-Value")
.isHasContainers(false)
.defaultConnection("EXAMPLE-defaultConnection-Value")
.objectStatus(740)
.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 Jul 06 17:31:44 UTC 2049"))
.timeUpdated(new Date("Sun Apr 02 09:00:49 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_Lz0TU","EXAMPLE_VALUE_14MfXBaOXvlfo1kWpFEx");
}
})
.registryVersion(35)
.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
.isFavorite(true)
.countStatistics(CountStatistic.builder()
.objectTypeCountList(new ArrayList<>(Arrays.asList(CountStatisticSummary.builder()
.objectType(CountStatisticSummary.ObjectType.Project)
.objectCount(728L).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 Feb 11 01:47:49 UTC 2035"))
.timeUpdated(new Date("Tue Jun 17 09:09:29 UTC 2042"))
.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_qM9Wf","EXAMPLE_VALUE_PGOn1H3YxiVgprti47OK");
}
})
.registryVersion(384)
.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
.isFavorite(false)
.countStatistics(CountStatistic.builder()
.objectTypeCountList(new ArrayList<>(Arrays.asList(CountStatisticSummary.builder()
.objectType(CountStatisticSummary.ObjectType.DataFlow)
.objectCount(790L).build()))).build()).build())
.keyMap(new HashMap<java.lang.String, java.lang.String>() {
{
put("EXAMPLE_KEY_TJKX9","EXAMPLE_VALUE_p4OfW9WjtKp0OSL6Cow1");
}
}).build())
.key("EXAMPLE-key-Value")
.modelVersion("EXAMPLE-modelVersion-Value")
.name("EXAMPLE-name-Value")
.description("EXAMPLE-description-Value")
.objectStatus(204)
.identifier("EXAMPLE-identifier-Value")
.externalKey("EXAMPLE-externalKey-Value")
.assetProperties(new HashMap<java.lang.String, java.lang.String>() {
{
put("EXAMPLE_KEY_J3Sqm","EXAMPLE_VALUE_7bcqHaHAiTmcZ5btiw1U");
}
})
.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(953)
.typeMappingTo(new HashMap<java.lang.String, java.lang.String>() {
{
put("EXAMPLE_KEY_MYDEF","EXAMPLE_VALUE_MB7WRB2zS5jh3ThXm9le");
}
})
.typeMappingFrom(new HashMap<java.lang.String, java.lang.String>() {
{
put("EXAMPLE_KEY_eIG9k","EXAMPLE_VALUE_9KTitA1oBpeowZnwmh3i");
}
})
.objectStatus(464)
.identifier("EXAMPLE-identifier-Value")
.types(new ArrayList<>(Arrays.asList(DataType.builder()
.dtType(DataType.DtType.Structured)
.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(548)
.configParameterDefinitions(new HashMap<java.lang.String, com.oracle.bmc.dataintegration.model.ConfigParameterDefinition>() {
{
put("EXAMPLE_KEY_VnWXp",ConfigParameterDefinition.builder()
.parameterType(DynamicType.builder()
.typeHandler(RuleTypeConfig.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())
.scope("EXAMPLE-scope-Value")
.scopeReference(ScopeReference.builder()
.referenceObject("EXAMPLE-referenceObject-Value")
.referenceType(ScopeReference.ReferenceType.OciFunctionOutputShape)
.refObjectName("EXAMPLE-refObjectName-Value").build())
.isOrderByRule(false)
.projectionRules(new ArrayList<>(Arrays.asList(NamePatternRule.builder()
.isSkipRemainingRulesOnMatch(false)
.scope("EXAMPLE-scope-Value")
.isCascade(true)
.matchingStrategy(NamePatternRule.MatchingStrategy.NameOrTags)
.isCaseSensitive(true)
.ruleType(NamePatternRule.RuleType.Include)
.pattern("EXAMPLE-pattern-Value")
.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())
.isJavaRegexSyntax(false)
.configValues(ConfigValues.builder()
.configParamValues(new HashMap<java.lang.String, com.oracle.bmc.dataintegration.model.ConfigParameterValue>() {
{
put("EXAMPLE_KEY_FgTHy",ConfigParameterValue.builder()
.stringValue("EXAMPLE-stringValue-Value")
.intValue(211)
.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())
.objectStatus(156)
.description("EXAMPLE-description-Value").build())))
.configValues(ConfigValues.builder()
.configParamValues(new HashMap<java.lang.String, com.oracle.bmc.dataintegration.model.ConfigParameterValue>() {
{
put("EXAMPLE_KEY_gRFKZ",ConfigParameterValue.builder()
.stringValue("EXAMPLE-stringValue-Value")
.intValue(823)
.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())
.objectStatus(264).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(212)
.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(341)
.description("EXAMPLE-description-Value").build()))).build())
.objectVersion(90)
.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("Fri Mar 14 19:48:53 UTC 2025"))
.timeUpdated(new Date("Tue Feb 07 10:44:56 UTC 2012"))
.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_Z6Ahu","EXAMPLE_VALUE_7ADDpYyzOBA5mBTQjTca");
}
})
.registryVersion(565)
.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
.isFavorite(false)
.countStatistics(CountStatistic.builder()
.objectTypeCountList(new ArrayList<>(Arrays.asList(CountStatisticSummary.builder()
.objectType(CountStatisticSummary.ObjectType.Project)
.objectCount(146L).build()))).build()).build())
.keyMap(new HashMap<java.lang.String, java.lang.String>() {
{
put("EXAMPLE_KEY_bCkOG","EXAMPLE_VALUE_fZYLb5X4JDWRT2jDUMnu");
}
}).build())
.connection(ConnectionFromOracleEbs.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(659)
.objectStatus(629)
.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(595)
.externalKey("EXAMPLE-externalKey-Value")
.isHasContainers(false)
.defaultConnection("EXAMPLE-defaultConnection-Value")
.objectStatus(883)
.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 Aug 01 04:38:25 UTC 2045"))
.timeUpdated(new Date("Thu Nov 14 19:38:46 UTC 2019"))
.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_j07w1","EXAMPLE_VALUE_Z4W6T9cMYUhtV4z3Ge8b");
}
})
.registryVersion(218)
.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
.isFavorite(true)
.countStatistics(CountStatistic.builder()
.objectTypeCountList(new ArrayList<>(Arrays.asList(CountStatisticSummary.builder()
.objectType(CountStatisticSummary.ObjectType.Task)
.objectCount(602L).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("Thu Sep 08 23:39:45 UTC 2022"))
.timeUpdated(new Date("Thu Aug 16 18:28:14 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_w3knM","EXAMPLE_VALUE_VqoRpjPWEpyNYMaBw8Av");
}
})
.registryVersion(859)
.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
.isFavorite(true)
.countStatistics(CountStatistic.builder()
.objectTypeCountList(new ArrayList<>(Arrays.asList(CountStatisticSummary.builder()
.objectType(CountStatisticSummary.ObjectType.Folder)
.objectCount(355L).build()))).build()).build())
.keyMap(new HashMap<java.lang.String, java.lang.String>() {
{
put("EXAMPLE_KEY_y25Gn","EXAMPLE_VALUE_JGYWEzDupNzEqY5TlicH");
}
}).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(350)
.externalKey("EXAMPLE-externalKey-Value")
.isHasContainers(true)
.defaultConnection("EXAMPLE-defaultConnection-Value")
.objectStatus(557)
.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 May 01 14:24:57 UTC 2000"))
.timeUpdated(new Date("Sat Aug 14 05:43:14 UTC 2004"))
.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_SLGwQ","EXAMPLE_VALUE_QQE7NG3z4c2LDx2ckKdT");
}
})
.registryVersion(247)
.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
.isFavorite(false)
.countStatistics(CountStatistic.builder()
.objectTypeCountList(new ArrayList<>(Arrays.asList(CountStatisticSummary.builder()
.objectType(CountStatisticSummary.ObjectType.Project)
.objectCount(165L).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("PUZXHKLI6MVFJW1H5XML<unique_ID>")
.opcRetryToken("EXAMPLE-opcRetryToken-Value").build();
/* Send request to the Client */
CreateExternalPublicationResponse response = client.createExternalPublication(createExternalPublicationRequest);
}
}