Feature description
Deletes the information of multiple hosts at a time.
Call instructions
Interface constraints
The caller must have the HOST_MANAGER permission.
Request path
POST /api/v2/compute/hosts/batchDelete
Request parameters
body:
Parameter |
Type |
Required |
Example Value |
Description |
|---|---|---|---|---|
| hostIdList | LongArray | Yes | [1001,1002] | Host ID list. |
Return result
Basic data structure
Parameter |
Type |
Description |
|---|---|---|
| data | Object | The requested data. |
| ├─ contents | Array | An array of TaskInstance objects. For more information, see TaskInstance data structure. |
| successful | Boolean | Indicates whether the request is successful. |
| timestamp | Datetime | The timestamp when the server finishes the request. |
| duration | Integer | The time taken by the server to process the request, in milliseconds. |
| status | Integer | An HTTP status code that conforms to the HTTP standard. |
| traceId | String | The Trace ID of the request, which is used for troubleshooting. |
| server | String | The address of the application service that responds to the request. |
TaskInstance data structure
Parameter |
Type |
Description |
|---|---|---|
| id | Long | The ID of the software package. |
| name | String | The name of the software package. |
| clusterId | Long | The ID of the cluster. |
| tenantId | Long | The ID of the tenant. |
| hostId | Long | The ID of the host. |
| type | String | The task type. Valid values: |
| status | Integer | The task execution status. Valid values: |
| creator | String | The username of the task creator. |
| operation | String | The task operation. Valid values: |
| executor | String | The address of the task execution node. |
| createTime | String | The task creation time. |
| startTime | String | The task start time. |
| finishTime | String | The task end time. |
| prohibitRollback | Boolean | Indicates whether to prohibit rollback. |
| subtasks | ObjectArray | An array of SubtaskInstance objects. For more information, see SubtaskInstance data structure. |
SubtaskInstance data structure
Parameter |
Type |
Description |
|---|---|---|
| id | Long | The ID of the subtask instance. |
| name | String | The name of the subtask. |
| seriesId | Long | The ID of the subtask series. |
| description | String | The description of the subtask. |
| timeout | Integer | The timeout period of the subtask, in seconds. |
| status | String | The status of the subtask. Valid values: |
| operation | String | The operation of the subtask. Valid values: |
| executor | String | The information of the subtask execution node. |
| runTime | Integer | The number of times the subtask is executed. |
| createTime | String | The creation time of the subtask. |
| startTime | String | The start time of the subtask. |
| finishTime | String | The end time of the subtask. |
| nodeType | String | The node type, for example, JAVA_TASK. |
| paralleIdx | Integer | The parallel subtask index. -1 indicates that the subtask is not parallel. |
| upstreams | LongArray | The list of upstream subtask IDs. |
| downstream | LongArray | The list of downstream subtask IDs. |
| prohibitRollback | Boolean | Indicates whether to prohibit rollback of the subtask. |
Example
Request example
POST /api/v2/compute/hosts/batchDelete -H 'Accept: application/json' -H 'Content-Type: application/json' --data-raw '{"hostIdList":[4000002]}'
Response example
{
"data": {
"contents": [
{
"creator": "admin",
"executor": "xx.xx.xx.xx",
"hostId": 4000002,
"id": 35006655,
"name": "Prepare host",
"operation": "EXECUTE",
"startTime": "2021-08-25T19:48:49.604+08:00",
"status": "RUNNING",
"subtasks": [
{
"description": "Update host status",
"downstreams": [],
"id": 13006993,
"name": "Update host status",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 4,
"status": "PENDING",
"timeout": 1800,
"upstreams": [
13006994
]
},
{
"description": "Uninstall legacy ocp agent",
"downstreams": [
13006994
],
"id": 13006990,
"name": "Uninstall legacy ocp agent",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 2,
"status": "PENDING",
"timeout": 600,
"upstreams": [
13006991
]
},
{
"description": "Pre check for create host",
"downstreams": [
13006991
],
"id": 13006992,
"name": "Pre check for create host",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 1,
"status": "READY",
"timeout": 1800,
"upstreams": []
},
{
"description": "Install ocp agent",
"downstreams": [
13006993
],
"id": 13006994,
"name": "Install ocp agent",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 0,
"status": "PENDING",
"timeout": 5400,
"upstreams": [
13006990
]
},
{
"description": "Uninstall legacy obagent",
"downstreams": [
13006990
],
"id": 13006991,
"name": "Uninstall legacy obagent",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 3,
"status": "PENDING",
"timeout": 2100,
"upstreams": [
13006992
]
}
],
"type": "MANUAL"
}
]
},
"duration": 1118,
"server": "a83ad33525",
"status": 200,
"successful": true,
"timestamp": "2021-08-25T19:48:49.639+08:00",
"traceId": "93c00223847c4e0a"
}
