closeTunnel method
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.
May throw ResourceNotFoundException.
Parameter tunnelId :
The ID of the tunnel to close.
Parameter delete :
When set to true, IoT Secure Tunneling deletes the tunnel data
immediately.
Implementation
Future<void> closeTunnel({
required String tunnelId,
bool? delete,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'IoTSecuredTunneling.CloseTunnel'
};
await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'tunnelId': tunnelId,
if (delete != null) 'delete': delete,
},
);
}