Configuring the Routing Policy for a Database Proxy
Function
This API is used to configure the routing policy for a database proxy.
- Before calling this API, learn how to authenticate it.
- Before calling this API, learn about the request header parameters.
URI
- Parameter description
Table 1 Parameters Parameter
Mandatory
Description
project_id
Yes
Definition
Project ID of a tenant in a region.
Constraints
The value cannot be empty.
Range
To obtain the value, see Obtaining a Project ID.
Default Value
N/A
instance_id
Yes
Definition
Instance ID.
Constraints
The value cannot be empty.
Range
You can obtain the value of this parameter from id in Table 4 by calling the API for querying DB instances.
Default Value
N/A
proxy_id
Yes
Definition
Database proxy ID.
Constraints
N/A
Range
You can obtain the value of this parameter from pool_id in Table 4 by calling the API for querying database proxies.
Default Value
N/A
Request
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
master_weight |
Yes |
Integer |
Definition Read weight of the primary instance. Constraints N/A Range
Default Value N/A |
|
readonly_instances |
Yes |
Array of objects |
Definition Read weights of database nodes. For details, see Table 3. Constraints
|
|
route_mode |
Yes |
Integer |
Definition Routing policy of the database proxy. Constraints N/A Range
Default Value N/A |
Example Request
Configure the routing policy for a database proxy.
POST https://{Endpoint}/v3/23a50154cf494ec9ad6883979a12db0a/instances/ba0fd7c13cca4655820e0f858d5d467bin01/proxy/4e2a0c70f70f4807940db73a30b5b522po01/route-mode
{
"master_weight" : 0,
"readonly_instances" : [ {
"instance_id" : "2edc88e921bb4129bb4d9b76be66811dno07",
"weight" : 1
} ],
"route_mode" : 2
}
Response
- Normal response
Table 4 Parameters Parameter
Type
Description
result
String
Definition
Result of changing the routing policy of the database proxy.
Range
- failed
- success
- Example normal response
{ "result" : "success" } - Abnormal response
For details, see Abnormal Request Results.
Status Code
- Normal
- Abnormal
For details, see Status Codes.
Error Code
For details, see Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot