Skip to content

Commit eb0842c

Browse files
Added the Host cleanup API documentation
Signed-off-by: Ihor Aleksandrychiev <ihor.aleksandrychiev@northern.tech>
1 parent a9dac8b commit eb0842c

1 file changed

Lines changed: 82 additions & 0 deletions

File tree

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
layout: default
3+
title: Host cleanup API
4+
---
5+
6+
The Hosts cleanup API removes hosts from the hub based on multiple
7+
criteria configured in the hub settings.
8+
9+
## Run hosts cleanup
10+
11+
Runs all enabled cleanup stages sequentially and returns statistics for each stage.
12+
13+
**URI:** https://hub.cfengine.com/api/host-cleanup
14+
15+
**Method:** POST
16+
17+
**Prerequisites:**
18+
19+
Hosts cleanup is configured through the [hub settings][Hosts cleanup API#Settings]
20+
21+
This endpoint is not available on a [federated reporting][Federated reporting] superhub.
22+
23+
**Example request (curl):**
24+
25+
```console
26+
curl --user <username>:<password> \
27+
-X POST \
28+
https://hub.cfengine.com/api/host-cleanup
29+
```
30+
31+
**Example response:**
32+
33+
```
34+
HTTP 200 OK
35+
{
36+
"deletedHostsCleanup": {
37+
"found": 0,
38+
"permanentlyDeleted": 0,
39+
"failed": 0
40+
},
41+
"duplicateHostnameHostsCleanup": {
42+
"found": 0,
43+
"softDeleted": 0,
44+
"permanentlyDeleted": 0,
45+
"failed": 0
46+
},
47+
"duplicateIpHostsCleanup": {
48+
"found": 1,
49+
"softDeleted": 1,
50+
"permanentlyDeleted": 0,
51+
"failed": 0
52+
},
53+
"groupHostsCleanup": {
54+
"found": 0,
55+
"softDeleted": 0,
56+
"permanentlyDeleted": 0,
57+
"failed": 0
58+
},
59+
"InactiveHostsCleanup": {
60+
"found": 0,
61+
"softDeleted": 0,
62+
"permanentlyDeleted": 0,
63+
"failed": 0
64+
}
65+
}
66+
```
67+
68+
Each stage runs independently. If a stage fails, an `error` field with the error message
69+
is returned in place of the counters and the remaining stages still run. A maximum of
70+
1000 hosts is processed per stage per call.
71+
72+
**Responses:**
73+
74+
| HTTP response code | Description |
75+
| ------------------ | ---------------------------------------- |
76+
| 200 OK | Cleanup ran; the body contains per-stage statistics. |
77+
| 403 Forbidden | Endpoint called on a federated reporting superhub. |
78+
79+
## Settings
80+
81+
The behavior of each stage is controlled by the settings keys, managed
82+
through the [Status and settings REST API][Status and settings REST API#Update settings].

0 commit comments

Comments
 (0)