Skip to content

Commit e0b78f1

Browse files
committed
Alerting Provisioning: Added support for the name query parameter
... to the `get_contactpoints` method, for filtering by name.
1 parent 3fc0400 commit e0b78f1

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## unreleased
44
- Async: Fixed code generator for edge cases at "smartquery" interface. Thanks, @JIAQIA.
5+
- Alerting Provisioning: Added support for the optional `name` query parameter to the
6+
`get_contactpoints` method, for filtering by name. Thanks, @devth.
57

68
## 4.3.2 (2025-03-04)
79
- Alerting: Allowed the datasource to be specified with managed alerting. Thanks, @dmyerscough.

grafana_client/elements/_async/alertingprovisioning.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,16 @@ async def delete_alertrule(self, alertrule_uid):
8181
delete_alertrule_path = "/v1/provisioning/alert-rules/%s" % alertrule_uid
8282
return await self.client.DELETE(delete_alertrule_path)
8383

84-
async def get_contactpoints(self):
84+
async def get_contactpoints(self, name=None):
8585
"""
86-
Gets all contact points
86+
Gets all contact points, optionally filtering by name.
8787
@return:
8888
"""
89-
get_contactpoints_path = "/v1/provisioning/contact-points"
90-
return await self.client.GET(get_contactpoints_path)
89+
path = "/v1/provisioning/contact-points"
90+
params = {}
91+
if name:
92+
params = {"name": name}
93+
return await self.client.GET(path, params=params)
9194

9295
async def create_contactpoint(self, contactpoint, disable_provenance=False):
9396
"""

grafana_client/elements/alertingprovisioning.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,16 @@ def delete_alertrule(self, alertrule_uid):
8181
delete_alertrule_path = "/v1/provisioning/alert-rules/%s" % alertrule_uid
8282
return self.client.DELETE(delete_alertrule_path)
8383

84-
def get_contactpoints(self):
84+
def get_contactpoints(self, name=None):
8585
"""
86-
Gets all contact points
86+
Gets all contact points, optionally filtering by name.
8787
@return:
8888
"""
89-
get_contactpoints_path = "/v1/provisioning/contact-points"
90-
return self.client.GET(get_contactpoints_path)
89+
path = "/v1/provisioning/contact-points"
90+
params = {}
91+
if name:
92+
params = {"name": name}
93+
return self.client.GET(path, params=params)
9194

9295
def create_contactpoint(self, contactpoint, disable_provenance=False):
9396
"""

0 commit comments

Comments
 (0)