All Products
Search
Document Center

Tablestore:Delete a tunnel

Last Updated:Jul 05, 2024

You can call the DeleteTunnel operation to delete a tunnel that you no longer require. When you delete a tunnel, you must specify the name of the data table for which the tunnel is created and the name of the tunnel.

Usage notes

  • Before you delete a channel, make sure that no data is being consumed in the channel. Otherwise, data consumption may fail.

  • A channel cannot be restored after it is deleted. Exercise caution when you perform this operation.

Prerequisites

  • A TunnelClient instance is initialized.

  • A tunnel is created for the data table. For more information, see Create a tunnel.

Parameters

Request parameters

Parameter

Description

tableName

The name of the data table whose tunnel you want to delete. You can call the ListTable operation to query the names of tables in an instance. For more information, see List the names of tables.

tunnelName

The name of the tunnel. You can call the ListTunnel operation to query information about all tunnels of a data table. For more information, see Query information about all tunnels of a data table.

Response parameters

Parameter

Description

responseInfo

Other fields returned in the request.

requestId

The ID of the request.

Examples

The following sample code provides an example on how to delete a tunnel of a data table:

private static void deleteTunnel(TunnelClient client, String tableName, String tunnelName) {
    DeleteTunnelRequest request = new DeleteTunnelRequest(tableName, tunnelName);
    DeleteTunnelResponse resp = client.deleteTunnel(request);
    System.out.println("RequestId: " + resp.getRequestId());
}

References

  • For information about the API operation that you can call to delete a tunnel, see DeleteTunnel.

  • If an error occurs when you call the DeleteTunnel operation, search for the error cause in Error codes based on the error message and handle the error.