Skip to content

delete_space

delete_space(
    space_id: SpaceId,
    *,
    config_overrides: Optional[OpenSearchMemoryClientConfig] = None,
) -> DeleteSpaceResponse

Deletes a space and its memories. Deletion can't be undone. After you delete the space, you can't retrieve its events, and the service removes them when they reach their expiry.

The operation returns with status DELETING. When deletion finishes, GetSpace returns ResourceNotFoundException. If deletion fails, the status becomes FAILED. A space that is CREATING or UPDATING can't be deleted until that finishes: the request fails with ConflictException. Deleting a space that is already DELETING returns DELETING again.

Parameters:

  • space_id (SpaceId) –

    The ID of the space to delete.

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.

  • ConflictException –

    The request conflicts with the current state of the resource. For example, the space is being created, updated, or deleted, a space with the same name already exists, or you reused a client token with different parameters. Wait for the space to finish being created, updated, or deleted, or use a different name or client token, and then retry.

  • InternalServerException –

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

  • ResourceNotFoundException –

    The specified resource doesn't exist. Check the IDs in 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/open_search_memory.py
def delete_space(
    self,
    space_id: "capo_opensearchmemory.types.space_id.SpaceId",
    *,
    config_overrides: Optional[OpenSearchMemoryClientConfig] = None,
) -> "capo_opensearchmemory.types.delete_space_response.DeleteSpaceResponse":
    """<p>Deletes a space and its memories. Deletion can't be undone. After you delete the space, you can't retrieve its events, and the service removes them when they reach their expiry.</p> <p>The operation returns with <code>status</code> <code>DELETING</code>. When deletion finishes, <code>GetSpace</code> returns <code>ResourceNotFoundException</code>. If deletion fails, the status becomes <code>FAILED</code>. A space that is <code>CREATING</code> or <code>UPDATING</code> can't be deleted until that finishes: the request fails with <code>ConflictException</code>. Deleting a space that is already <code>DELETING</code> returns <code>DELETING</code> again.</p>

    Args:
        space_id: <p>The ID of the space to delete.</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.conflict_exception.ConflictException: <p>The request conflicts with the current state of the resource. For example, the space is being created, updated, or deleted, a space with the same name already exists, or you reused a client token with different parameters. Wait for the space to finish being created, updated, or deleted, or use a different name or client token, and then retry.</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.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource doesn't exist. Check the IDs in 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.
    """

    def _handler(
        req: "OperationRequest[capo_opensearchmemory.types.delete_space_request.DeleteSpaceRequest]",
    ) -> OperationResponse[
        "capo_opensearchmemory.types.delete_space_response.DeleteSpaceResponse"
    ]:
        import capo_opensearchmemory._operations.open_search_memory.delete_space

        output, http_response = (
            capo_opensearchmemory._operations.open_search_memory.delete_space.delete_space(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteSpace")
    )
    input_: capo_opensearchmemory.types.delete_space_request.DeleteSpaceRequest = {
        "space_id": space_id
    }

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