# 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 oci
from datetime import datetime

# Create a default config using DEFAULT profile in default location
# Refer to
# https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File
# for more info
config = oci.config.from_file()


# Initialize service client with default config file
stack_monitoring_client = oci.stack_monitoring.StackMonitoringClient(config)


# Send the request to service, some parameters are not required, see API
# doc for more info
search_monitored_resources_response = stack_monitoring_client.search_monitored_resources(
    search_monitored_resources_details=oci.stack_monitoring.models.SearchMonitoredResourcesDetails(
        compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
        compartment_ids=["EXAMPLE--Value"],
        lifecycle_states=[
            "CREATING",
            "UPDATING",
            "ACTIVE",
            "DELETING",
            "DELETED",
            "FAILED"],
        source_type="SM_MGMT_AGENT_MONITORED",
        resource_category="UNKNOWN",
        name="EXAMPLE-name-Value",
        name_contains="EXAMPLE-nameContains-Value",
        type="EXAMPLE-type-Value",
        host_name="EXAMPLE-hostName-Value",
        external_id="ocid1.test.oc1..<unique_ID>EXAMPLE-externalId-Value",
        host_name_contains="EXAMPLE-hostNameContains-Value",
        management_agent_id="ocid1.test.oc1..<unique_ID>EXAMPLE-managementAgentId-Value",
        lifecycle_state="DELETING",
        license="ENTERPRISE_EDITION",
        time_created_greater_than_or_equal_to=datetime.strptime(
                "2020-07-03T08:29:28.643Z",
                "%Y-%m-%dT%H:%M:%S.%fZ"),
        time_created_less_than=datetime.strptime(
            "2010-04-07T05:21:51.789Z",
            "%Y-%m-%dT%H:%M:%S.%fZ"),
        time_updated_greater_than_or_equal_to=datetime.strptime(
            "2006-10-27T17:16:04.792Z",
            "%Y-%m-%dT%H:%M:%S.%fZ"),
        time_updated_less_than=datetime.strptime(
            "2017-02-09T14:21:00.929Z",
            "%Y-%m-%dT%H:%M:%S.%fZ"),
        resource_time_zone="EXAMPLE-resourceTimeZone-Value",
        sort_order="ASC",
        sort_by="TIME_CREATED",
        property_equals={
            'EXAMPLE_KEY_bgbBm': 'EXAMPLE_VALUE_CLzuklRtCQp9vxOJvvKV'}),
    limit=674,
    page="EXAMPLE-page-Value",
    fields=["EXAMPLE--Value"],
    exclude_fields=["EXAMPLE--Value"],
    opc_request_id="CATYNY9RH49XCSBMWEPM<unique_ID>",
    opc_retry_token="EXAMPLE-opcRetryToken-Value",
    if_match="EXAMPLE-ifMatch-Value")

# Get the data from response
print(search_monitored_resources_response.data)