Skip to content

list_views async

list_views(
    *,
    config_overrides: Optional[AsyncCloudWatchOmniClientConfig] = None,
    type: Optional[ViewType] = None,
    max_results: Optional[int] = None,
    next_token: Optional[str] = None,
) -> ListViewsResponse

Lists the views in the caller's account and region. Returns a summary for each view, optionally filtered by view type. View definitions are not included — use GetView to retrieve them.

Parameters:

  • type (Optional[ViewType], default: None ) –

    Return only views of this ownership category.

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

    The maximum number of views to return per page.

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

    A token to retrieve the next page of results.

Raises:

Examples:

List the views in an account and Region The following example returns a page of view summaries, filtered to user-created views. Definitions are not included — call GetView to retrieve them. A nextToken is returned when more results are available. Payloads are shown as JSON; on the wire they are CBOR-encoded.

>>> await client.list_views(type='USER', max_results=10)
Source code in docs_src/capo_cloudwatchomni/_services/async_cloud_watch_omni.py
async def list_views(
    self,
    *,
    config_overrides: Optional[AsyncCloudWatchOmniClientConfig] = None,
    type: Optional["capo_cloudwatchomni.types.view_type.ViewType"] = None,
    max_results: Optional[int] = None,
    next_token: Optional[str] = None,
) -> "capo_cloudwatchomni.types.list_views_response.ListViewsResponse":
    """Lists the views in the caller's account and region. Returns a summary for each view, optionally filtered by view type. View definitions are not included — use GetView to retrieve them.

    Args:
        type: Return only views of this ownership category.
        max_results: The maximum number of views to return per page.
        next_token: A token to retrieve the next page of results.

    Raises:
        capo_cloudwatchomni.errors.internal_server_exception.InternalServerException: An unexpected error occurred while processing the request.
        capo_cloudwatchomni.errors.throttling_exception.ThrottlingException: The request was throttled due to exceeding the allowed request rate.
        capo_cloudwatchomni.errors.validation_exception.ValidationException: A parameter is specified incorrectly.
        capo_cloudwatchomni.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        List the views in an account and Region
        The following example returns a page of view summaries, filtered to user-created views. Definitions are not included — call GetView to retrieve them. A nextToken is returned when more results are available. Payloads are shown as JSON; on the wire they are CBOR-encoded.

        >>> await client.list_views(type='USER', max_results=10)
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cloudwatchomni.types.list_views_request.ListViewsRequest]",
    ) -> AsyncOperationResponse[
        "capo_cloudwatchomni.types.list_views_response.ListViewsResponse"
    ]:
        import capo_cloudwatchomni._operations.cloud_watch_omni_frontend.list_views

        (
            output,
            http_response,
        ) = await capo_cloudwatchomni._operations.cloud_watch_omni_frontend.list_views.async_list_views(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListViews")
    )
    input_: capo_cloudwatchomni.types.list_views_request.ListViewsRequest = {}
    if type is not None:
        input_["type"] = type
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output