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/io_t_secure_tunneling.py
| def close_tunnel(
self,
tunnel_id: "capo_iotsecuretunneling.types.tunnel_id.TunnelId",
*,
config_overrides: Optional[IoTSecureTunnelingClientConfig] = 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.
"""
def _handler(
req: "OperationRequest[capo_iotsecuretunneling.types.close_tunnel_request.CloseTunnelRequest]",
) -> OperationResponse[
"capo_iotsecuretunneling.types.close_tunnel_response.CloseTunnelResponse"
]:
import capo_iotsecuretunneling._operations.io_t_secured_tunneling.close_tunnel
output, http_response = (
capo_iotsecuretunneling._operations.io_t_secured_tunneling.close_tunnel.close_tunnel(
req.options, req.input
)
)
return OperationResponse(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 = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|