Reviewed-by: Gladkov, Maksim <mgladkov@noreply.gitea.eco.tsi-dev.otc-service.com> Co-authored-by: wangdengke2 <wangdengke2@huawei.com> Co-committed-by: wangdengke2 <wangdengke2@huawei.com>
24 KiB
Enabling Database Proxy
Function
This API is used to enable database proxy for a DB instance.
- Before calling an API, you need to understand the API in Authentication.
- Before calling this API, obtain the required region and endpoint.
URI
- Parameter description
Table 1 Parameters Parameter
Mandatory
Description
project_id
Yes
Specifies the project ID of a tenant in a region.
For details about how to obtain the project ID, see Obtaining a Project ID.
instance_id
Yes
Specifies the DB instance ID.
Request
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
Content-Type |
Yes |
String |
The content type. The default value is application/json. |
X-Auth-Token |
Yes |
String |
Specifies the user token. The user token is a response to the API used to obtain a user token. |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
flavor_ref |
Yes |
String |
Specification code of the database proxy.
|
node_num |
Yes |
Integer |
Number of database proxy nodes.
|
proxy_name |
No |
String |
Name of the database proxy. Database proxies of the same type can have the same name under the same tenant. The name must start with a letter and consist of 4 to 64 characters. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed. If this parameter is not specified or the site supports only the database proxy in primary/standby mode, a random name will be generated. |
proxy_mode |
No |
String |
Read/write mode of the database proxy.
|
route_mode |
No |
Integer |
Routing policy of the database proxy.
|
nodes_read_weight |
Yes |
Array of objects |
Read weights of database nodes. For details, see Table 4.
|
subnet_id |
No |
String |
Subnet ID in the VPC hosting the DB instance. The value can be any subnet ID in the VPC to which the instance belongs. To obtain the subnet ID, go to the subnet details page on the VPC console. |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
instance_id |
Yes |
String |
Read Replica ID. For details, see Table 9. |
weight |
Yes |
Integer |
Read weight assigned. |
Example Request
Enable database proxy for a DB instance.
POST https://rds.eu-de.otc.t-systems.com/v3/23a50154cf494ec9ad6883979a12db0a/instances/920ec36cef814a8b830a5bed50d9a088in01/proxy/open
{
"flavor_ref": "rds.proxy.xlarge.2",
"node_num": 2,
"proxy_name": "proxy-test",
"nodes_read_weight": [
{
"instance_id": "917c67424dd54af3addf537a069e5b20in01",
"weight": 1
}
]
}
Response
- Normal response
Table 5 Parameters Parameter
Type
Description
job_id
String
Task ID.
proxy_id
String
Database proxy ID.
- Example normal response
{ "job_id" : "09908118-8e32-4742-982a-7be194f59e1d", "proxy_id" : "69bb32f08262418c8478ffc92f2ba1e6po01" } - Abnormal response
For details, see Abnormal Request Results.
Status Code
- Normal
- Abnormal
For details, see Status Codes.
Error Code
For details, see Error Codes.