API请求
URLs
POST zstack/v1/ai/model-centersHeaders
Authorization: OAuth the-session-uuidBody
{
"param": {
"name": "AI model center",
"url": "192.168.10.12:/ai/model_center",
"description": "This is an example ai model center",
"managementIp": "172.25.141.105",
"managementPort": 5000,
"parameters": "mount parameters",
"storageNetworkUuid": "0c9ba7549e3040bca64354764b4f9907",
"serviceNetworkUuid": "aa6c5b05b55f4d6a9e063855fdfedf0b",
"containerRegistry": "172.27.142.13:10043/registry"
},
"systemTags": [],
"userTags": []
}说明: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"param":{"name":"AI model center","url":"192.168.10.12:/ai/model_center","description":"This is an example ai model center","managementIp":"172.25.141.105","managementPort":5000,"parameters":"mount parameters","storageNetworkUuid":"add09eeb27f24ab5b731a0de2a2b2f84","serviceNetworkUuid":"691d741251a14fd8aa921c0322d37c82","containerRegistry":"172.27.142.13:10043/registry"}}' http://localhost:8080/zstack/v1/ai/model-centers参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| name | String | body(包含在param结构中) | 资源名称 | 5.1.8 | |
| url | String | body(包含在param结构中) | 模型存储的url | 5.1.8 | |
| description (可选) | String | body(包含在param结构中) | 资源的详细描述 | 5.1.8 | |
| parameters (可选) | String | body(包含在param结构中) | 模型中心的更多参数 | 5.1.8 | |
| systemTags (可选) | List | body | 系统标签 | 5.1.8 | |
| userTags (可选) | List | body | 用户标签 | 5.1.8 | |
| managementIp | String | body(包含在param结构中) | 5.1.8 | ||
| managementPort | Integer | body(包含在param结构中) | 5.1.8 | ||
| storageNetworkUuid (可选) | String | body(包含在param结构中) | 5.1.8 | ||
| serviceNetworkUuid (可选) | String | body(包含在param结构中) | 5.1.8 | ||
| containerRegistry (可选) | String | body(包含在param结构中) | 5.1.8 | ||
| containerNetwork (可选) | String | body(包含在param结构中) | 5.1.8 | ||
| resourceUuid (可选) | String | body(包含在param结构中) | 资源UUID | 5.1.8 | |
| tagUuids (可选) | List | body(包含在param结构中) | 标签UUID列表 | 5.1.8 | |
| containerStorageNetwork (可选) | String | body(包含在param结构中) | 5.1.20 | ||
| zoneUuid (可选) | String | body(包含在param结构中) | 区域UUID | 5.3.28 |
API返回
返回示例
{
"inventory": {
"description": "",
"managementPort": 0
}
}#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 5.1.8 |
| description | String | 错误的概要描述 | 5.1.8 |
| details | String | 错误的详细信息 | 5.1.8 |
| elaboration | String | 保留字段,默认为null | 5.1.8 |
| opaque | LinkedHashMap | 保留字段,默认为null | 5.1.8 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 5.1.8 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标识该资源 | 5.1.8 |
| name | String | 资源名称 | 5.1.8 |
| description | String | 资源的详细描述 | 5.1.8 |
| url | String | 模型中心URL | 5.1.8 |
| status | String | 模型中心状态 | 5.1.8 |
| parameters | String | 模型中心参数 | 5.1.8 |
| managementIp | String | 管理IP地址 | 5.1.8 |
| managementPort | Integer | 管理端口 | 5.1.8 |
| storageNetworkUuid | String | 存储网络UUID | 5.1.8 |
| serviceNetworkUuid | String | 服务网络UUID | 5.1.8 |
| containerRegistry | String | 容器镜像仓库地址 | 5.1.8 |
| containerStorageNetwork | String | 容器存储网络 | 5.1.8 |
| containerNetwork | String | 容器网络 | 5.1.8 |
| capacity | ModelCenterCapacityInventory | 模型中心容量信息 | 5.1.8 |
| zdfs | ZdfsInventory | ZDFS信息 | 5.1.8 |
| createDate | Timestamp | 创建时间 | 5.1.8 |
| lastOpDate | Timestamp | 最后一次修改时间 | 5.1.8 |
SDK示例
Java SDK
AddModelCenterAction action = new AddModelCenterAction();
action.name = "AI model center";
action.url = "192.168.10.12:/ai/model_center";
action.description = "This is an example ai model center";
action.managementIp = "172.25.141.105";
action.managementPort = 5000;
action.parameters = "mount parameters";
action.storageNetworkUuid = "b84661a4e4b94ab382405434ff8eb452";
action.serviceNetworkUuid = "bfe92d92abfe46889314bcf0daafccf3";
action.containerRegistry = "172.27.142.13:10043/registry";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddModelCenterAction.Result res = action.call();Python SDK
AddModelCenterAction action = AddModelCenterAction()
action.name = "AI model center"
action.url = "192.168.10.12:/ai/model_center"
action.description = "This is an example ai model center"
action.managementIp = "172.25.141.105"
action.managementPort = 5000
action.parameters = "mount parameters"
action.storageNetworkUuid = "003bebbd44d44660a4eba0b124b3dec8"
action.serviceNetworkUuid = "6d3461cdab1c4dc595fc98015dca2f04"
action.containerRegistry = "172.27.142.13:10043/registry"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddModelCenterAction.Result res = action.call()