Skip to content

delete_session

delete_session(
    bot_name: BotName,
    bot_alias: BotAlias,
    user_id: UserId,
    *,
    config_overrides: Optional[LexRuntimeServiceClientConfig] = None,
) -> DeleteSessionResponse

Removes session information for a specified bot, alias, and user ID.

Parameters:

  • bot_name (BotName) –

    The name of the bot that contains the session data.

  • bot_alias (BotAlias) –

    The alias in use for the bot that contains the session data.

  • user_id (UserId) –

    The identifier of the user associated with the session data.

Raises:

Source code in docs_src/capo_lex_runtime_service/_services/lex_runtime_service.py
def delete_session(
    self,
    bot_name: "capo_lex_runtime_service.types.bot_name.BotName",
    bot_alias: "capo_lex_runtime_service.types.bot_alias.BotAlias",
    user_id: "capo_lex_runtime_service.types.user_id.UserId",
    *,
    config_overrides: Optional[LexRuntimeServiceClientConfig] = None,
) -> "capo_lex_runtime_service.types.delete_session_response.DeleteSessionResponse":
    """<p>Removes session information for a specified bot, alias, and user ID. </p>

    Args:
        bot_name: <p>The name of the bot that contains the session data.</p>
        bot_alias: <p>The alias in use for the bot that contains the session data.</p>
        user_id: <p>The identifier of the user associated with the session data.</p>

    Raises:
        capo_lex_runtime_service.errors.bad_request_exception.BadRequestException: <p> Request validation failed, there is no usable message in the context, or the bot build failed, is still in progress, or contains unbuilt changes. </p>
        capo_lex_runtime_service.errors.conflict_exception.ConflictException: <p> Two clients are using the same AWS account, Amazon Lex bot, and user ID. </p>
        capo_lex_runtime_service.errors.internal_failure_exception.InternalFailureException: <p>Internal service error. Retry the call.</p>
        capo_lex_runtime_service.errors.limit_exceeded_exception.LimitExceededException: <p>Exceeded a limit.</p>
        capo_lex_runtime_service.errors.not_found_exception.NotFoundException: <p>The resource (such as the Amazon Lex bot or an alias) that is referred to is not found.</p>
        capo_lex_runtime_service.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_lex_runtime_service.types.delete_session_request.DeleteSessionRequest]",
    ) -> OperationResponse[
        "capo_lex_runtime_service.types.delete_session_response.DeleteSessionResponse"
    ]:
        import capo_lex_runtime_service._operations.aws_deep_sense_run_time_service.delete_session

        output, http_response = (
            capo_lex_runtime_service._operations.aws_deep_sense_run_time_service.delete_session.delete_session(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteSession")
    )
    input_: capo_lex_runtime_service.types.delete_session_request.DeleteSessionRequest = {
        "bot_name": bot_name,
        "bot_alias": bot_alias,
        "user_id": user_id,
    }

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