Skip to content

list_spaces_for_organization

list_spaces_for_organization(
    *,
    config_overrides: Optional[CloudWatchOmniClientConfig] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[int] = None,
) -> ListSpacesForOrganizationOutput

Returns the spaces across all member accounts in the organization.

Parameters:

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

    A token to retrieve the next page of results. Tokens expire after 24 hours.

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

    The maximum number of spaces to return per page. Defaults to 100.

Raises:

Examples:

List spaces across the organization The following example lists the first page of spaces across all member accounts in the organization. The results include spaces owned by different accounts, along with a nextToken to retrieve the next page. Payloads are shown as JSON; on the wire they are CBOR-encoded.

>>> client.list_spaces_for_organization(max_results=50)
Source code in docs_src/capo_cloudwatchomni/_services/cloud_watch_omni.py
def list_spaces_for_organization(
    self,
    *,
    config_overrides: Optional[CloudWatchOmniClientConfig] = None,
    next_token: Optional["capo_cloudwatchomni.types.next_token.NextToken"] = None,
    max_results: Optional[int] = None,
) -> "capo_cloudwatchomni.types.list_spaces_for_organization_output.ListSpacesForOrganizationOutput":
    """Returns the spaces across all member accounts in the organization.

    Args:
        next_token: A token to retrieve the next page of results. Tokens expire after 24 hours.
        max_results: The maximum number of spaces to return per page. Defaults to 100.

    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 across the organization
        The following example lists the first page of spaces across all member accounts in the organization. The results include spaces owned by different accounts, along with a nextToken to retrieve the next page. Payloads are shown as JSON; on the wire they are CBOR-encoded.

        >>> client.list_spaces_for_organization(max_results=50)
    """

    def _handler(
        req: "OperationRequest[capo_cloudwatchomni.types.list_spaces_for_organization_input.ListSpacesForOrganizationInput]",
    ) -> OperationResponse[
        "capo_cloudwatchomni.types.list_spaces_for_organization_output.ListSpacesForOrganizationOutput"
    ]:
        import capo_cloudwatchomni._operations.cloud_watch_omni_frontend.list_spaces_for_organization

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListSpacesForOrganization")
    )
    input_: capo_cloudwatchomni.types.list_spaces_for_organization_input.ListSpacesForOrganizationInput = {}
    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