API请求
URLs
GET zstack/v1/container/native/clusterGET zstack/v1/container/native/cluster/{uuid}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/container/native/cluster?q=uuid=e48dc6df7bdd3c72a790a61cb868a1aecurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/container/native/cluster/1f0ba61cdf533f10a3ea1e10c5b70364可查询字段
运行zstack-cli命令行工具,输入QueryNativeCluster并按Tab键查看所有可查询字段以及可跨表查询的资源名。
API返回
返回示例
{
"inventories": [
{
"bizUrl": "http://example.com/biz",
"masterUrl": "http://example.com/master",
"kubeConfig": "kubeConfigContent",
"prometheusURL": "http://example.com/prometheus",
"version": "v1.0.0",
"nodeCount": 3,
"createType": "Manual"
}
]
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| success | boolean | 查询接口调用是否成功 | 5.3.6 |
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 5.3.6 |
| inventories | List | 详情参考inventories | 5.3.6 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 5.3.6 |
| description | String | 错误的概要描述 | 5.3.6 |
| details | String | 错误的详细信息 | 5.3.6 |
| elaboration | String | 保留字段,默认为null | 5.3.6 |
| opaque | LinkedHashMap | 保留字段,默认为null | 5.3.6 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 5.3.6 |
#inventories
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| bizUrl | String | 业务URL | 5.3.6 |
| masterUrl | String | 主URL | 5.3.6 |
| kubeConfig | String | Kube配置 | 5.3.6 |
| prometheusURL | String | Prometheus URL | 5.3.6 |
| version | String | 版本 | 5.3.6 |
| nodeCount | Integer | 节点数量 | 5.3.6 |
| createType | String | 创建类型 | 5.3.6 |
| name | String | 资源名称 | 5.3.6 |
| uuid | String | 资源的UUID,唯一标示该资源 | 5.3.6 |
| description | String | 资源的详细描述 | 5.3.6 |
| state | String | 状态 | 5.3.6 |
| hypervisorType | String | 虚拟机管理程序类型 | 5.3.6 |
| createDate | Timestamp | 创建时间 | 5.3.6 |
| lastOpDate | Timestamp | 最后一次修改时间 | 5.3.6 |
| zoneUuid | String | 区域UUID | 5.3.6 |
| type | String | 类型 | 5.3.6 |
| architecture | String | 架构 | 5.3.6 |
SDK示例
Java
SDK
QueryNativeClusterAction action = new QueryNativeClusterAction();
action.conditions = asList("uuid=bb5a7e5472883b9199d6042076df426a");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryNativeClusterAction.Result res = action.call();Python SDK
QueryNativeClusterAction action = QueryNativeClusterAction()
action.conditions = ["uuid=ea01b939cc63315ba03f61ef9f4622c6"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryNativeClusterAction.Result res = action.call()