/** 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.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 = new DataIntegrationClient(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(11).build())
		.configurationDetails(ConfigurationDetails.builder()
			.dataAsset(DataAssetFromOracleDetails.builder()
				.host("EXAMPLE-host-Value")
				.port("EXAMPLE-port-Value")
				.serviceName("EXAMPLE-serviceName-Value")
				.driverClass("EXAMPLE-driverClass-Value")
				.sid("EXAMPLE-sid-Value")
				.credentialFileContent("EXAMPLE-credentialFileContent-Value")
				.defaultConnection(ConnectionFromOracleDetails.builder()
					.username("EXAMPLE-username-Value")
					.password("EXAMPLE-password-Value")
					.key("EXAMPLE-key-Value")
					.modelVersion("EXAMPLE-modelVersion-Value")
					.parentRef(ParentReference.builder()
						.parent("EXAMPLE-parent-Value").build())
					.name("EXAMPLE-name-Value")
					.description("EXAMPLE-description-Value")
					.objectVersion(233)
					.objectStatus(644)
					.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").build())
						.name("EXAMPLE-name-Value")
						.resourceName("EXAMPLE-resourceName-Value")
						.description("EXAMPLE-description-Value")
						.objectVersion(156)
						.externalKey("EXAMPLE-externalKey-Value")
						.isHasContainers(false)
						.defaultConnection("EXAMPLE-defaultConnection-Value")
						.objectStatus(646)
						.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("Sun Jul 20 16:22:22 UTC 2003"))
							.timeUpdated(new Date("Sun Apr 21 16:53:34 UTC 2030"))
							.aggregatorKey("EXAMPLE-aggregatorKey-Value")
							.identifierPath("EXAMPLE-identifierPath-Value")
							.infoFields(new HashMap<java.lang.String, java.lang.String>() {
									{
										put("EXAMPLE_KEY_yOePj","EXAMPLE_VALUE_kUOS4tmYbwLSUV8jkyvl");
									}
 								})
							.registryVersion(303)
							.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
							.isFavorite(false).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("Mon Nov 12 22:54:12 UTC 2046"))
						.timeUpdated(new Date("Sun Aug 14 07:02:18 UTC 2044"))
						.aggregatorKey("EXAMPLE-aggregatorKey-Value")
						.identifierPath("EXAMPLE-identifierPath-Value")
						.infoFields(new HashMap<java.lang.String, java.lang.String>() {
								{
									put("EXAMPLE_KEY_4xOjM","EXAMPLE_VALUE_gmDRiL5DGZpr2VA2Tm1d");
								}
 							})
						.registryVersion(233)
						.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
						.isFavorite(false).build()).build())
				.key("EXAMPLE-key-Value")
				.modelVersion("EXAMPLE-modelVersion-Value")
				.name("EXAMPLE-name-Value")
				.description("EXAMPLE-description-Value")
				.objectStatus(520)
				.identifier("EXAMPLE-identifier-Value")
				.externalKey("EXAMPLE-externalKey-Value")
				.assetProperties(new HashMap<java.lang.String, java.lang.String>() {
						{
							put("EXAMPLE_KEY_pfrQw","EXAMPLE_VALUE_zLd0pU4QRr8IjwBmj6jh");
						}
 					})
				.nativeTypeSystem(TypeSystem.builder()
					.key("EXAMPLE-key-Value")
					.modelType("EXAMPLE-modelType-Value")
					.modelVersion("EXAMPLE-modelVersion-Value")
					.parentRef(ParentReference.builder()
						.parent("EXAMPLE-parent-Value").build())
					.name("EXAMPLE-name-Value")
					.description("EXAMPLE-description-Value")
					.objectVersion(949)
					.typeMappingTo(new HashMap<java.lang.String, java.lang.String>() {
							{
								put("EXAMPLE_KEY_KGLFl","EXAMPLE_VALUE_trfbucTcEEy9jF9Id06N");
							}
 						})
					.typeMappingFrom(new HashMap<java.lang.String, java.lang.String>() {
							{
								put("EXAMPLE_KEY_CT4zg","EXAMPLE_VALUE_cXOGPjtcH2YJGq7bIw6a");
							}
 						})
					.objectStatus(763)
					.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").build())
								.name("EXAMPLE-name-Value")
								.isContained(true)
								.objectStatus(346)
								.configParameterDefinitions(new HashMap<java.lang.String, com.oracle.bmc.dataintegration.model.ConfigParameterDefinition>() {
										{
											put("EXAMPLE_KEY_Cv951",ConfigParameterDefinition.builder()
										.parameterType(DynamicType.builder()
											.typeHandler(RuleTypeConfig.builder()
												.key("EXAMPLE-key-Value")
												.modelVersion("EXAMPLE-modelVersion-Value")
												.parentRef(ParentReference.builder()
													.parent("EXAMPLE-parent-Value").build())
												.scope("EXAMPLE-scope-Value")
												.isOrderByRule(false)
												.projectionRules(new ArrayList<>(Arrays.asList(TypeListRule.builder()
														.isSkipRemainingRulesOnMatch(false)
														.scope("EXAMPLE-scope-Value")
														.isCascade(true)
														.matchingStrategy(TypeListRule.MatchingStrategy.TagsOnly)
														.isCaseSensitive(false)
														.ruleType(TypeListRule.RuleType.Exclude)
														.types(new ArrayList<>(Arrays.asList("EXAMPLE-types-Value")))
														.key("EXAMPLE-key-Value")
														.modelVersion("EXAMPLE-modelVersion-Value")
														.parentRef(ParentReference.builder()
															.parent("EXAMPLE-parent-Value").build())
														.isJavaRegexSyntax(false)
														.configValues(ConfigValues.builder()
															.configParamValues(new HashMap<java.lang.String, com.oracle.bmc.dataintegration.model.ConfigParameterValue>() {
																	{
																		put("EXAMPLE_KEY_BfTJt",ConfigParameterValue.builder()
																	.stringValue("EXAMPLE-stringValue-Value")
																	.intValue(647)
																	.refValue("EXAMPLE-refValue-Value")
																	.parameterValue("EXAMPLE-parameterValue-Value").build());
																	}
 																})
															.parentRef(ParentReference.builder()
																.parent("EXAMPLE-parent-Value").build()).build())
														.objectStatus(778)
														.description("EXAMPLE-description-Value").build())))
												.configValues(ConfigValues.builder()
													.configParamValues(new HashMap<java.lang.String, com.oracle.bmc.dataintegration.model.ConfigParameterValue>() {
															{
																put("EXAMPLE_KEY_kqiuW",ConfigParameterValue.builder()
															.stringValue("EXAMPLE-stringValue-Value")
															.intValue(293)
															.refValue("EXAMPLE-refValue-Value")
															.parameterValue("EXAMPLE-parameterValue-Value").build());
															}
 														})
													.parentRef(ParentReference.builder()
														.parent("EXAMPLE-parent-Value").build()).build())
												.objectStatus(419).build())
											.key("EXAMPLE-key-Value")
											.modelVersion("EXAMPLE-modelVersion-Value")
											.parentRef(ParentReference.builder()
												.parent("EXAMPLE-parent-Value").build())
											.name("EXAMPLE-name-Value")
											.objectStatus(506)
											.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").build())
							.name("EXAMPLE-name-Value")
							.objectStatus(124)
							.description("EXAMPLE-description-Value").build()))).build())
				.objectVersion(462)
				.parentRef(ParentReference.builder()
					.parent("EXAMPLE-parent-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 Jan 24 18:35:34 UTC 2003"))
					.timeUpdated(new Date("Fri Jan 19 16:34:12 UTC 2029"))
					.aggregatorKey("EXAMPLE-aggregatorKey-Value")
					.identifierPath("EXAMPLE-identifierPath-Value")
					.infoFields(new HashMap<java.lang.String, java.lang.String>() {
							{
								put("EXAMPLE_KEY_X2KAr","EXAMPLE_VALUE_LpgGodlDEvjZ3dejW7fJ");
							}
 						})
					.registryVersion(238)
					.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
					.isFavorite(true).build())
				.keyMap(new HashMap<java.lang.String, java.lang.String>() {
						{
							put("EXAMPLE_KEY_FqT8n","EXAMPLE_VALUE_Cw6DOhWHXLJBtqHgbbnt");
						}
 					}).build())
			.connection(ConnectionFromObjectStorage.builder()
				.credentialFileContent("EXAMPLE-credentialFileContent-Value")
				.userId("ocid1.test.oc1..<unique_ID>EXAMPLE-userId-Value")
				.fingerPrint("EXAMPLE-fingerPrint-Value")
				.passPhrase("EXAMPLE-passPhrase-Value")
				.key("EXAMPLE-key-Value")
				.modelVersion("EXAMPLE-modelVersion-Value")
				.parentRef(ParentReference.builder()
					.parent("EXAMPLE-parent-Value").build())
				.name("EXAMPLE-name-Value")
				.description("EXAMPLE-description-Value")
				.objectVersion(341)
				.objectStatus(126)
				.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").build())
					.name("EXAMPLE-name-Value")
					.resourceName("EXAMPLE-resourceName-Value")
					.description("EXAMPLE-description-Value")
					.objectVersion(410)
					.externalKey("EXAMPLE-externalKey-Value")
					.isHasContainers(false)
					.defaultConnection("EXAMPLE-defaultConnection-Value")
					.objectStatus(738)
					.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 Aug 25 05:44:27 UTC 2025"))
						.timeUpdated(new Date("Sat Jun 23 18:39:43 UTC 2029"))
						.aggregatorKey("EXAMPLE-aggregatorKey-Value")
						.identifierPath("EXAMPLE-identifierPath-Value")
						.infoFields(new HashMap<java.lang.String, java.lang.String>() {
								{
									put("EXAMPLE_KEY_9HKcx","EXAMPLE_VALUE_R9k7sWA6aFGx0E4ULb9C");
								}
 							})
						.registryVersion(956)
						.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
						.isFavorite(false).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("Tue Jan 18 12:44:39 UTC 2011"))
					.timeUpdated(new Date("Tue Dec 27 21:53:47 UTC 2022"))
					.aggregatorKey("EXAMPLE-aggregatorKey-Value")
					.identifierPath("EXAMPLE-identifierPath-Value")
					.infoFields(new HashMap<java.lang.String, java.lang.String>() {
							{
								put("EXAMPLE_KEY_NSIug","EXAMPLE_VALUE_G7EUNnRh4WAj7f07OL9d");
							}
 						})
					.registryVersion(106)
					.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
					.isFavorite(false).build())
				.keyMap(new HashMap<java.lang.String, java.lang.String>() {
						{
							put("EXAMPLE_KEY_wAmZw","EXAMPLE_VALUE_jWKV0IL4gyRtnEDS2z2W");
						}
 					}).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").build())
				.name("EXAMPLE-name-Value")
				.resourceName("EXAMPLE-resourceName-Value")
				.description("EXAMPLE-description-Value")
				.objectVersion(928)
				.externalKey("EXAMPLE-externalKey-Value")
				.isHasContainers(true)
				.defaultConnection("EXAMPLE-defaultConnection-Value")
				.objectStatus(601)
				.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("Sun May 14 05:44:22 UTC 2028"))
					.timeUpdated(new Date("Wed Jul 10 00:13:31 UTC 2013"))
					.aggregatorKey("EXAMPLE-aggregatorKey-Value")
					.identifierPath("EXAMPLE-identifierPath-Value")
					.infoFields(new HashMap<java.lang.String, java.lang.String>() {
							{
								put("EXAMPLE_KEY_82TPc","EXAMPLE_VALUE_CpbAmfvL103oCGlgenH8");
							}
 						})
					.registryVersion(876)
					.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
					.isFavorite(false).build()).build()).build()).build();

	CreateExternalPublicationRequest createExternalPublicationRequest = CreateExternalPublicationRequest.builder()
		.workspaceId("ocid1.test.oc1..<unique_ID>EXAMPLE-workspaceId-Value")
		.taskKey("EXAMPLE-taskKey-Value")
		.createExternalPublicationDetails(createExternalPublicationDetails)
		.opcRequestId("AUD3QIAWAONYDFKJEJP6/OpcRequestIdExample/<unique_ID>")
		.opcRetryToken("EXAMPLE-opcRetryToken-Value").build();

        /* Send request to the Client */
        CreateExternalPublicationResponse response = client.createExternalPublication(createExternalPublicationRequest);
    }

    
}