You can call the CreateTunnel operation to create one or more tunnels for a table. When you create a tunnel, you must specify the table name, tunnel name, and tunnel type.

Request parameters

Parameter Description
TableName The name of the table for which you wan to create a tunnel.
TunnelName The tunnel name.
Type The type of the tunnel. Valid values: BaseData, Stream, and BaseAndStream.

Response parameters

Parameter Description
TunnelId The channel ID.
ResponseInfo Some other fields returned, including the RequestId field in the request.

RequestId uniquely identifies the request.

Examples

req := &tunnel.CreateTunnelRequest{
   TableName:  "testTable",
   TunnelName: "testTunnel",
   Type:       tunnel.TunnelTypeBaseStream, // Create a differential tunnel.
}
resp, err := tunnelClient.CreateTunnel(req)
if err != nil {
   log.Fatal("create test tunnel failed", err)
}
log.Println("tunnel id is", resp.TunnelId)