Skip to content

list_dashboards

list_dashboards(
    *,
    config_overrides: Optional[CloudWatchClientConfig] = None,
    dashboard_name_prefix: Optional[DashboardNamePrefix] = None,
    next_token: Optional[NextToken] = None,
) -> ListDashboardsOutput

Returns a list of the dashboards for your account. If you include DashboardNamePrefix, only those dashboards with names starting with the prefix are listed. Otherwise, all dashboards in your account are listed.

ListDashboards returns up to 1000 results on one page. If there are more than 1000 dashboards, you can call ListDashboards again and include the value you received for NextToken in the first call, to receive the next 1000 results.

You might have recently enabled an opt-in Region (Region that is disabled by default) for your account. In that Region, ListDashboards can return an access denied error for up to 24 hours after you enable the Region. This delay occurs while dashboard data propagates. The error does not indicate a problem with your permissions. Because dashboards are global, you can call ListDashboards in any other enabled Region, or retry after propagation completes.

Parameters:

  • dashboard_name_prefix (Optional[DashboardNamePrefix], default: None ) –

    If you specify this parameter, only the dashboards with names starting with the specified string are listed. The maximum length is 255, and valid characters are A-Z, a-z, 0-9, ".", "-", and "_".

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

    The token returned by a previous call to indicate that there is more data available.

Raises:

Source code in docs_src/capo_cloudwatch/_services/cloud_watch.py
def list_dashboards(
    self,
    *,
    config_overrides: Optional[CloudWatchClientConfig] = None,
    dashboard_name_prefix: Optional[
        "capo_cloudwatch.types.dashboard_name_prefix.DashboardNamePrefix"
    ] = None,
    next_token: Optional["capo_cloudwatch.types.next_token.NextToken"] = None,
) -> "capo_cloudwatch.types.list_dashboards_output.ListDashboardsOutput":
    """<p>Returns a list of the dashboards for your account. If you include <code>DashboardNamePrefix</code>, only those dashboards with names starting with the prefix are listed. Otherwise, all dashboards in your account are listed. </p> <p> <code>ListDashboards</code> returns up to 1000 results on one page. If there are more than 1000 dashboards, you can call <code>ListDashboards</code> again and include the value you received for <code>NextToken</code> in the first call, to receive the next 1000 results.</p> <p>You might have recently enabled an <a href="https://docs.aws.amazon.com/glossary/latest/reference/glos-chap.html#optinregion">opt-in Region (Region that is disabled by default)</a> for your account. In that Region, <code>ListDashboards</code> can return an access denied error for up to 24 hours after you enable the Region. This delay occurs while dashboard data propagates. The error does not indicate a problem with your permissions. Because dashboards are global, you can call <code>ListDashboards</code> in any other enabled Region, or retry after propagation completes.</p>

    Args:
        dashboard_name_prefix: <p>If you specify this parameter, only the dashboards with names starting with the specified string are listed. The maximum length is 255, and valid characters are A-Z, a-z, 0-9, ".", "-", and "_". </p>
        next_token: <p>The token returned by a previous call to indicate that there is more data available.</p>

    Raises:
        capo_cloudwatch.errors.internal_service_fault.InternalServiceFault: <p>Request processing has failed due to some unknown error, exception, or failure.</p>
        capo_cloudwatch.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>The value of an input parameter is bad or out-of-range.</p>
        capo_cloudwatch.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cloudwatch.types.list_dashboards_input.ListDashboardsInput]",
    ) -> OperationResponse[
        "capo_cloudwatch.types.list_dashboards_output.ListDashboardsOutput"
    ]:
        import capo_cloudwatch._operations.granite_service_version20100801.list_dashboards

        output, http_response = (
            capo_cloudwatch._operations.granite_service_version20100801.list_dashboards.list_dashboards(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListDashboards")
    )
    input_: capo_cloudwatch.types.list_dashboards_input.ListDashboardsInput = {}
    if dashboard_name_prefix is not None:
        input_["dashboard_name_prefix"] = dashboard_name_prefix
    if next_token is not None:
        input_["next_token"] = next_token

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