Skip to content

Commit

Permalink
Added Hosts API documentation for Delete permanently and Restore dele…
Browse files Browse the repository at this point in the history
…ted hosts endpoints

Ticket: ENT-8001
Signed-off-by: Ihor Aleksandrychiev <[email protected]>
  • Loading branch information
aleksandrychev committed Jul 18, 2024
1 parent 01ff10a commit b9b151a
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
2 changes: 2 additions & 0 deletions api/enterprise-api-ref/health-diagnostic.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ This API provides access to health diagnostic information.
```
{
"hostsNeverCollected": 1,
"deletedHostsReport": 1,
"hostNotRecentlyCollected": 0,
"hostsUsingSameIdentity": 0,
"agentNotRunRecently": 2,
Expand All @@ -37,6 +38,7 @@ This API provides access to health diagnostic information.
```
[
"hostsNeverCollected",
"deletedHostsReport",
"notRecentlyCollected",
"hostsUsingSameIdentity",
"agentNotRunRecently",
Expand Down
55 changes: 55 additions & 0 deletions api/enterprise-api-ref/host.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,61 @@ HTTP 200 Ok
}
```

## Restore deleted hosts entry

**URI:** https://hub.cfengine.com/api/hosts/restore-deleted/:host-id

**Method:** POST

Restore host entry in reporting database.

Note: to be able to perform this action related RBAC rule (alias `hosts-undelete.post`) should be enabled.

**Responses:**

| HTTP response code | Description |
|---------------------------|----------------------------|
| 200 OK | Host is found and restored |
| 404 NOT FOUND | Host is not found |
| 500 Internal server error | Internal server error |

**Example request (curl):**
```
curl -k --user <username>:<password> -X POST https://hub.example.com/api/hosts/restore-deleted/SHA=2123f85b38189008ae12be159fb961584dda1249c94efed43fec2c70f233975d
```
**Example response:**

```
HTTP 200 Ok
```

## Permanently delete host entry

**URI:** https://hub.cfengine.com/api/hosts/delete-permanently/:host-id

**Method:** POST

Permanently deletes host entry from the reporting database.

Note: to be able to perform this action related RBAC rule (alias `hosts-delete-permanently.delete`) should be enabled.

**Responses:**

| HTTP response code | Description |
|---------------------------|-----------------------------------------------|
| 200 OK | Deleted host is found and removed permanently |
| 404 NOT FOUND | Host is not found |
| 500 Internal server error | Internal server error |

**Example request (curl):**
```
curl -k --user <username>:<password> -X DELETE https://hub.example.com/api/hosts/delete-permanently/SHA=2123f85b38189008ae12be159fb961584dda1249c94efed43fec2c70f233975d
```
**Example response:**

```
HTTP 200 Ok
```

## List monitoring attributes for host

Expand Down

0 comments on commit b9b151a

Please sign in to comment.