/** 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.apmsynthetics.ApmSyntheticClient;
import com.oracle.bmc.apmsynthetics.model.*;
import com.oracle.bmc.apmsynthetics.requests.*;
import com.oracle.bmc.apmsynthetics.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 UpdateMonitorExample {
    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 */
        ApmSyntheticClient client = ApmSyntheticClient.builder().build(provider);

        /* Create a request and dependent object(s). */
	UpdateMonitorDetails updateMonitorDetails = UpdateMonitorDetails.builder()
		.displayName("EXAMPLE-displayName-Value")
		.vantagePoints(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
		.scriptId("ocid1.test.oc1..<unique_ID>EXAMPLE-scriptId-Value")
		.status(MonitorStatus.Disabled)
		.repeatIntervalInSeconds(152)
		.isRunOnce(true)
		.timeoutInSeconds(314)
		.target("EXAMPLE-target-Value")
		.scriptParameters(new ArrayList<>(Arrays.asList(MonitorScriptParameter.builder()
				.paramName("EXAMPLE-paramName-Value")
				.paramValue("EXAMPLE-paramValue-Value").build())))
		.configuration(RestMonitorConfiguration.builder()
			.isRedirectionEnabled(false)
			.isCertificateValidationEnabled(true)
			.requestMethod(RequestMethods.Post)
			.reqAuthenticationScheme(RequestAuthenticationSchemes.Oauth)
			.reqAuthenticationDetails(RequestAuthenticationDetails.builder()
				.oauthScheme(OAuthSchemes.Basic)
				.authUserName("EXAMPLE-authUserName-Value")
				.authUserPassword("EXAMPLE-authUserPassword-Value")
				.authToken("EXAMPLE-authToken-Value")
				.authUrl("EXAMPLE-authUrl-Value")
				.authHeaders(new ArrayList<>(Arrays.asList(Header.builder()
						.headerName("EXAMPLE-headerName-Value")
						.headerValue("EXAMPLE-headerValue-Value").build())))
				.authRequestMethod(RequestMethods.Post)
				.authRequestPostBody("EXAMPLE-authRequestPostBody-Value").build())
			.clientCertificateDetails(ClientCertificateDetails.builder()
				.clientCertificate(ClientCertificate.builder()
					.fileName("EXAMPLE-fileName-Value")
					.content("EXAMPLE-content-Value").build())
				.privateKey(PrivateKey.builder()
					.fileName("EXAMPLE-fileName-Value")
					.content("EXAMPLE-content-Value").build()).build())
			.requestHeaders(new ArrayList<>(Arrays.asList(Header.builder()
					.headerName("EXAMPLE-headerName-Value")
					.headerValue("EXAMPLE-headerValue-Value").build())))
			.requestQueryParams(new ArrayList<>(Arrays.asList(RequestQueryParam.builder()
					.paramName("EXAMPLE-paramName-Value")
					.paramValue("EXAMPLE-paramValue-Value").build())))
			.requestPostBody("EXAMPLE-requestPostBody-Value")
			.verifyResponseContent("EXAMPLE-verifyResponseContent-Value")
			.verifyResponseCodes(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
			.networkConfiguration(NetworkConfiguration.builder()
				.numberOfHops(195)
				.probePerHop(1)
				.transmissionRate(89)
				.protocol(Protocol.Tcp)
				.probeMode(ProbeMode.Sack).build())
			.isFailureRetried(false)
			.dnsConfiguration(DnsConfiguration.builder()
				.isOverrideDns(true)
				.overrideDnsIp("EXAMPLE-overrideDnsIp-Value").build()).build())
		.availabilityConfiguration(AvailabilityConfiguration.builder()
			.maxAllowedFailuresPerInterval(718)
			.minAllowedRunsPerInterval(26).build())
		.maintenanceWindowSchedule(MaintenanceWindowSchedule.builder()
			.timeStarted(new Date("Fri Nov 07 10:56:38 UTC 2008"))
			.timeEnded(new Date("Tue Feb 08 12:22:15 UTC 2005")).build())
		.freeformTags(new HashMap<java.lang.String, java.lang.String>() {
				{
					put("EXAMPLE_KEY_tHYZB","EXAMPLE_VALUE_tFPLsrUHJ6pZIWPvaX5H");
				}
 			})
		.definedTags(new HashMap<java.lang.String, java.util.Map<java.lang.String, java.lang.Object>>() {
				{
					put("EXAMPLE_KEY_1aRJx",new HashMap<java.lang.String, java.lang.Object>() {
					{
						put("EXAMPLE_KEY_Y4TMJ","EXAMPLE--Value");
					}
 				});
				}
 			})
		.isRunNow(false)
		.schedulingPolicy(SchedulingPolicy.BatchedRoundRobin)
		.batchIntervalInSeconds(142)
		.isIPv6(true).build();

	UpdateMonitorRequest updateMonitorRequest = UpdateMonitorRequest.builder()
		.apmDomainId("ocid1.test.oc1..<unique_ID>EXAMPLE-apmDomainId-Value")
		.monitorId("ocid1.test.oc1..<unique_ID>EXAMPLE-monitorId-Value")
		.updateMonitorDetails(updateMonitorDetails)
		.ifMatch("EXAMPLE-ifMatch-Value")
		.opcRequestId("8A9XOETZ7WGJFATZSFPM<unique_ID>").build();

        /* Send request to the Client */
        UpdateMonitorResponse response = client.updateMonitor(updateMonitorRequest);
    }

    
}