diff --git a/grafana_client/elements/_async/alertingprovisioning.py b/grafana_client/elements/_async/alertingprovisioning.py index 547741c..4f19d0f 100644 --- a/grafana_client/elements/_async/alertingprovisioning.py +++ b/grafana_client/elements/_async/alertingprovisioning.py @@ -145,6 +145,14 @@ async def set_notification_policy_tree(self, notification_policy_tree, disable_p set_notification_policy_tree_path = "/v1/provisioning/policies" return await self.client.PUT(set_notification_policy_tree_path, json=notification_policy_tree, headers=headers) + async def delete_notification_policy_tree(self): + """ + Removes notification policy tree + @return: + """ + delete_notification_policy_tree_path = "/v1/provisioning/policies" + return await self.client.DELETE(delete_notification_policy_tree_path) + async def get_mute_timings(self): """ Gets all mute timings diff --git a/grafana_client/elements/alertingprovisioning.py b/grafana_client/elements/alertingprovisioning.py index 821bd04..8d3bb93 100644 --- a/grafana_client/elements/alertingprovisioning.py +++ b/grafana_client/elements/alertingprovisioning.py @@ -145,6 +145,14 @@ def set_notification_policy_tree(self, notification_policy_tree, disable_provena set_notification_policy_tree_path = "/v1/provisioning/policies" return self.client.PUT(set_notification_policy_tree_path, json=notification_policy_tree, headers=headers) + def delete_notification_policy_tree(self): + """ + Removes notification policy tree + @return: + """ + delete_notification_policy_tree_path = "/v1/provisioning/policies" + return self.client.DELETE(delete_notification_policy_tree_path) + def get_mute_timings(self): """ Gets all mute timings diff --git a/test/elements/test_alertingprovisioning.py b/test/elements/test_alertingprovisioning.py index 7d9c6a9..d7c3a85 100644 --- a/test/elements/test_alertingprovisioning.py +++ b/test/elements/test_alertingprovisioning.py @@ -115,3 +115,10 @@ def test_update_alertrule_disable_provenance(self, m): headers = history[0].headers self.assertIn("X-Disable-Provenance", headers) self.assertEqual(headers["X-Disable-Provenance"], "true") + + @requests_mock.Mocker() + def test_delete_notification_policy_tree(self, m): + JSON_RESPONSE = {"receiver": "grafana-default-email", "group_by": ["grafana_folder", "alertname"]} + + m.delete("http://localhost/api/v1/provisioning/policies", json=JSON_RESPONSE) + self.grafana.alertingprovisioning.delete_notification_policy_tree()