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

        /* Create a request and dependent object(s). */
	SearchMonitoredResourcesDetails searchMonitoredResourcesDetails = SearchMonitoredResourcesDetails.builder()
		.compartmentId("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value")
		.compartmentIds(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
		.lifecycleStates(new ArrayList<>(Arrays.asList(ResourceLifecycleState.Creating,ResourceLifecycleState.Updating,ResourceLifecycleState.Active,ResourceLifecycleState.Deleting,ResourceLifecycleState.Deleted,ResourceLifecycleState.Failed)))
		.sourceType(SourceType.Collectd)
		.resourceCategory(ResourceCategory.Application)
		.name("EXAMPLE-name-Value")
		.nameContains("EXAMPLE-nameContains-Value")
		.type("EXAMPLE-type-Value")
		.hostName("EXAMPLE-hostName-Value")
		.externalId("ocid1.test.oc1..<unique_ID>EXAMPLE-externalId-Value")
		.hostNameContains("EXAMPLE-hostNameContains-Value")
		.managementAgentId("ocid1.test.oc1..<unique_ID>EXAMPLE-managementAgentId-Value")
		.lifecycleState(ResourceLifecycleState.Active)
		.license(LicenseType.EnterpriseEdition)
		.timeCreatedGreaterThanOrEqualTo(new Date("Wed Sep 20 22:07:48 UTC 2006"))
		.timeCreatedLessThan(new Date("Sat Feb 20 20:31:39 UTC 2016"))
		.timeUpdatedGreaterThanOrEqualTo(new Date("Thu Oct 10 00:51:46 UTC 2030"))
		.timeUpdatedLessThan(new Date("Sat Jun 27 02:50:15 UTC 2009"))
		.resourceTimeZone("EXAMPLE-resourceTimeZone-Value")
		.sortOrder(SortOrder.Desc)
		.sortBy(SearchMonitoredResourcesDetails.SortBy.TimeCreated)
		.propertyEquals(new HashMap<java.lang.String, java.lang.String>() {
				{
					put("EXAMPLE_KEY_Eb1DX","EXAMPLE_VALUE_LCS3vHOL4RFAa2L0uBk3");
				}
 			}).build();

	SearchMonitoredResourcesRequest searchMonitoredResourcesRequest = SearchMonitoredResourcesRequest.builder()
		.searchMonitoredResourcesDetails(searchMonitoredResourcesDetails)
		.limit(345)
		.page("EXAMPLE-page-Value")
		.fields(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
		.excludeFields(new ArrayList<>(Arrays.asList("EXAMPLE--Value")))
		.opcRequestId("SJFZQQZE24VCVDIUJCWF<unique_ID>")
		.opcRetryToken("EXAMPLE-opcRetryToken-Value")
		.ifMatch("EXAMPLE-ifMatch-Value").build();

        /* Send request to the Client */
        SearchMonitoredResourcesResponse response = client.searchMonitoredResources(searchMonitoredResourcesRequest);
    }

    
}