/** 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.dataconnectivity.DataConnectivityManagementClient;
import com.oracle.bmc.dataconnectivity.model.*;
import com.oracle.bmc.dataconnectivity.requests.*;
import com.oracle.bmc.dataconnectivity.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 UpdateConnectionExample {
    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 */
        DataConnectivityManagementClient client = new DataConnectivityManagementClient(provider);

        /* Create a request and dependent object(s). */
	UpdateConnectionDetails updateConnectionDetails = UpdateConnectionDetails.builder()
		.modelVersion("EXAMPLE-modelVersion-Value")
		.modelType("EXAMPLE-modelType-Value")
		.name("EXAMPLE-name-Value")
		.description("EXAMPLE-description-Value")
		.objectVersion(589)
		.objectStatus(47)
		.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(445)
			.externalKey("EXAMPLE-externalKey-Value")
			.isHasContainers(true)
			.defaultConnection("EXAMPLE-defaultConnection-Value")
			.objectStatus(77)
			.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("Fri Oct 27 16:15:20 UTC 2006"))
				.timeUpdated(new Date("Mon Jun 27 20:47:35 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_bMmaN","EXAMPLE_VALUE_8HRURP8IMU04wODc2Xy4");
						}
 					})
				.registryVersion(196)
				.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
				.isFavorite(true).build()).build())
		.connectionProperties(new ArrayList<>(Arrays.asList(ConnectionProperty.builder()
				.name("EXAMPLE-name-Value")
				.value("EXAMPLE-value-Value").build())))
		.properties(new HashMap<java.lang.String, java.lang.Object>() {
				{
					put("EXAMPLE_KEY_HUrWX","EXAMPLE--Value");
				}
 			})
		.type("EXAMPLE-type-Value")
		.isDefault(true)
		.metadata(ObjectMetadata.builder()
			.createdBy("EXAMPLE-createdBy-Value")
			.createdByName("EXAMPLE-createdByName-Value")
			.updatedBy("EXAMPLE-updatedBy-Value")
			.updatedByName("EXAMPLE-updatedByName-Value")
			.timeCreated(new Date("Wed Jun 10 19:53:42 UTC 2037"))
			.timeUpdated(new Date("Sat Feb 25 22:15:13 UTC 2006"))
			.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_lRVMt","EXAMPLE_VALUE_Wkxqh0aufEmPVq0gphBA");
					}
 				})
			.registryVersion(682)
			.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
			.isFavorite(true).build())
		.registryMetadata(RegistryMetadata.builder()
			.aggregatorKey("EXAMPLE-aggregatorKey-Value")
			.labels(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
			.registryVersion(270)
			.key("EXAMPLE-key-Value")
			.isFavorite(true)
			.createdByUserId("ocid1.test.oc1..<unique_ID>EXAMPLE-createdByUserId-Value")
			.createdByUserName("EXAMPLE-createdByUserName-Value")
			.updatedByUserId("ocid1.test.oc1..<unique_ID>EXAMPLE-updatedByUserId-Value")
			.updatedByUserName("EXAMPLE-updatedByUserName-Value")
			.timeCreated(new Date("Tue Jun 18 15:45:36 UTC 2041"))
			.timeUpdated(new Date("Sat Apr 28 12:54:50 UTC 2046")).build()).build();

	UpdateConnectionRequest updateConnectionRequest = UpdateConnectionRequest.builder()
		.registryId("ocid1.test.oc1..<unique_ID>EXAMPLE-registryId-Value")
		.connectionKey("EXAMPLE-connectionKey-Value")
		.updateConnectionDetails(updateConnectionDetails)
		.opcRequestId("PVUGYACFBVBO0LKVSUAJ<unique_ID>")
		.ifMatch("EXAMPLE-ifMatch-Value").build();

        /* Send request to the Client */
        UpdateConnectionResponse response = client.updateConnection(updateConnectionRequest);
    }

    
}