Skip to content

close_tunnel async

close_tunnel(
    tunnel_id: TunnelId,
    *,
    config_overrides: Optional[AsyncIoTSecureTunnelingClientConfig] = None,
    delete: Optional[DeleteFlag] = None,
) -> CloseTunnelResponse

Closes a tunnel identified by the unique tunnel id. When a CloseTunnel request is received, we close the WebSocket connections between the client and proxy server so no data can be transmitted.

Requires permission to access the CloseTunnel action.

Parameters:

  • tunnel_id (TunnelId) –

    The ID of the tunnel to close.

  • delete (Optional[DeleteFlag], default: None ) –

    When set to true, IoT Secure Tunneling deletes the tunnel data immediately.

Raises:

Source code in docs_src/capo_iotsecuretunneling/_services/async_io_t_secure_tunneling.py
async def close_tunnel(
    self,
    tunnel_id: "capo_iotsecuretunneling.types.tunnel_id.TunnelId",
    *,
    config_overrides: Optional[AsyncIoTSecureTunnelingClientConfig] = None,
    delete: Optional["capo_iotsecuretunneling.types.delete_flag.DeleteFlag"] = None,
) -> "capo_iotsecuretunneling.types.close_tunnel_response.CloseTunnelResponse":
    """<p>Closes a tunnel identified by the unique tunnel id. When a <code>CloseTunnel</code> request is received, we close the WebSocket connections between the client and proxy server so no data can be transmitted.</p> <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">CloseTunnel</a> action.</p>

    Args:
        tunnel_id: <p>The ID of the tunnel to close.</p>
        delete: <p>When set to true, IoT Secure Tunneling deletes the tunnel data immediately.</p>

    Raises:
        capo_iotsecuretunneling.errors.resource_not_found_exception.ResourceNotFoundException: <p>Thrown when an operation is attempted on a resource that does not exist.</p>
        capo_iotsecuretunneling.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_iotsecuretunneling.types.close_tunnel_request.CloseTunnelRequest]",
    ) -> AsyncOperationResponse[
        "capo_iotsecuretunneling.types.close_tunnel_response.CloseTunnelResponse"
    ]:
        import capo_iotsecuretunneling._operations.io_t_secured_tunneling.close_tunnel

        (
            output,
            http_response,
        ) = await capo_iotsecuretunneling._operations.io_t_secured_tunneling.close_tunnel.async_close_tunnel(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CloseTunnel")
    )
    input_: capo_iotsecuretunneling.types.close_tunnel_request.CloseTunnelRequest = {
        "tunnel_id": tunnel_id
    }
    if delete is not None:
        input_["delete"] = delete

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