From 4ef207dc239747f1f5ce3ab4f83950eacfe731da Mon Sep 17 00:00:00 2001 From: sbgap Date: Mon, 23 Oct 2023 16:31:20 +0200 Subject: [PATCH] feat: add escalation rules --- alertaclient/api.py | 3 +++ alertaclient/commands/cmd_escalate.py | 9 +++++++++ 2 files changed, 12 insertions(+) create mode 100644 alertaclient/commands/cmd_escalate.py diff --git a/alertaclient/api.py b/alertaclient/api.py index 4ab8e47..634dd46 100644 --- a/alertaclient/api.py +++ b/alertaclient/api.py @@ -492,6 +492,9 @@ def housekeeping(self, expired_delete_hours=None, info_delete_hours=None): if response.status_code != 200: raise UnknownError(response.text) + def escalate(self): + self.http.session.get('escalate', auth=self.http.auth) + class ApiKeyAuth(AuthBase): diff --git a/alertaclient/commands/cmd_escalate.py b/alertaclient/commands/cmd_escalate.py new file mode 100644 index 0000000..7fb3a8d --- /dev/null +++ b/alertaclient/commands/cmd_escalate.py @@ -0,0 +1,9 @@ +import click + + +@click.command('escalate', short_help='Escalate alerts using escaltion rules') +@click.pass_obj +def cli(obj): + """Trigger escalation of alerts""" + client = obj['client'] + client.escalate()