aboutsummaryrefslogtreecommitdiffstats
path: root/arthur/apis/grafana/teams.py
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2024-02-13 19:23:46 +0000
committerGravatar Chris Lovering <[email protected]>2024-02-13 19:38:40 +0000
commitfdcb22e281edf9823fb715f97610e6936565be8d (patch)
tree5cfce025fe22527f3238244ed99a0bb8aeda39f8 /arthur/apis/grafana/teams.py
parentDon't keep track of the set of users added to Grafana team (diff)
Add API wrapper to remove a user from a Grafana team
Diffstat (limited to 'arthur/apis/grafana/teams.py')
-rw-r--r--arthur/apis/grafana/teams.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/arthur/apis/grafana/teams.py b/arthur/apis/grafana/teams.py
index e641d84..5d582b5 100644
--- a/arthur/apis/grafana/teams.py
+++ b/arthur/apis/grafana/teams.py
@@ -35,6 +35,18 @@ async def add_user_to_team(
return await response.json()
+async def remove_user_from_team(
+ user_id: int,
+ team_id: int,
+ session: aiohttp.ClientSession,
+) -> dict[str, str]:
+ """AdRemove a Grafana user from a team."""
+ endpoint = CONFIG.grafana_url + f"/api/teams/{team_id}/members/{user_id}"
+ async with session.delete(endpoint, headers=AUTH_HEADER) as response:
+ response.raise_for_status()
+ return await response.json()
+
+
async def get_all_users(session: aiohttp.ClientSession) -> list[dict[str, str]]:
"""Get a grafana users."""
endpoint = CONFIG.grafana_url + "/api/org/users/lookup"