查询沙箱实例资源
更新时间:2026-11-17
接口描述
查询 Kata 沙箱实例的容器资源及资源调整状态。仅 runtimeType 为 kata 且处于运行中的沙箱支持。
API Explorer
去调试
您可以在 API Explorer 中直接运行该接口,运行成功后可自动生成 SDK 代码示例。
请求结构
Plain Text
1GET /sandboxes/{sandboxID}/resources HTTP/1.1
2Host: api.sandbox-execute.bj.baidubce.com
3Authorization: authorization string
请求头域
除公共头域外,无其他特殊头域。Authorization 支持 IAM API Key(Bearer bce-v3/ALTAK-...)或 AK/SK 签名(bce-auth-v1/...)。
请求参数
| 参数名称 | 类型 | 是否必需 | 参数位置 | 描述 |
|---|---|---|---|---|
| sandboxID | String | 是 | URL参数 | 沙箱实例 ID。 |
返回状态码
成功返回 200。沙箱未运行返回 404(sandbox is not running);非 Kata 沙箱返回 409(NOT_KATA_SANDBOX);认证失败返回 403。
返回头域
除公共头域外,无其他特殊头域。
返回参数
| 参数名称 | 类型 | 描述 |
|---|---|---|
| sandboxID | String | 沙箱实例 ID。 |
| runtimeType | String | 运行时类型,固定为 kata。 |
| status | String | 调整状态:Completed、Pending、Resizing、Infeasible、Failed。 |
| containers | List |
各容器的资源状态。 |
| conditions | List |
资源调整条件,可能省略。 |
| message | String | 状态说明,可能省略。 |
请求示例
Plain Text
1GET /sandboxes/sandbox-1/resources HTTP/1.1
2Host: api.sandbox-execute.bj.baidubce.com
3Authorization: authorization string
响应示例
Plain Text
1HTTP/1.1 200 OK
2Content-Type: application/json
3
4{
5 "sandboxID": "sandbox-1",
6 "runtimeType": "kata",
7 "status": "Completed",
8 "containers": [
9 {
10 "name": "sandbox",
11 "desired": {"cpu": "2", "memory": "2Gi"},
12 "allocated": {"cpu": "2", "memory": "2Gi"},
13 "current": {"cpu": "2", "memory": "2Gi"}
14 }
15 ]
16}
评价此篇文章
