Description
This API is used to revoke some database privileges from a user.
Request information
API constraints
The caller must be authenticated by using OCP.
The caller must have the permission to modify the specified tenant.
Request path
POST /api/v2/ob/clusters/{id}/tenants/{tenantId}/users/{username}/revokeDbPrivilege
Request parameters
Path parameters
Parameter |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| id | Integer | Yes | 1 | The ID of the cluster. |
| tenantId | Integer | Yes | 5 | The ID of the tenant. |
| username | String | Yes | root | The username. |
| hostName | String | No | 33.47.251.% | The host name. |
Body parameters
Parameter |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| dbPrivileges | Array | No | NA | The list of database privileges to revoke. |
| ├─ dbName | String | Yes | db1 | The name of the database. |
| ├─ privileges | StringArray | Yes | [ALTER, INDEX] | The list of privileges of the database. |
Response
Parameter |
Type |
Description |
|---|---|---|
| successful | Boolean | Indicates whether the request is successful. |
| timestamp | Datetime | The timestamp when the server finishes processing the request. |
| duration | Integer | The time taken by the server to process the request, in milliseconds. |
| status | Integer | The HTTP status code that conforms to the HTTP standard. |
| traceId | String | The Trace ID of the request, which is used to troubleshoot problems. |
| server | String | The address of the application service that responds to the request. |
Examples
Request example
Revoke the CREATE and SELECT privileges from user1 on db1 in cluster 1 and tenant 1000001.
POST /api/v2/ob/clusters/1/tenants/2000001/users/user1/revokeDbPrivilege?id=1&tenantId=2000001&username=user1
{
"dbPrivileges": [
{
"dbName": "db1",
"privileges": [
"CREATE",
"SELECT"
]
}
]
}
Response example
{
"duration": 201,
"server": "a83ad33525",
"status": 200,
"successful": true,
"timestamp": "2021-09-07T15:30:41.205+08:00",
"traceId": "f4783564b21746db"
}
