Description
The interface used to modify the database.
Call instructions
Interface constraints
The caller needs to be authenticated through the OCP application service.
The caller must have the permission to modify the specified tenant.
Request path
PUT /api/v2/ob/clusters/{id}/tenants/{tenantId}/databases/{dbName}
Request parameters
path:
Parameter |
Type |
Required |
Example Value |
Description |
|---|---|---|---|---|
| id | Integer | Yes | 1 | The cluster ID. |
| tenantId | Integer | Yes | 5 | The tenant ID. |
| dbName | String | Yes | db1 | The database name. |
body:
Parameter |
Type |
Required |
Example Value |
Description |
|---|---|---|---|---|
| collation | String | No | utf8mb4_general_ci | The collation. Valid values: |
| readonly | Boolean | Yes | false | Specifies whether the database is read-only. |
Return result
Basic data structure
Parameter |
Type |
Description |
|---|---|---|
| data | Object | The database object. The data structure of the database is described in the following table. |
| successful | Boolean | Indicates whether the request is successful. |
| timestamp | Datetime | The timestamp when the server finishes the request. |
| duration | Integer | The time taken by the server to process the request, in milliseconds. |
| status | Integer | The HTTP status code. |
| traceId | String | The Trace ID of the request, which is used to troubleshoot issues. |
| server | String | The address of the application service that responds to the request. |
Data structure of the database
Parameter |
Type |
Description |
|---|---|---|
| dbName | String | The name of the database. |
| charset | String | The character set. |
| collation | String | The collation. |
| primaryZone | String | The zone priority. |
| readonly | Boolean | Indicates whether the database is read-only. |
| createTime | Datetime | The creation time. |
| connectionUrls | Array | The list of OBProxy connection strings. |
| ├─ connectionStringType | String | The type of the connection string. Valid values: |
| ├─ obProxyAddress | String | The address of the OBProxy. This field is valid only when the connection string type is OBPROXY. |
| ├─ obProxyPort | Integer | The port of the OBProxy. This field is valid only when the connection string type is OBPROXY. |
| ├─ connectionString | String | The connection string. |
| requiredSize | Integer | The required_size of the database. |
| id | Integer | The ID of the database. |
Examples
Request example
Modify the database named db1 in cluster 1 and tenant 1000001.
PUT /api/v2/ob/clusters/1/tenants/1000001/databases/db1?id=1&tenantId=1000001&dbName=db1
{
"collation": "utf8mb4_general_ci",
"readonly": false,
}
Response example
{
"data": {
"charset": "utf8mb4",
"collation": "utf8mb4_general_ci",
"createTime": "2021-09-07T10:50:04.194771+08:00",
"dbName": "db1",
"id": 1100611139404828,
"readonly": false
},
"duration": 243,
"server": "a83ad33525",
"status": 200,
"successful": true,
"timestamp": "2021-09-07T10:51:25.471+08:00",
"traceId": "c5b64d9caac441f8"
}
