API请求
URLs
POST zstack/v1/ai/model-services/templatesHeaders
Authorization: OAuth the-session-uuidBody
{
"param": {
"modelUuids": [
"0e8d393b09f3438ba3640e284b372b65",
"7adf8be762104a6e839eb2564a76c88e"
],
"modelServiceUuids": [
"b815d4c020294afd97baadf1538c1bc5",
"9b2e9fa3d27f425ea1cfbbcdaa1cfa1d"
],
"zoneUuid": "zoneUuidExample",
"name": "model-service-template-match",
"type": "VirtualMachine",
"instanceNumber": 1
},
"systemTags": [],
"userTags": []
}说明: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"param":{"modelUuids":["dd797de5db0c47a086aadf70a2ed923d","5339095bcfed4fc687b6c694e4cb73aa"],"modelServiceUuids":["b00d2df20b404b20b64c0088c5aa82b2","a360fe3563054e02ab5c12f18ca42d4d"],"zoneUuid":"zoneUuidExample","name":"model-service-template-match","type":"VirtualMachine","instanceNumber":1}}' \
http://localhost:8080/zstack/v1/ai/model-services/templates参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| modelUuids | List | body(包含在param结构中) | 5.4.0 | ||
| modelServiceUuids | List | body(包含在param结构中) | 5.4.0 | ||
| uuid (可选) | String | body(包含在param结构中) | 资源的UUID,唯一标示该资源 | 5.4.0 | |
| description (可选) | String | body(包含在param结构中) | 资源的详细描述 | 5.4.0 | |
| modelUuid (可选) | String | body(包含在param结构中) | 5.4.0 | ||
| zoneUuid | String | body(包含在param结构中) | 区域UUID | 5.4.0 | |
| vmImageUuid (可选) | String | body(包含在param结构中) | 5.4.0 | ||
| primaryStorageUuid (可选) | String | body(包含在param结构中) | 主存储UUID | 5.4.0 | |
| datasetUuids (可选) | List | body(包含在param结构中) | 5.4.0 | ||
| modelServiceGroupUuids (可选) | List | body(包含在param结构中) | 5.4.0 | ||
| dockerImage (可选) | String | body(包含在param结构中) | 5.4.0 | ||
| cpuNum (可选) | Integer | body(包含在param结构中) | 5.4.0 | ||
| name | String | body(包含在param结构中) | 资源名称 | 5.4.0 | |
| environmentVariables (可选) | Map | body(包含在param结构中) | 5.4.0 | ||
| startupParameters (可选) | Map | body(包含在param结构中) | 5.4.0 | ||
| type | String | body(包含在param结构中) |
|
5.4.0 | |
| clusterUuid (可选) | String | body(包含在param结构中) | 集群UUID | 5.4.0 | |
| memorySize (可选) | Long | body(包含在param结构中) | 5.4.0 | ||
| l3NetworkUuids (可选) | List | body(包含在param结构中) | 5.4.0 | ||
| serviceBootUptime (可选) | Integer | body(包含在param结构中) | 5.4.0 | ||
| rootDiskOfferingUuid (可选) | String | body(包含在param结构中) | 5.4.0 | ||
| rootDiskSize (可选) | Long | body(包含在param结构中) | 5.4.0 | ||
| resourceUuid (可选) | String | body(包含在param结构中) | 资源UUID | 5.4.0 | |
| tagUuids (可选) | List | body(包含在param结构中) | 标签UUID列表 | 5.4.0 | |
| systemTags (可选) | List | body | 系统标签 | 5.4.0 | |
| userTags (可选) | List | body | 用户标签 | 5.4.0 | |
| instanceNumber | Integer | body(包含在param结构中) | 实例数量 | 5.4.2 | |
| requestCpuNum (可选) | Integer | body | 请求CPU数量。 | 5.5.22 | |
| requestMemorySize (可选) | Long | body | 请求内存大小。 | 5.5.22 | |
| serviceLivez (可选) | String | body | 服务存活探针。 | 5.5.22 | |
| serviceReadyz (可选) | String | body | 服务就绪探针。 | 5.5.22 | |
| projectUuid (可选) | String | body | 项目UUID。 | 5.5.22 |
API返回
返回示例
{
"result": {
"modelUuid": {
"modelServiceUuid": [
{
"status": "Matched",
"name": "CpuArchitecture",
"fieldName": "cpuArchitecture",
"fieldValue": "X86_64",
"comments": "matched"
}
]
}
}
}返回字段
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| success | Boolean | 操作是否成功 | 5.1.8 |
| error | ErrorCode | 错误码,操作成功时该字段为null | 5.1.8 |
| result | Map | 模型和模型服务模板的匹配结果 | 5.1.8 |
#ModelServiceMatchEntry
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| status | String | 匹配状态 | 5.1.8 |
| name | String | 匹配项名称 | 5.1.8 |
| fieldName | String | 字段名称 | 5.1.8 |
| fieldValue | String | 字段值 | 5.1.8 |
| comments | String | 匹配说明 | 5.1.8 |
SDK示例
Java
SDK
MatchModelServiceTemplateWithModelAction action = new MatchModelServiceTemplateWithModelAction();
action.modelUuids = asList("43a7a2a5af774e7383bf3cbea7116cee","c9123c3623ca462586cacf0604cf14b3");
action.modelServiceUuids = asList("352f1764baec41508b79de73ae0e7261","44d47074f2304d52a62b00e346eae34e");
action.zoneUuid = "zoneUuidExample";
action.name = "model-service-template-match";
action.type = "VirtualMachine";
action.instanceNumber = 1;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
MatchModelServiceTemplateWithModelAction.Result res = action.call();Python
SDK
MatchModelServiceTemplateWithModelAction action = MatchModelServiceTemplateWithModelAction()
action.modelUuids = ["5d192b7089934b3e9384a22e5c9baba5", "76bb5d31a7254421bae12b2577ea546a"]
action.modelServiceUuids = ["46a1f1ff864c4500a0245fd6776d6382", "6b8ab783bc344343b004bc43c2ee8bbd"]
action.zoneUuid = "zoneUuidExample"
action.name = "model-service-template-match"
action.type = "VirtualMachine"
action.instanceNumber = 1
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
MatchModelServiceTemplateWithModelAction.Result res = action.call()