接口参考地域、可用区与集群
读取主机网络状态
GET /api/v1/compute-hosts/{host_id}/network,getHostNetwork 的请求参数和响应结构。
GET /api/v1/compute-hosts/{host_id}/network
| 项目 | 内容 |
|---|---|
| 操作标识 | getHostNetwork |
| 认证 | 登录会话 Cookie |
VPC 模式与直连模式均为持久资源,网络任务由控制面协调。
请求参数
| 名称 | 位置 | 必填 | 类型 | 说明与约束 |
|---|---|---|---|---|
| host_id | path | 是 | string | 格式:uuid |
响应
| HTTP 状态 | 含义 |
|---|---|
| 200 | 成功 |
| 400 | 请求无法完成 |
| 401 | 请求无法完成 |
| 403 | 请求无法完成 |
| 404 | 请求无法完成 |
| 409 | 请求无法完成 |
| 503 | 请求无法完成 |
200 · application/json 响应结构
| 字段 | 类型 | 必填 | 说明与约束 |
|---|---|---|---|
| data | HostNetwork | 是 | — |
| request_id | string | 是 | — |
{
"$ref": "#/$defs/HostNetworkResponse",
"$defs": {
"HostNetworkResponse": {
"type": "object",
"properties": {
"data": {
"$ref": "#/$defs/HostNetwork"
},
"request_id": {
"type": "string"
}
},
"required": [
"data",
"request_id"
],
"additionalProperties": false
},
"HostNetwork": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"agent_version": {
"type": "string"
},
"ready": {
"type": "boolean"
},
"inventory": {
"allOf": [
{
"$ref": "#/$defs/HostNetworkInventory"
}
],
"nullable": true
},
"collected_at": {
"type": "string",
"format": "date-time",
"nullable": true
},
"bridges": {
"type": "array",
"items": {
"$ref": "#/$defs/HostBridgeRecord"
}
}
},
"required": [
"id",
"agent_version",
"ready",
"inventory",
"collected_at",
"bridges"
],
"additionalProperties": false
},
"HostNetworkInventory": {
"type": "object",
"properties": {
"collected_at": {
"type": "string",
"format": "date-time"
},
"interfaces": {
"type": "array",
"items": {
"$ref": "#/$defs/HostNetworkInterface"
}
},
"bridges": {
"type": "array",
"items": {
"$ref": "#/$defs/HostNetworkBridge"
}
}
},
"required": [
"collected_at",
"interfaces",
"bridges"
],
"additionalProperties": false
},
"HostNetworkInterface": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"kind": {
"type": "string"
},
"mac": {
"type": "string"
},
"state": {
"type": "string"
},
"bridge": {
"type": "string"
},
"reason": {
"type": "string"
},
"mtu": {
"type": "integer"
},
"addresses": {
"type": "array",
"items": {
"type": "string"
}
},
"protected": {
"type": "boolean"
},
"admin_up": {
"type": "boolean"
}
},
"required": [
"name",
"kind",
"mac",
"state",
"bridge",
"reason",
"mtu",
"addresses",
"protected"
],
"additionalProperties": false
},
"HostNetworkBridge": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"bond_mode": {
"type": "string"
},
"managed_id": {
"type": "string"
},
"mtu": {
"type": "integer"
},
"interfaces": {
"type": "array",
"items": {
"type": "string"
}
},
"providers": {
"type": "array",
"items": {
"type": "string"
}
},
"existing": {
"type": "boolean"
}
},
"required": [
"name",
"bond_mode",
"managed_id",
"mtu",
"interfaces",
"providers",
"existing"
],
"additionalProperties": false
},
"HostBridgeRecord": {
"type": "object",
"properties": {
"bridge_name": {
"type": "string"
},
"provider_name": {
"type": "string"
},
"state": {
"type": "string"
},
"error": {
"type": "string"
},
"id": {
"type": "string",
"format": "uuid"
},
"host_id": {
"type": "string",
"format": "uuid"
},
"config": {
"$ref": "#/$defs/HostBridgeConfig"
},
"created_at": {
"type": "string",
"format": "date-time"
}
},
"required": [
"bridge_name",
"provider_name",
"state",
"error",
"id",
"host_id",
"config",
"created_at"
],
"additionalProperties": false
},
"HostBridgeConfig": {
"type": "object",
"additionalProperties": false,
"required": [
"bridge_name",
"provider_name",
"interfaces",
"bond_mode",
"mtu",
"existing"
],
"properties": {
"bridge_name": {
"type": "string",
"pattern": "^[a-zA-Z][a-zA-Z0-9_.-]{0,14}$"
},
"provider_name": {
"type": "string",
"pattern": "^[a-zA-Z0-9_.-]{1,32}$"
},
"interfaces": {
"type": "array",
"maxItems": 8,
"uniqueItems": true,
"items": {
"type": "string"
}
},
"bond_mode": {
"type": "string",
"enum": [
"",
"active-backup",
"balance-slb",
"balance-tcp"
]
},
"mtu": {
"type": "integer",
"minimum": 1280,
"maximum": 9000
},
"existing": {
"type": "boolean"
}
}
}
}
}400 / 401 / 403 / 404 / 409 / 503 · application/json 响应结构
{
"$ref": "#/$defs/ErrorResponse",
"$defs": {
"ErrorResponse": {
"type": "object",
"additionalProperties": false,
"properties": {
"error": {
"$ref": "#/$defs/ErrorDetail"
},
"request_id": {
"type": "string"
}
},
"required": [
"error",
"request_id"
]
},
"ErrorDetail": {
"type": "object",
"additionalProperties": false,
"properties": {
"code": {
"type": "string",
"enum": [
"NOT_IMPLEMENTED",
"NOT_FOUND",
"AUTH_REQUIRED",
"FORBIDDEN",
"VALIDATION_FAILED",
"CONFLICT",
"SERVICE_UNAVAILABLE",
"INTERNAL_ERROR",
"RATE_LIMITED"
]
},
"message": {
"type": "string"
},
"retryable": {
"type": "boolean"
},
"fields": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"required": [
"code",
"message",
"retryable"
]
}
}
}响应中的 request_id 用于排查请求;异步操作以任务最终状态为准。参阅调用约定、异步任务和错误处理。
本页由版本化 OpenAPI 契约生成。通用资源响应允许的任意字段以运行服务为准,不据此推断尚未定义的字段。
