文档首页/ 智能数据湖 AIDataLake/ API参考/ 计算资源管理/ 查询计算资源列表 - ListV2Computes
更新时间:2026-07-13 GMT+08:00
分享

查询计算资源列表 - ListV2Computes

功能介绍

查询工作空间下的计算资源列表。用户可通过该接口获取符合过滤条件的计算资源列表,接口支持分页查询、支持通过名称、id等参数过滤。此接口为同步接口。

调用方法

请参见如何调用API

URI

GET /v2/workspaces/{workspace_id}/computes

表1 路径参数

参数

是否必选

参数类型

描述

workspace_id

String

参数解释:工作空间ID。

约束限制:不涉及。

取值范围:长度为32~36的英文字符、数字和中划线的组合。

默认取值:不涉及。

表2 Query参数

参数

是否必选

参数类型

描述

offset

Integer

参数解释:分页偏移量。

约束限制:不涉及。

取值范围:0~10000。

默认取值:0。

limit

Integer

参数解释:分页大小。

约束限制:不涉及。

取值范围:1~200。

默认取值:100。

name

String

参数解释:计算资源名称,模糊查询。

约束限制:不涉及

取值范围:遵循RFC 1035规范。小写字母、数字、中划线;字母开头;字母或数字结尾;长度为1~63的字符。

默认取值:不涉及。

compute_id

String

参数解释:计算资源ID。

约束限制:不涉及。

取值范围:长度为32~36的英文字符、数字和中划线的组合。

默认取值:不涉及。

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

参数解释:用户Token。

约束限制:不涉及。

取值范围:长度不超过65534个字符。

默认取值:不涉及。

响应参数

状态码:200

表4 响应Body参数

参数

参数类型

描述

total

Integer

参数解释:总记录数。

取值范围:0~10000。

computes

Array of V2ComputeInfo objects

参数解释:计算资源列表。

表5 V2ComputeInfo

参数

参数类型

描述

id

String

参数解释:计算资源ID。

取值范围:长度为1~36的英文字母、数字和中划线的组合。

name

String

参数解释:计算资源名称。

取值范围:长度为1~63个字符,遵循RFC 1035规范,支持小写字母、数字、中划线,必须字母开头、字母或数字结尾。

description

String

参数解释:资源描述信息。

取值范围:字符长度为0~512个字符。

charge_mode

String

参数解释:计费模式。

取值范围

  • postPaid:按需计费。

  • prePaid:包周期计费。

默认取值:不涉及。

capacity

Array of ResourceCapacityItem objects

参数解释:计算资源容量配置。

update_time

String

参数解释:资源更新时间。

取值范围:ISO 8601格式,例如2025-01-10T03:37:12.000+00:00。

create_time

String

参数解释:资源创建时间。

取值范围:ISO 8601格式,yyyy-MM-dd'T'HH:mm:ss.SSSZ。

status

String

参数解释:资源状态。

取值范围

  • PREPARING:创建中。

  • RELEASING:释放中。

  • RUNNING:运行中。

  • SCALEIN:缩容中。

  • SCALEOUT:扩容中。

  • FREEZING:冻结中。

  • DELETED:已删除。

  • DELETING:删除中。

  • FAILED:失败。

  • ORDER_PAYING:订单支付中。

creator

Creator object

参数解释:资源所有者信息。

error

Error object

参数解释:失败时返回的文本消息内容,包含错误码、错误描述。

表6 ResourceCapacityItem

参数

参数类型

描述

type

String

参数解释:资源类型。

取值范围:CPU、GPU、NPU。

capacity

Integer

参数解释:资源容量数量。

取值范围:0~48000。

spec_code

String

参数解释:规格编码。

取值范围:长度为1~64的英文字母、数字和中划线的组合。

resource_id

String

参数解释:资源ID。

取值范围:长度为1~64的英文字母、数字和中划线的组合。

表7 Creator

参数

参数类型

描述

domain_name

String

参数解释:租户名称。

取值范围:长度为1~64个字符。

domain_id

String

参数解释:租户ID。

取值范围:长度为1~64个字符。

user_name

String

参数解释:用户名称。

取值范围:长度为1~64个字符。

user_id

String

参数解释:用户ID。

取值范围:长度为1~64个字符。

表8 Error

参数

参数类型

描述

error_code

String

参数解释:失败状态时的错误编码。

取值范围:长度为0~36个字符。

error_msg

String

参数解释:失败状态时的错误信息。

取值范围:长度为0~1024个字符。

状态码:400

表9 响应Body参数

参数

参数类型

描述

error_code

String

参数解释:错误码。

取值范围:长度为8~36个字符。

error_msg

String

参数解释:错误描述。

取值范围:长度为2~512个字符。

solution_msg

String

参数解释:解决方案。

取值范围:长度为0~4096个字符。

状态码:401

表10 响应Body参数

参数

参数类型

描述

error_code

String

参数解释:错误码。

取值范围:长度为8~36个字符。

error_msg

String

参数解释:错误描述。

取值范围:长度为2~512个字符。

solution_msg

String

参数解释:解决方案。

取值范围:长度为0~4096个字符。

状态码:403

表11 响应Body参数

参数

参数类型

描述

error_code

String

参数解释:错误码。

取值范围:长度为8~36个字符。

error_msg

String

参数解释:错误描述。

取值范围:长度为2~512个字符。

solution_msg

String

参数解释:解决方案。

取值范围:长度为0~4096个字符。

状态码:404

表12 响应Body参数

参数

参数类型

描述

error_code

String

参数解释:错误码。

取值范围:长度为8~36个字符。

error_msg

String

参数解释:错误描述。

取值范围:长度为2~512个字符。

solution_msg

String

参数解释:解决方案。

取值范围:长度为0~4096个字符。

状态码:500

表13 响应Body参数

参数

参数类型

描述

error_code

String

参数解释:错误码。

取值范围:长度为8~36个字符。

error_msg

String

参数解释:错误描述。

取值范围:长度为2~512个字符。

solution_msg

String

参数解释:解决方案。

取值范围:长度为0~4096个字符。

请求示例

查询指定工作空间下的计算资源列表,支持通过名称和ID进行过滤查询,并支持分页。其中“workspace_id”为工作空间ID,用于指定查询的工作空间。

GET /v2/workspaces/{workspace_id}/computes

响应示例

状态码:200

请求成功。

{
  "total" : 3,
  "computes" : [ {
    "id" : "03141229-84cd-4b1b-9733-dd124320c125",
    "name" : "compute-01",
    "description" : "description1",
    "charge_mode" : "postPaid",
    "capacity" : [ {
      "type" : "CPU",
      "capacity" : 1000,
      "spec_code" : "aidatalake.cpu.x86.general.1c4g"
    } ],
    "update_time" : "2025-01-10T03:37:12.000+00:00",
    "create_time" : "2025-01-10T03:37:12.000+00:00",
    "status" : "RUNNING",
    "creator" : {
      "domain_name" : "domain_name",
      "domain_id" : "domain_id",
      "user_name" : "user_name",
      "user_id" : "user_id"
    }
  }, {
    "id" : "03141229-84cd-4b1b-9733-dd124320c126",
    "name" : "compute-02",
    "description" : "description2",
    "charge_mode" : "postPaid",
    "capacity" : [ {
      "type" : "CPU",
      "capacity" : 1000,
      "spec_code" : "aidatalake.cpu.x86.general.1c4g"
    } ],
    "update_time" : "2025-01-10T03:38:12.000+00:00",
    "create_time" : "2025-01-10T03:38:12.000+00:00",
    "status" : "RUNNING",
    "creator" : {
      "domain_name" : "domain_name",
      "domain_id" : "domain_id",
      "user_name" : "user_name",
      "user_id" : "user_id"
    }
  }, {
    "id" : "03141229-84cd-4b1b-9733-dd124320c127",
    "name" : "compute-01",
    "description" : "description3",
    "charge_mode" : "postPaid",
    "capacity" : [ {
      "type" : "CPU",
      "capacity" : 1000,
      "spec_code" : "aidatalake.cpu.x86.general.1c4g"
    } ],
    "update_time" : "2025-01-10T03:39:12.000+00:00",
    "create_time" : "2025-01-10T03:39:12.000+00:00",
    "status" : "RUNNING",
    "creator" : {
      "domain_name" : "domain_name",
      "domain_id" : "domain_id",
      "user_name" : "user_name",
      "user_id" : "user_id"
    }
  } ]
}

状态码:400

请求参数错误。

{
  "error_code" : "AIDataLake.00010011",
  "error_msg" : "Invalid specification code.",
  "solution_msg" : "Enter a correct specification code."
}

状态码:401

未授权。

{
  "error_code" : "APIGW.0301",
  "error_msg" : "Incorrect IAM authentication information decrypt token fail"
}

状态码:403

禁止访问。

{
  "error_code" : "AIDataLake.00010038",
  "error_msg" : "Unauthorized requests.",
  "solution_msg" : "Check permissions {xxx} and retry after authorization."
}

状态码:404

资源未找到。

{
  "error_code" : "AIDataLake.00010004",
  "error_msg" : "Not Found",
  "solution_msg" : "Please check the resource ID and try again"
}

状态码:500

内部服务器错误。

{
  "error_code" : "AIDataLake.00010067",
  "error_msg" : "Failed to initialize the task because the number of tasks may have reached the upper limit.",
  "solution_msg" : "Try again later."
}

状态码

状态码

描述

200

请求成功。

400

请求参数错误。

401

未授权。

403

禁止访问。

404

资源未找到。

500

内部服务器错误。

相关文档