Description
You can call this operation to query the list of database roles.
Call description
Prerequisites
You have passed the authentication for the OCP application service.
You have the Read permission on the specified tenant.
Request path
GET /api/v2/ob/clusters/{id}/tenants/{tenantId}/roles
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. |
Response parameters
| Parameter | Type | Description |
|---|---|---|
| data | Object | Contents are included. |
| ├─ contents | Array | The list of database roles. For more information about the data structure of a database role, see the following table. |
| successful | Boolean | Whether the request was successful. |
| timestamp | Datetime | The timestamp when the server completed the request. |
| duration | Integer | The time taken by the server to process the request, in milliseconds. |
| status | Integer | An HTTP status code. |
| traceId | String | The trace ID of the request. This trace ID is used for troubleshooting. |
| server | String | The address of the server that responded to the request. |
Data structure of a database role
| Parameter | Type | Description |
|---|---|---|
| name | String | The role name. |
| createTime | Datetime | The time when the user account was created. |
| updateTime | Datetime | The update time of the role. |
| globalPrivileges | StringArray | The list of system privileges. |
| objectPrivileges | Array | The list of object privileges. |
| ├─ dbObject | Object | The database object. For more information, see dbObject parameters. |
| ├─ privileges | StringArray | The list of object privileges. |
| grantedRoles | StringArray | The roles granted to the role. |
| userGrantees | StringArray | The users to whom the role is granted. |
| roleGrantees | StringArray | The roles to which the role is granted. |
dbObject parameters
| Parameter | Type | Description |
|---|---|---|
| objectType | String | The type of the database object. Valid values: * TABLE * VIEW * STORED_PROCEDURE |
| objectName | String | The name of the database object, namely, the name of the table, view, or stored procedure. |
| schemaName | String | The schema name, which is generally the same as the username. |
Examples
Sample request
Query roles in Tenant 1000001 of Cluster 1.
GET /api/v2/ob/clusters/1/tenants/2000001/roles?id=1&tenantId=2000001
Sample response
{
"data": {
"contents": [
{
"createTime": "2021-09-07T15:47:13.324272+08:00",
"globalPrivileges": [
"CREATE_SESSION"
],
"grantedRoles": [],
"name": "CONNECT",
"objectPrivileges": [],
"roleGrantees": [],
"updateTime": "2021-09-07T15:47:13.324272+08:00",
"userGrantees": []
},
{
"createTime": "2021-09-07T15:47:13.333952+08:00",
"globalPrivileges": [
"CREATE_TABLE",
"CREATE_PROCEDURE",
"CREATE_SEQUENCE",
"CREATE_TRIGGER",
"CREATE_TYPE"
],
"grantedRoles": [],
"name": "RESOURCE",
"objectPrivileges": [],
"roleGrantees": [],
"updateTime": "2021-09-07T15:47:13.333952+08:00",
"userGrantees": []
},
{
"createTime": "2021-09-07T15:47:13.351552+08:00",
"globalPrivileges": [
"CREATE_SESSION",
"CREATE_TABLE",
"CREATE_ANY_TABLE",
"ALTER_ANY_TABLE",
"BACKUP_ANY_TABLE",
"DROP_ANY_TABLE",
"LOCK_ANY_TABLE",
"COMMENT_ANY_TABLE",
"SELECT_ANY_TABLE",
"INSERT_ANY_TABLE",
"UPDATE_ANY_TABLE",
"DELETE_ANY_TABLE",
"FLASHBACK_ANY_TABLE",
"CREATE_ROLE",
"DROP_ANY_ROLE",
"GRANT_ANY_ROLE",
"ALTER_ANY_ROLE",
"AUDIT_ANY",
"GRANT_ANY_PRIVILEGE",
"GRANT_ANY_OBJECT_PRIVILEGE",
"CREATE_ANY_INDEX",
"ALTER_ANY_INDEX",
"DROP_ANY_INDEX",
"CREATE_ANY_VIEW",
"DROP_ANY_VIEW",
"CREATE_VIEW",
"SELECT_ANY_DICTIONARY",
"CREATE_PROCEDURE",
"CREATE_ANY_PROCEDURE",
"ALTER_ANY_PROCEDURE",
"DROP_ANY_PROCEDURE",
"EXECUTE_ANY_PROCEDURE",
"CREATE_SYNONYM",
"CREATE_ANY_SYNONYM",
"DROP_ANY_SYNONYM",
"CREATE_PUBLIC_SYNONYM",
"DROP_PUBLIC_SYNONYM",
"CREATE_SEQUENCE",
"CREATE_ANY_SEQUENCE",
"ALTER_ANY_SEQUENCE",
"DROP_ANY_SEQUENCE",
"SELECT_ANY_SEQUENCE",
"CREATE_TRIGGER",
"CREATE_ANY_TRIGGER",
"ALTER_ANY_TRIGGER",
"DROP_ANY_TRIGGER",
"CREATE_PROFILE",
"ALTER_PROFILE",
"DROP_PROFILE",
"CREATE_USER",
"BECOME_USER",
"ALTER_USER",
"DROP_USER",
"CREATE_TYPE",
"CREATE_ANY_TYPE",
"ALTER_ANY_TYPE",
"DROP_ANY_TYPE",
"EXECUTE_ANY_TYPE",
"UNDER_ANY_TYPE",
"PURGE_DBA_RECYCLEBIN",
"CREATE_ANY_OUTLINE",
"ALTER_ANY_OUTLINE",
"DROP_ANY_OUTLINE",
"SYSKM",
"CREATE_TABLESPACE",
"ALTER_TABLESPACE",
"DROP_TABLESPACE",
"SHOW_PROCESS",
"ALTER_SYSTEM",
"CREATE_DATABASE_LINK",
"CREATE_PUBLIC_DATABASE_LINK",
"DROP_DATABASE_LINK",
"ALTER_SESSION",
"ALTER_DATABASE"
],
"grantedRoles": [],
"name": "DBA",
"objectPrivileges": [],
"roleGrantees": [],
"updateTime": "2021-09-07T15:47:13.351552+08:00",
"userGrantees": []
},
{
"createTime": "2021-09-07T15:47:13.507267+08:00",
"globalPrivileges": [],
"grantedRoles": [],
"name": "PUBLIC",
"objectPrivileges": [],
"roleGrantees": [],
"updateTime": "2021-09-07T15:47:13.507267+08:00",
"userGrantees": []
}
]
},
"duration": 318,
"server": "a83ad33525",
"status": 200,
"successful": true,
"timestamp": "2021-09-07T15:48:30.383+08:00",
"traceId": "4f1d5757763a47bc"
}