We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8ab04ee commit 24cc476Copy full SHA for 24cc476
2 files changed
alertaclient/api.py
@@ -265,6 +265,13 @@ def userinfo(self):
265
def mgmt_status(self):
266
return self.http.get('/management/status')
267
268
+ def housekeeping(self):
269
+ # This endpoint isn't currently JSON-encoded.
270
+ url = self.http.endpoint + "/management/housekeeping"
271
+ response = self.http.session.get(url, auth=self.http.auth, timeout=self.http.timeout)
272
+ if response.status_code != 200:
273
+ raise UnknownError(response.text)
274
+
275
276
class ApiAuth(AuthBase):
277
alertaclient/commands/cmd_housekeeping.py
@@ -0,0 +1,9 @@
1
+import click
2
3
4
+@click.command('housekeeping', short_help='Expired and clears old alerts.')
5
+@click.pass_obj
6
+def cli(obj):
7
+ """Trigger the expiration and deletion of alerts."""
8
+ client = obj['client']
9
+ client.housekeeping()
0 commit comments