Skip to content

list_spaces

list_spaces(
    *,
    config_overrides: Optional[CloudWatchOmniClientConfig] = None,
    domain_id: Optional[DomainId] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[int] = None,
) -> ListSpacesOutput

Returns the spaces in the account, optionally filtered by domain.

Parameters:

  • domain_id (Optional[DomainId], default: None ) –

    Filter by domain ID.

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

    A token to retrieve the next page of results. Supply the same filters used on the request that returned it. Tokens expire after 24 hours.

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

    The maximum number of spaces to return per page. Defaults to 100. A page can contain fewer results than this value even when more results remain; continue while nextToken is present.

Raises:

Examples:

List spaces in a domain The following example lists the first page of spaces in a domain and returns a nextToken to retrieve the next page. Payloads are shown as JSON; on the wire they are CBOR-encoded.

>>> client.list_spaces(domain_id='d-1a2b3c4d5e', max_results=50)
Source code in docs_src/capo_cloudwatchomni/_services/cloud_watch_omni.py
def list_spaces(
    self,
    *,
    config_overrides: Optional[CloudWatchOmniClientConfig] = None,
    domain_id: Optional["capo_cloudwatchomni.types.domain_id.DomainId"] = None,
    next_token: Optional["capo_cloudwatchomni.types.next_token.NextToken"] = None,
    max_results: Optional[int] = None,
) -> "capo_cloudwatchomni.types.list_spaces_output.ListSpacesOutput":
    """Returns the spaces in the account, optionally filtered by domain.

    Args:
        domain_id: Filter by domain ID.
        next_token: A token to retrieve the next page of results. Supply the same filters used on the request that returned it. Tokens expire after 24 hours.
        max_results: The maximum number of spaces to return per page. Defaults to 100. A page can contain fewer results than this value even when more results remain; continue while nextToken is present.

    Raises:
        capo_cloudwatchomni.errors.access_denied_exception.AccessDeniedException: The caller is not authorized to perform this action.
        capo_cloudwatchomni.errors.internal_server_exception.InternalServerException: An unexpected error occurred while processing the request.
        capo_cloudwatchomni.errors.resource_not_found_exception.ResourceNotFoundException: The specified resource does not exist.
        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 spaces in a domain
        The following example lists the first page of spaces in a domain and returns a nextToken to retrieve the next page. Payloads are shown as JSON; on the wire they are CBOR-encoded.

        >>> client.list_spaces(domain_id='d-1a2b3c4d5e', max_results=50)
    """

    def _handler(
        req: "OperationRequest[capo_cloudwatchomni.types.list_spaces_input.ListSpacesInput]",
    ) -> OperationResponse[
        "capo_cloudwatchomni.types.list_spaces_output.ListSpacesOutput"
    ]:
        import capo_cloudwatchomni._operations.cloud_watch_omni_frontend.list_spaces

        output, http_response = (
            capo_cloudwatchomni._operations.cloud_watch_omni_frontend.list_spaces.list_spaces(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListSpaces")
    )
    input_: capo_cloudwatchomni.types.list_spaces_input.ListSpacesInput = {}
    if domain_id is not None:
        input_["domain_id"] = domain_id
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results

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