/** 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.SmMgmtAgentMonitored)
		.resourceCategory(ResourceCategory.Unknown)
		.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.Deleting)
		.license(LicenseType.EnterpriseEdition)
		.timeCreatedGreaterThanOrEqualTo(new Date("Fri Jul 03 08:29:28 UTC 2020"))
		.timeCreatedLessThan(new Date("Wed Apr 07 05:21:51 UTC 2010"))
		.timeUpdatedGreaterThanOrEqualTo(new Date("Fri Oct 27 17:16:04 UTC 2006"))
		.timeUpdatedLessThan(new Date("Thu Feb 09 14:21:00 UTC 2017"))
		.resourceTimeZone("EXAMPLE-resourceTimeZone-Value")
		.sortOrder(SortOrder.Asc)
		.sortBy(SearchMonitoredResourcesDetails.SortBy.TimeCreated)
		.propertyEquals(new HashMap<java.lang.String, java.lang.String>() {
				{
					put("EXAMPLE_KEY_bgbBm","EXAMPLE_VALUE_CLzuklRtCQp9vxOJvvKV");
				}
 			}).build();

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

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

    
}