This topic describes how to query the information of a specified tenant through the API.
Call procedure
If a password is set, you must authenticate. For more information, see API hybrid encryption.
Request path
GET /api/v1/tenant/:name
Response parameters
| Parameter | Type | Description |
|---|---|---|
| successful | bool | Indicates whether the request is successful. |
| timestamp | time.Time | The timestamp when the server received the request. |
| duration | int | The time (in milliseconds) taken by the server to process the request. |
| status | int | The HTTP status code. |
| traceId | string | The Trace ID of the request. |
| data | TenantInfo | The information of the specified tenant. For more information, see Data structure of TenantInfo. |
| error | ApiError | The error information generated during the request. It contains the following fields:
|
The data structure of TenantInfo:
| Parameter | Type | Description |
|---|---|---|
| name | string | The name of the tenant. |
| id | int | The ID of the tenant. |
| created_time | time.Time | The time when the tenant was created. |
| mode | string | The tenant mode. |
| status | string | The tenant status. |
| locked | string | Whether the tenant is locked. |
| primary_zone | string | The primary zone of the tenant. |
| locality | string | The locality information of the tenant. |
| in_recyclebin | string | Whether the tenant is in the recycle bin. |
| charset | string | The character set used by the tenant. |
| collation | string | The collation used by the tenant. |
| whitelist | string | The access whitelist of the tenant. |
| pool | []ResourcePoolWithUnit | The information of the resource pools used by the tenant. For more information, see Data structure of ResourcePoolWithUnit. |
The data structure of ResourcePoolWithUnit:
| Parameter | Type | Description |
|---|---|---|
| pool_name | string | The name of the resource pool. |
| pool_id | int | The ID of the resource pool. |
| zone_list | string | The list of zones where the resource pool is located. |
| unit_num | int | The number of units in the resource pool. |
| unit_config | ObUnitConfig | The information of the resource specifications used by the resource pool. For more information, see Data structure of ObUnitConfig. |
The data structure of ObUnitConfig:
| Parameter | Type | Description |
|---|---|---|
| create_time | time.Time | The creation time of the resource specification. |
| modify_time | time.Time | The modification time of the resource specification. |
| unit_config_id | int | The ID of the resource specification. |
| name | string | The name of the resource specification. |
| max_cpu | float64 | The upper limit of the CPU specification. |
| min_cpu | float64 | The lower limit of the CPU specification. |
| memory_size | int | The memory specification. |
| log_disk_size | int | The size of the log disk space. |
| max_iops | uint | The upper limit of IOPS. |
| min_iops | uint | The lower limit of IOPS. |
Examples
Request example
GET 10.10.10.1:2886/api/v1/tenant/t1
Response example
{
"successful": true,
"timestamp": "2024-10-14T14:27:47.6484216+08:00",
"duration": 69,
"status": 200,
"traceId": "7f571f5a59e89ffa",
"data": {
"tenant_name": "t1",
"tenant_id": 1002,
"created_time": "2024-10-14T10:26:55.086821+08:00",
"mode": "MYSQL",
"status": "NORMAL",
"locked": "NO",
"primary_zone": "RANDOM",
"locality": "FULL{1}@zone2, FULL{1}@zone3",
"in_recyclebin": "NO",
"charset": "",
"collation": "",
"whitelist": "%,127.0.0.1",
"pools": [
{
"pool_name": "t1_zone2_1728872814",
"pool_id": 1002,
"zone_list": "zone2",
"unit_num": 1,
"unit_config": {
"create_time": "2024-10-14T10:26:41.286401+08:00",
"modify_time": "2024-10-14T10:26:41.286401+08:00",
"unit_config_id": 1001,
"name": "s1",
"max_cpu": 2,
"min_cpu": 2,
"memory_size": 2147483648,
"log_disk_size": 6442450944,
"max_iops": 9223372036854775807,
"min_iops": 9223372036854775807
}
},
{
"pool_name": "t1_zone3_1728872814",
"pool_id": 1003,
"zone_list": "zone3",
"unit_num": 1,
"unit_config": {
"create_time": "2024-10-14T10:26:41.286401+08:00",
"modify_time": "2024-10-14T10:26:41.286401+08:00",
"unit_config_id": 1001,
"name": "s1",
"max_cpu": 2,
"min_cpu": 2,
"memory_size": 2147483648,
"log_disk_size": 6442450944,
"max_iops": 9223372036854775807,
"min_iops": 9223372036854775807
}
}
]
}
}
References
You can also call API methods through SDKs.
For more information about how to call API methods through obshell-sdk-python, see Query tenant information.
For more information about how to call API methods through obshell-sdk-go, see Query tenant information.