Feature description
Obtains a list of database users.
Call instructions
Interface constraints
The caller needs to be authenticated through the OCP application service.
The caller needs to have the read permission on the specified tenant.
Request path
GET /api/v2/ob/clusters/{id}/tenants/{tenantId}/users
Request parameters
path:
Parameter |
Type |
Required |
Example Value |
Description |
|---|---|---|---|---|
| id | Integer | Yes | 1 | The cluster ID. |
| tenantId | Integer | Yes | 5 | The tenant ID. |
Response
Parameter |
Type |
Description |
|---|---|---|
| data | Object | The list of database users. For more information, see Database User Data Structure. |
| 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 that conforms to the HTTP Status specification. |
| traceId | String | The Trace ID of the request, which is used to troubleshoot problems. |
| server | String | The address of the server that responds to the request. |
Database User Data Structure
Parameter |
Type |
Description |
|---|---|---|
| username | String | The username. |
| globalPrivileges | StringArray | The global privilege list: |
| dbPrivileges | Array | The database privilege list. This field exists only in the response for a MySQL tenant. This field does not exist in the response for an Oracle tenant. |
| ├─ dbName | String | The database name. |
| ├─ privileges | StringArray | The database privileges. |
| objectPrivileges | Array | The object privilege list. This field exists only in the response for an Oracle tenant. This field does not exist in the response for a MySQL tenant. |
| ├─ dbObject | Object | The database object. For more information, see dbObject parameters. |
| ├─ privileges | StringArray | The object privileges. |
| grantedRoles | StringArray | The roles granted to the user. This field exists only in the response for an Oracle tenant. This field does not exist in the response for a MySQL tenant. |
| isLocked | Bool | Indicates whether the user is locked. |
| createTime | Datetime | The user creation time. |
| connectionStrings | Array | The list of connection strings. |
| ├─ connectionStringType | String | The type of the connection string. The value range: |
| ├─ 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. |
| accessibleDatabases | StringArray | The accessible databases. This field exists only in the response for a MySQL tenant. This field does not exist in the response for an Oracle tenant. |
dbObject parameters
Parameter |
Type |
Description |
|---|---|---|
| objectType | String | The type of the database object. The value range: |
| objectName | String | The name of the database object, which is the table name, view name, or stored procedure name. |
| schemaName | String | The schema name, which is usually the same as the username. |
Example
Request example
Obtain the user list in cluster 1 and tenant 1000001.
GET /api/v2/ob/clusters/1/tenants/1000001/users?id=1&tenantId=1000001
Response example
{
"data": {
"contents": [
{
"accessibleDatabases": [
"oceanbase",
"information_schema",
"mysql",
"test",
"db1"
],
"connectionStrings": [
{
"connectionString": "mysql -hxx.xx.xx.xx -P2881 -uroot@mysql1 -p",
"type": "DIRECT"
}
],
"createTime": "2021-09-06T11:38:44.585445+08:00",
"dbPrivileges": [
{
"dbName": "mysql",
"privileges": [
"SELECT",
"INSERT",
"UPDATE",
"DELETE",
"CREATE",
"DROP",
"INDEX",
"ALTER",
"CREATE_VIEW",
"SHOW_VIEW"
]
},
{
"dbName": "oceanbase",
"privileges": [
"SELECT",
"INSERT",
"UPDATE",
"DELETE",
"CREATE",
"DROP",
"INDEX",
"ALTER",
"CREATE_VIEW",
"SHOW_VIEW"
]
},
{
"dbName": "test",
"privileges": [
"SELECT",
"INSERT",
"UPDATE",
"DELETE",
"CREATE",
"DROP",
"INDEX",
"ALTER",
"CREATE_VIEW",
"SHOW_VIEW"
]
},
{
"dbName": "information_schema",
"privileges": [
"SELECT",
"INSERT",
"UPDATE",
"DELETE",
"CREATE",
"DROP",
"INDEX",
"ALTER",
"CREATE_VIEW",
"SHOW_VIEW"
]
}
],
"globalPrivileges": [
"ALTER",
"CREATE",
"DELETE",
"DROP",
"GRANT_OPTION",
"INSERT",
"UPDATE",
"SELECT",
"INDEX",
"CREATE_VIEW",
"SHOW_VIEW",
"SHOW_DATABASES",
"CREATE_USER",
"SUPER",
"PROCESS"
],
"isLocked": false,
"username": "root"
}
]
},
"duration": 416,
"server": "a83ad33525",
"status": 200,
"successful": true,
"timestamp": "2021-09-07T15:06:47.19+08:00",
"traceId": "38263a4ed3f04e1c"
}
