From bdf2dcdd2c79fa58ee97e5fa8191bd3e3eee3f0b Mon Sep 17 00:00:00 2001 From: sbgap Date: Fri, 15 Mar 2024 10:39:55 +0100 Subject: [PATCH] feat: add reactivate notification rules command --- alertaclient/api.py | 3 +++ .../commands/cmd_reactivate_notification_rules.py | 9 +++++++++ 2 files changed, 12 insertions(+) create mode 100644 alertaclient/commands/cmd_reactivate_notification_rules.py diff --git a/alertaclient/api.py b/alertaclient/api.py index d75ae98..f3931a8 100644 --- a/alertaclient/api.py +++ b/alertaclient/api.py @@ -495,6 +495,9 @@ def housekeeping(self, expired_delete_hours=None, info_delete_hours=None): def escalate(self): self.http.session.get(self.http.endpoint + '/escalate', auth=self.http.auth, timeout=self.http.timeout) + def reactivate_notification_rules(self): + self.http.session.get(self.http.endpoint + '/notificationrules/reactivate', auth=self.http.auth, timeout=self.http.timeout) + class ApiKeyAuth(AuthBase): diff --git a/alertaclient/commands/cmd_reactivate_notification_rules.py b/alertaclient/commands/cmd_reactivate_notification_rules.py new file mode 100644 index 0000000..10a45db --- /dev/null +++ b/alertaclient/commands/cmd_reactivate_notification_rules.py @@ -0,0 +1,9 @@ +import click + + +@click.command('reactivate_notitification_rules', short_help='Reactivate inactive notification rules after reactivate time is up') +@click.pass_obj +def cli(obj): + """Trigger reactivation of notification rules""" + client = obj['client'] + client.reactivate_notification_rules()