wazuh / wazuh-api

Wazuh - RESTful API
https://wazuh.com
GNU General Public License v2.0
69 stars 57 forks source link

New endpoint for restarting agents by group #431

Closed druizz90 closed 5 years ago

druizz90 commented 5 years ago

Hi team,

This PR closes #411. I added a new endpoint for restarting agents by group:

# curl -u foo:bar -k -X PUT "http://127.0.0.1:55000/agents/groups/default/restart?pretty"
{
   "error": 0,
   "data": {
      "msg": "All selected agents were restarted",
      "affected_agents": [
         "001",
         "002",
         "003"
      ]
   }
}
# curl -u foo:bar -k -X PUT "http://127.0.0.1:55000/agents/groups/dmz/restart?pretty"
{
   "error": 1732,
   "message": "No agents selected"
}
# curl -u foo:bar -k -X PUT "http://127.0.0.1:55000/agents/groups/dmzzz/restart?pretty"
{
   "error": 1710,
   "message": "The group does not exist"
}

There are more details about mocha and unit tests in #411.

Best regards,

Demetrio.