From b9b151abbc56aa5fdd296cb2416a9a2b34bc040b Mon Sep 17 00:00:00 2001 From: Ihor Aleksandrychiev Date: Tue, 18 Jun 2024 16:00:04 +0300 Subject: [PATCH] Added Hosts API documentation for Delete permanently and Restore deleted hosts endpoints Ticket: ENT-8001 Signed-off-by: Ihor Aleksandrychiev --- .../health-diagnostic.markdown | 2 + api/enterprise-api-ref/host.markdown | 55 +++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/api/enterprise-api-ref/health-diagnostic.markdown b/api/enterprise-api-ref/health-diagnostic.markdown index 0bac189d1..dd9766687 100644 --- a/api/enterprise-api-ref/health-diagnostic.markdown +++ b/api/enterprise-api-ref/health-diagnostic.markdown @@ -17,6 +17,7 @@ This API provides access to health diagnostic information. ``` { "hostsNeverCollected": 1, + "deletedHostsReport": 1, "hostNotRecentlyCollected": 0, "hostsUsingSameIdentity": 0, "agentNotRunRecently": 2, @@ -37,6 +38,7 @@ This API provides access to health diagnostic information. ``` [ "hostsNeverCollected", + "deletedHostsReport", "notRecentlyCollected", "hostsUsingSameIdentity", "agentNotRunRecently", diff --git a/api/enterprise-api-ref/host.markdown b/api/enterprise-api-ref/host.markdown index 32e4180a6..8b693a95d 100644 --- a/api/enterprise-api-ref/host.markdown +++ b/api/enterprise-api-ref/host.markdown @@ -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 : -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 : -X DELETE https://hub.example.com/api/hosts/delete-permanently/SHA=2123f85b38189008ae12be159fb961584dda1249c94efed43fec2c70f233975d +``` +**Example response:** + +``` +HTTP 200 Ok +``` ## List monitoring attributes for host