tcb routes edit
Update an existing route incrementally: locate it by "domain + path" and only the fields you pass are changed.
v3.0.0+
tcb routes has been available since v3.0.0.
Usage
tcb routes edit --data '<JSON>' [options]
Parameters
| Parameter | Required | Description | Default |
|---|---|---|---|
--data <json> | Yes | Route configuration JSON, path is the locator | — |
-e, --env-id <envId> | No | Environment ID | envId in the configuration |
The JSON structure matches Create a route; domain and routes[].path are required, the other fields are optional.
Examples
# Change the upstream service
tcb routes edit -e <envId> --data '{"domain":"api.example.com","routes":[{"path":"/api","upstreamResourceName":"new-service"}]}'
# Disable the route
tcb routes edit -e <envId> --data '{"domain":"api.example.com","routes":[{"path":"/api","enable":false}]}'
# Enable authentication and path transmission
tcb routes edit -e <envId> --data '{"domain":"api.example.com","routes":[{"path":"/api","enableAuth":true,"enablePathTransmission":true}]}'
# Change the QPS limits
tcb routes edit -e <envId> --data '{"domain":"api.example.com","routes":[{"path":"/v1","qpsPolicy":{"qpsTotal":200,"qpsPerClient":{"limitBy":"ClientIP","limitValue":20}}}]}'
# Switch the bound function version
tcb routes edit -e <envId> --data '{"domain":"api.example.com","routes":[{"path":"/func","upstreamResourceVersion":"3"}]}'
# Clear the binding and fall back to resource-side traffic control
tcb routes edit -e <envId> --data '{"domain":"api.example.com","routes":[{"path":"/func","upstreamResourceVersion":"$DEFAULT"}]}'
Notes
- Updates are incremental, untouched fields keep their current value
- An omitted
upstreamResourceVersionkeeps the current binding; pass$DEFAULTto clear it, see Forwarding version