Skip to content

list_monitors

list_monitors(
    *,
    config_overrides: Optional[NetworkMonitorClientConfig] = None,
    next_token: Optional[PaginationToken] = None,
    max_results: Optional[MaxResults] = None,
    state: Optional[str] = None,
) -> ListMonitorsOutput

Returns a list of all of your monitors.

Parameters:

  • next_token (Optional[PaginationToken], default: None ) –

    The token for the next page of results.

  • max_results (Optional[MaxResults], default: None ) –

    The maximum number of results to return with a single call. To retrieve the remaining results, make another call with the returned nextToken value.

    If MaxResults is given a value larger than 100, only 100 results are returned.

  • state (Optional[str], default: None ) –

    The list of all monitors and their states.

Raises:

Source code in docs_src/capo_networkmonitor/_services/network_monitor.py
def list_monitors(
    self,
    *,
    config_overrides: Optional[NetworkMonitorClientConfig] = None,
    next_token: Optional[
        "capo_networkmonitor.types.pagination_token.PaginationToken"
    ] = None,
    max_results: Optional[
        "capo_networkmonitor.types.max_results.MaxResults"
    ] = None,
    state: Optional[str] = None,
) -> "capo_networkmonitor.types.list_monitors_output.ListMonitorsOutput":
    """<p>Returns a list of all of your monitors.</p>

    Args:
        next_token: <p>The token for the next page of results.</p>
        max_results: <p>The maximum number of results to return with a single call. To retrieve the remaining results, make another call with the returned <code>nextToken</code> value.</p> <p>If <code>MaxResults</code> is given a value larger than 100, only 100 results are returned.</p>
        state: <p>The list of all monitors and their states.</p>

    Raises:
        capo_networkmonitor.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_networkmonitor.errors.internal_server_exception.InternalServerException: <p>The request processing has failed because of an unknown error, exception or failure.</p>
        capo_networkmonitor.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling</p>
        capo_networkmonitor.errors.validation_exception.ValidationException: <p>One of the parameters for the request is not valid.</p>
        capo_networkmonitor.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_networkmonitor.types.list_monitors_input.ListMonitorsInput]",
    ) -> OperationResponse[
        "capo_networkmonitor.types.list_monitors_output.ListMonitorsOutput"
    ]:
        import capo_networkmonitor._operations.network_monitor.list_monitors

        output, http_response = (
            capo_networkmonitor._operations.network_monitor.list_monitors.list_monitors(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListMonitors")
    )
    input_: capo_networkmonitor.types.list_monitors_input.ListMonitorsInput = {}
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if state is not None:
        input_["state"] = state

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output