After you create a tunnel, you can call the ListTunnel operation to query information about all tunnels of a table, including the tunnel name, type, ID, and stage, and whether the data is expired.
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 information you want to query. |
Response parameters
Parameter | Description |
List<TunnelInfo> | The information about the tunnels. The following information is included in the response:
|
ResponseInfo | Other fields returned in the request, including the RequestId field in the request. RequestId uniquely identifies the request. |
Examples
The following sample code provides an example on how to query information about all tunnels of a table:
req := &tunnel.ListTunnelRequest{
TableName: "<TABLE_NAME>",
}
resp, err := tunnelClient.ListTunnel(req)
if err != nil {
log.Fatal("List tunnel failed", err)
} else {
for i := 0; i < len(resp.Tunnels); i++ {
log.Println(resp.Tunnels[i].TableName, resp.Tunnels[i].TunnelName, resp.Tunnels[i].TunnelId)
}
}
References
For information about the API operation that you can call to query information about all tunnels of a data table, see ListTunnel.
If you want to quickly use Tunnel Service to consume data, see Getting started.
You can query information about a tunnel. For more information, see Query information about a tunnel.
You can delete a tunnel that you no longer require. For more information, see Delete a tunnel.