Skip to content

batch_get_event

batch_get_event(
    space_id: SpaceId,
    event_ids: BatchGetEventIdList,
    *,
    config_overrides: Optional[OpenSearchMemoryClientConfig] = None,
    actor_id: Optional[ActorId] = None,
    session_id: Optional[SessionId] = None,
) -> BatchGetEventOutput

Gets up to 10 events by ID, each as GetEvent returns it, including its payload.

If you supply actorId or sessionId, every requested event must match it. Each event has its own outcome. The operation reports an event that it can't return in errors instead of failing, with an error code named for the exception that GetEvent would return for it. The operation reports both an event that doesn't exist and an event outside the supplied scope as RESOURCE_NOT_FOUND.

The exception is the space's customer managed AWS KMS key: if it is disabled, pending deletion, can't be used for decryption, or was deleted, the whole call fails with ValidationException, as GetEvent does.

Parameters:

  • space_id (SpaceId) –

    The ID of the space.

  • actor_id (Optional[ActorId], default: None ) –

    The actor that every requested event must belong to. Omit it to skip this check. The operation reports an event that doesn't match in errors as RESOURCE_NOT_FOUND.

  • session_id (Optional[SessionId], default: None ) –

    The session that every requested event must belong to. Omit it to skip this check. The operation reports an event that doesn't match in errors as RESOURCE_NOT_FOUND.

  • event_ids (BatchGetEventIdList) –

    The IDs of the events to get: 1 to 10, without duplicates.

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.

  • 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 batch_get_event(
    self,
    space_id: "capo_opensearchmemory.types.space_id.SpaceId",
    event_ids: "capo_opensearchmemory.types.batch_get_event_id_list.BatchGetEventIdList",
    *,
    config_overrides: Optional[OpenSearchMemoryClientConfig] = None,
    actor_id: Optional["capo_opensearchmemory.types.actor_id.ActorId"] = None,
    session_id: Optional["capo_opensearchmemory.types.session_id.SessionId"] = None,
) -> "capo_opensearchmemory.types.batch_get_event_output.BatchGetEventOutput":
    """<p>Gets up to 10 events by ID, each as <code>GetEvent</code> returns it, including its payload.</p> <p>If you supply <code>actorId</code> or <code>sessionId</code>, every requested event must match it. Each event has its own outcome. The operation reports an event that it can't return in <code>errors</code> instead of failing, with an error code named for the exception that <code>GetEvent</code> would return for it. The operation reports both an event that doesn't exist and an event outside the supplied scope as <code>RESOURCE_NOT_FOUND</code>.</p> <p>The exception is the space's customer managed AWS KMS key: if it is disabled, pending deletion, can't be used for decryption, or was deleted, the whole call fails with <code>ValidationException</code>, as <code>GetEvent</code> does.</p>

    Args:
        space_id: <p>The ID of the space.</p>
        actor_id: <p>The actor that every requested event must belong to. Omit it to skip this check. The operation reports an event that doesn't match in <code>errors</code> as <code>RESOURCE_NOT_FOUND</code>.</p>
        session_id: <p>The session that every requested event must belong to. Omit it to skip this check. The operation reports an event that doesn't match in <code>errors</code> as <code>RESOURCE_NOT_FOUND</code>.</p>
        event_ids: <p>The IDs of the events to get: 1 to 10, without duplicates.</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.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.batch_get_event_input.BatchGetEventInput]",
    ) -> OperationResponse[
        "capo_opensearchmemory.types.batch_get_event_output.BatchGetEventOutput"
    ]:
        import capo_opensearchmemory._operations.open_search_memory.batch_get_event

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

    def _redact_output(
        output: "capo_opensearchmemory.types.batch_get_event_output.BatchGetEventOutput",
    ) -> dict[str, Any]:
        import capo_opensearchmemory.types.batch_get_event_output

        return capo_opensearchmemory.types.batch_get_event_output.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("BatchGetEvent", redact_output=_redact_output),
    )
    input_: capo_opensearchmemory.types.batch_get_event_input.BatchGetEventInput = {
        "space_id": space_id,
        "event_ids": event_ids,
    }
    if actor_id is not None:
        input_["actor_id"] = actor_id
    if session_id is not None:
        input_["session_id"] = session_id

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