/** 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(385).build())
		.configurationDetails(ConfigurationDetails.builder()
			.dataAsset(DataAssetFromLakeDetails.builder()
				.lakeId("ocid1.test.oc1..<unique_ID>EXAMPLE-lakeId-Value")
				.metastoreId("ocid1.test.oc1..<unique_ID>EXAMPLE-metastoreId-Value")
				.lakeProxyEndpoint("EXAMPLE-lakeProxyEndpoint-Value")
				.defaultConnection(ConnectionFromLakeDetails.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")
					.description("EXAMPLE-description-Value")
					.objectVersion(561)
					.objectStatus(224)
					.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(868)
						.externalKey("EXAMPLE-externalKey-Value")
						.isHasContainers(false)
						.defaultConnection("EXAMPLE-defaultConnection-Value")
						.objectStatus(270)
						.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 Aug 27 23:38:40 UTC 2045"))
							.timeUpdated(new Date("Sat Mar 24 12:38:31 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_2gLfR","EXAMPLE_VALUE_Ui5SvOe5DFkfNIG1lhPG");
									}
 								})
							.registryVersion(708)
							.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
							.isFavorite(false)
							.countStatistics(CountStatistic.builder()
								.objectTypeCountList(new ArrayList<>(Arrays.asList(CountStatisticSummary.builder()
										.objectType(CountStatisticSummary.ObjectType.Folder)
										.objectCount(888L).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("Mon Aug 02 19:44:01 UTC 2049"))
						.timeUpdated(new Date("Wed Jan 09 09:03:01 UTC 2036"))
						.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_M8HX4","EXAMPLE_VALUE_JWEzOYn00twQJlj477Rh");
								}
 							})
						.registryVersion(868)
						.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
						.isFavorite(false)
						.countStatistics(CountStatistic.builder()
							.objectTypeCountList(new ArrayList<>(Arrays.asList(CountStatisticSummary.builder()
									.objectType(CountStatisticSummary.ObjectType.FunctionLibrary)
									.objectCount(567L).build()))).build()).build()).build())
				.key("EXAMPLE-key-Value")
				.modelVersion("EXAMPLE-modelVersion-Value")
				.name("EXAMPLE-name-Value")
				.description("EXAMPLE-description-Value")
				.objectStatus(399)
				.identifier("EXAMPLE-identifier-Value")
				.externalKey("EXAMPLE-externalKey-Value")
				.assetProperties(new HashMap<java.lang.String, java.lang.String>() {
						{
							put("EXAMPLE_KEY_1ogaP","EXAMPLE_VALUE_ClhRJcskNobq4ut85guE");
						}
 					})
				.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(780)
					.typeMappingTo(new HashMap<java.lang.String, java.lang.String>() {
							{
								put("EXAMPLE_KEY_JpsFo","EXAMPLE_VALUE_j8o4h0PRKrup8Dm7CdYn");
							}
 						})
					.typeMappingFrom(new HashMap<java.lang.String, java.lang.String>() {
							{
								put("EXAMPLE_KEY_B8YlJ","EXAMPLE_VALUE_eV0mqo9ksYMBO4Aqv1qr");
							}
 						})
					.objectStatus(944)
					.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(397)
								.configParameterDefinitions(new HashMap<java.lang.String, com.oracle.bmc.dataintegration.model.ConfigParameterDefinition>() {
										{
											put("EXAMPLE_KEY_QuhrE",ConfigParameterDefinition.builder()
										.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(534)
							.description("EXAMPLE-description-Value").build()))).build())
				.objectVersion(816)
				.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 Apr 03 19:06:25 UTC 2026"))
					.timeUpdated(new Date("Sat Nov 21 22:08:08 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_YJbnt","EXAMPLE_VALUE_LbDo2avBQYJywkQsti2C");
							}
 						})
					.registryVersion(515)
					.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
					.isFavorite(false)
					.countStatistics(CountStatistic.builder()
						.objectTypeCountList(new ArrayList<>(Arrays.asList(CountStatisticSummary.builder()
								.objectType(CountStatisticSummary.ObjectType.Connection)
								.objectCount(931L).build()))).build()).build())
				.keyMap(new HashMap<java.lang.String, java.lang.String>() {
						{
							put("EXAMPLE_KEY_PpzLp","EXAMPLE_VALUE_LbsRAWO6hzWZCebyBeV5");
						}
 					}).build())
			.connection(ConnectionFromAmazonS3.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(587)
				.objectStatus(617)
				.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(134)
					.externalKey("EXAMPLE-externalKey-Value")
					.isHasContainers(true)
					.defaultConnection("EXAMPLE-defaultConnection-Value")
					.objectStatus(624)
					.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 Oct 03 20:05:13 UTC 2018"))
						.timeUpdated(new Date("Thu Jan 30 10:21:40 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_ZWr7l","EXAMPLE_VALUE_MKhiKVPd5soszfkk9ous");
								}
 							})
						.registryVersion(690)
						.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
						.isFavorite(true)
						.countStatistics(CountStatistic.builder()
							.objectTypeCountList(new ArrayList<>(Arrays.asList(CountStatisticSummary.builder()
									.objectType(CountStatisticSummary.ObjectType.FunctionLibrary)
									.objectCount(658L).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("Mon Oct 26 22:44:04 UTC 2015"))
					.timeUpdated(new Date("Wed Sep 24 00:36:12 UTC 2003"))
					.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_08u1f","EXAMPLE_VALUE_f4GMD6jAkYyI1yRdL0nA");
							}
 						})
					.registryVersion(501)
					.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
					.isFavorite(false)
					.countStatistics(CountStatistic.builder()
						.objectTypeCountList(new ArrayList<>(Arrays.asList(CountStatisticSummary.builder()
								.objectType(CountStatisticSummary.ObjectType.Folder)
								.objectCount(19L).build()))).build()).build())
				.keyMap(new HashMap<java.lang.String, java.lang.String>() {
						{
							put("EXAMPLE_KEY_7iCp2","EXAMPLE_VALUE_NsPeCVBCoXUgSgHq7LWR");
						}
 					}).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(545)
				.externalKey("EXAMPLE-externalKey-Value")
				.isHasContainers(true)
				.defaultConnection("EXAMPLE-defaultConnection-Value")
				.objectStatus(90)
				.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 Aug 21 01:54:14 UTC 2031"))
					.timeUpdated(new Date("Sun Dec 01 09:15:49 UTC 2024"))
					.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_DrKaW","EXAMPLE_VALUE_crj6bvi9ICS5dlyj173Z");
							}
 						})
					.registryVersion(491)
					.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
					.isFavorite(false)
					.countStatistics(CountStatistic.builder()
						.objectTypeCountList(new ArrayList<>(Arrays.asList(CountStatisticSummary.builder()
								.objectType(CountStatisticSummary.ObjectType.Project)
								.objectCount(774L).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("SCQFGVFXAE4U4FESRDAF<unique_ID>")
		.opcRetryToken("EXAMPLE-opcRetryToken-Value").build();

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

    
}