Skip to content

terminate_session async

terminate_session(
    session_id: SessionId, *, config_overrides: Optional[AsyncSSMClientConfig] = None
) -> TerminateSessionResponse

Permanently ends a session and closes the data connection between the Session Manager client and SSM Agent on the managed node. A terminated session can't be resumed.

Parameters:

  • session_id (SessionId) –

    The ID of the session to terminate.

Raises:

Source code in docs_src/capo_ssm/_services/async_ssm.py
async def terminate_session(
    self,
    session_id: "capo_ssm.types.session_id.SessionId",
    *,
    config_overrides: Optional[AsyncSSMClientConfig] = None,
) -> "capo_ssm.types.terminate_session_response.TerminateSessionResponse":
    """<p>Permanently ends a session and closes the data connection between the Session Manager client and SSM Agent on the managed node. A terminated session can't be resumed.</p>

    Args:
        session_id: <p>The ID of the session to terminate.</p>

    Raises:
        capo_ssm.errors.internal_server_error.InternalServerError: <p>An error occurred on the server side.</p>
        capo_ssm.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ssm.types.terminate_session_request.TerminateSessionRequest]",
    ) -> AsyncOperationResponse[
        "capo_ssm.types.terminate_session_response.TerminateSessionResponse"
    ]:
        import capo_ssm._operations.amazon_ssm.terminate_session

        (
            output,
            http_response,
        ) = await capo_ssm._operations.amazon_ssm.terminate_session.async_terminate_session(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("TerminateSession")
    )
    input_: capo_ssm.types.terminate_session_request.TerminateSessionRequest = {
        "session_id": session_id
    }

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output