Skip to content

list_spaces async

list_spaces(
    *,
    config_overrides: Optional[AsyncOpenSearchMemoryClientConfig] = None,
    max_results: Optional[MaxResults] = None,
    next_token: Optional[NextToken] = None,
) -> ListSpacesResponse

Lists the spaces in your account in the current Region.

Parameters:

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

    The maximum number of spaces to return, from 1 to 100. The default is 100.

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

    The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.

Raises:

  • AccessDeniedException –

    You don't have sufficient access to perform this operation. To use this operation, you must have AWS Identity and Access Management (IAM) permissions for the operation, and on the resource it acts on. If the space uses a customer managed AWS Key Management Service (AWS KMS) key, you must also have permission to use the key.

  • InternalServerException –

    The service couldn't process the request because of an internal error. Retry the request.

  • ThrottlingException –

    The service throttled the request. Retry the request with exponential backoff.

  • ValidationException –

    The request isn't valid. The reason, message, and fieldList members describe the problem. Fix the request, and then try again.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_opensearchmemory/_services/async_open_search_memory.py
async def list_spaces(
    self,
    *,
    config_overrides: Optional[AsyncOpenSearchMemoryClientConfig] = None,
    max_results: Optional[
        "capo_opensearchmemory.types.max_results.MaxResults"
    ] = None,
    next_token: Optional["capo_opensearchmemory.types.next_token.NextToken"] = None,
) -> "capo_opensearchmemory.types.list_spaces_response.ListSpacesResponse":
    """<p>Lists the spaces in your account in the current Region.</p>

    Args:
        max_results: <p>The maximum number of spaces to return, from 1 to 100. The default is 100.</p>
        next_token: <p>The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.</p>

    Raises:
        capo_opensearchmemory.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient access to perform this operation. To use this operation, you must have AWS Identity and Access Management (IAM) permissions for the operation, and on the resource it acts on. If the space uses a customer managed AWS Key Management Service (AWS KMS) key, you must also have permission to use the key.</p>
        capo_opensearchmemory.errors.internal_server_exception.InternalServerException: <p>The service couldn't process the request because of an internal error. Retry the request.</p>
        capo_opensearchmemory.errors.throttling_exception.ThrottlingException: <p>The service throttled the request. Retry the request with exponential backoff.</p>
        capo_opensearchmemory.errors.validation_exception.ValidationException: <p>The request isn't valid. The <code>reason</code>, <code>message</code>, and <code>fieldList</code> members describe the problem. Fix the request, and then try again.</p>
        capo_opensearchmemory.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_opensearchmemory.types.list_spaces_request.ListSpacesRequest]",
    ) -> AsyncOperationResponse[
        "capo_opensearchmemory.types.list_spaces_response.ListSpacesResponse"
    ]:
        import capo_opensearchmemory._operations.open_search_memory.list_spaces

        (
            output,
            http_response,
        ) = await capo_opensearchmemory._operations.open_search_memory.list_spaces.async_list_spaces(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListSpaces")
    )
    input_: capo_opensearchmemory.types.list_spaces_request.ListSpacesRequest = {}
    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