From 61d972f00f2cc82f40dbc05bd9bf7457ed7aeac8 Mon Sep 17 00:00:00 2001 From: Daniel Deutsch Date: Fri, 23 Jul 2021 17:13:32 +0200 Subject: [PATCH] Add server_reboot route + version bump --- cbw_api_toolbox/cbw_api.py | 9 +++++++++ setup.py | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cbw_api_toolbox/cbw_api.py b/cbw_api_toolbox/cbw_api.py index 991c473..8204593 100644 --- a/cbw_api_toolbox/cbw_api.py +++ b/cbw_api_toolbox/cbw_api.py @@ -794,3 +794,12 @@ def operating_systems(self): logging.error("Error::{}".format(response.text)) return None return self._cbw_parser(response) + + def server_reboot(self, server_id, params=None): + """POST request to /api/v3/vulnerabilities/servers//reboot to reboot a server""" + response = self._request("PATCH", [ROUTE_SERVERS, server_id, "reboot"], params) + if response.status_code != 200: + logging.error("Error::{}".format(response.text)) + return None + + return self._cbw_parser(response) diff --git a/setup.py b/setup.py index f810591..24f60f7 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ description='CyberWatch Api Tools.', long_description=open('README.md').read().strip(), long_description_content_type="text/markdown", - version='2.2.2', + version='2.2.3', author='CyberWatch SAS', author_email='support-it+api@cyberwatch.fr', license='MIT',