首批通过分布式安全可靠测评,为关键业务系统打造
新增机型
更新时间:2023-08-10 11:45:58
功能说明
添加主机机型信息。
调用说明
接口约束
调用者需要具备 HOST_MANAGER 权限。
请求路径
POST /api/v2/compute/hostTypes
请求参数
| 参数 | 类型 | 必选 | 示例值 | 描述 |
|---|---|---|---|---|
| name | String | 是 | small | 机型名称 |
| description | String | 否 | 2core 16gb | 机型描述信息 |
返回结果
| 参数 | 类型 | 说明 |
|---|---|---|
| data | Object | 请求的 HostType 信息 |
| successful | Boolean | 请求是否成功 |
| timestamp | Datetime | 服务端完成请求的时间戳 |
| duration | Integer | 服务端处理请求的时间(毫秒) |
| status | Integer | 符合 HTTP Status 规范的编码 |
| traceId | String | 请求的 Trace Id,用于排查问题 |
| server | String | 响应请求的应用服务的地址 |
HostType 的数据结构
| 参数 | 类型 | 说明 |
|---|---|---|
| id | Long | 机型 ID |
| name | String | 机型名称 |
| description | String | 机型描述信息 |
| createTime | String | 机型创建时间 |
| updateTime | String | 机型修改时间 |
示例
请求示例
POST /api/v2/compute/hostTypes
curl --user <username>:<password> -X POST 'http://<IP>:<PORT>/api/v2/compute/hostTypes' \
-H 'Content-Type: application/json' \
--data-raw '{"name":"tiny","description":"2core 16gb"}' \
返回示例
{
"data": {
"createTime": null,
"id": 1000001,
"name": "tiny",
"updateTime": null
},
"duration": 35,
"server": "a83ad33525",
"status": 200,
"successful": true,
"timestamp": "2021-08-25T16:53:00.678+08:00",
"traceId": "33097730537744ca"
}