Description
You can call this operation to query all tenants.
Call description
Prerequisite
You have passed the authentication for the OCP application service.
Only the tenants in which you have the cluster read privilege are returned.
Request path
GET /api/v2/ob/tenants
Request parameters
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
| page | Integer | No | 1 | The number of the page to return. Pages start from page 1. Default value: 1. |
| size | Integer | No | 10 | The number of entries to return on each page. Maximum value: 2000 |
| sort | String | No | name,asc | The rule of sorting the requested data. |
| name | String | No | foo | The name of the tenant that includes the specified keyword. The name is not case-sensitive. |
| mode | StringArray | No | ORACLE | The tenant mode. * ORACLE * MYSQL |
| locked | Boolean | No | false | Specifies to query tenants based on whether they are locked. * If it is not specified, all tenants are queried. * If the value is true, only the tenants in the locked status are queried. * If the value is false, only the tenants in the unlocked status are queried. |
| readonly | Boolean | No | false | Whether to specify the read-only status of tenants. * If it is not specified, all tenants are queried. * If the value is true, only the tenants in the read-only status are queried. * If the value is false, only the tenants not in the read-only status are queried. |
| status | StringArray | No | NORMAL | The status of the tenant. * NORMAL: The tenant is running. * CREATING: The tenant is being created. * MODIFYING: The tenant is being modified. * DELETING: The tenant is being deleted. |
Response parameters
- Basic data structure
| Parameter | Type | Description |
|---|---|---|
| data | Object | The requested service data. |
| ├─ contents | Array | The list of tenants. For more information about its data structure, see the following table. |
| ├─ page | Object | The page information. |
| ├─ totalElements | Integer | The total number of entries. |
| ├─ totalPage | Integer | Total number of pages. |
| ├─ number | Integer | The page number of the returned page. |
| ├─ size | Integer | The number of entries returned per page. |
| successful | Boolean | Whether the request is successful. |
| timestamp | Datetime | The timestamp when the server completes the request. |
| duration | Integer | The time that the server takes to process the request, in milliseconds. |
| status | Integer | The encoding in compliance with the HTTP Status specification. |
| traceId | String | The trace ID of the request. This trace ID is used for troubleshooting. |
| server | String | The address of the server that responds to the request. |
- Data structure of tenant information
| Parameter | Type | Description |
|---|---|---|
| id | Integer | The ID of the tenant. |
| name | String | The name of the tenant. |
| clusterName | String | The name of the cluster to which the tenant belongs. |
| clusterId | Integer | The ID of the cluster to which the tenant belongs. |
| obClusterId | Integer | The ID of the cluster to which the tenant belongs on the OBServer. |
| clusterType | String | The type of the cluster to which the tenant belongs. Valid values: * PRIMARY: primary cluster * STANDBY: standby cluster |
| mode | String | The tenant mode. Valid values: * ORACLE * MYSQL |
| createTime | Datetime | The time when the tenant was created. |
| primaryZone | String | The zone priority of the tenant. |
| zoneList | String | The zone list of the tenant. |
| locality | String | The replica distribution of the tenant. |
| status | String | The status of the tenant. Valid values: * NORMAL: The tenant is running. * CREATING: The tenant is being created. * MODIFYING: The tenant is being modified. * DELETING: The tenant is being deleted. |
| locked | Boolean | The lock status of the tenant. |
| readonly | Boolean | The read-only status of the tenant. |
| obVersion | String | The OceanBase Database version of the cluster to which the tenant belongs. |
| description | String | The descriptive information of the tenant. |
Examples
Sample request
Query names of tenants that are running or being created based on the keyword "foo". Set the number of entries to return on each page to 10 and the number of the page to return to 2.
GET /api/v2/ob/tenants?name=foo&status=NORMAL,CREATING&page=2&size=10
Sample response
{
"duration":197,
"server": "a83ad33525",
"status":200,
"successful":true,
"timestamp":"2020-11-11T20:52:34.669+08:00",
"traceId":"47e0c4c4a7a24207",
"data":{
"contents":[
{
"clusterId":1,
"clusterName":"foo",
"clusterType":"PRIMARY",
"createTime":"2020-01-01T00:00:00+08:00",
"id":10,
"locality":"FULL{1}@zone1, FULL{1}@zone2, FULL{1}@zone3",
"locked":false,
"mode":"Oracle",
"name":"foo1",
"obClusterId":1,
"obVersion":"2.2.52",
"primaryZone":"zone2,zone3;zone1",
"readonly":false,
"status":"NORMAL",
"zoneList":"zone1;zone2;zone3"
},
{
"clusterId":2,
"clusterName":"bar",
"clusterType":"PRIMARY",
"createTime":"2020-01-02T00:00:00+08:00",
"id":11,
"locality":"FULL{1}@zone1",
"locked":true,
"mode":"MYSQL",
"name":"foo2",
"obClusterId":3,
"obVersion":"2.2.72",
"primaryZone":"zone1",
"readonly":false,
"status":"NORMAL",
"zoneList":"zone1"
}
],
"page":{
"number":1,
"size":10,
"totalElements":9,
"totalPages":1
}
}
}