terrakio-core 0.4.98__py3-none-any.whl → 0.4.98.1b3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of terrakio-core might be problematic. Click here for more details.
- terrakio_core/async_client.py +26 -169
- terrakio_core/config.py +3 -44
- terrakio_core/endpoints/auth.py +96 -47
- terrakio_core/endpoints/dataset_management.py +120 -54
- terrakio_core/endpoints/group_management.py +269 -76
- terrakio_core/endpoints/mass_stats.py +704 -581
- terrakio_core/endpoints/model_management.py +213 -109
- terrakio_core/endpoints/user_management.py +106 -21
- terrakio_core/exceptions.py +371 -1
- terrakio_core/sync_client.py +9 -124
- {terrakio_core-0.4.98.dist-info → terrakio_core-0.4.98.1b3.dist-info}/METADATA +2 -1
- terrakio_core-0.4.98.1b3.dist-info/RECORD +23 -0
- terrakio_core-0.4.98.dist-info/RECORD +0 -23
- {terrakio_core-0.4.98.dist-info → terrakio_core-0.4.98.1b3.dist-info}/WHEEL +0 -0
|
@@ -1,12 +1,33 @@
|
|
|
1
1
|
from typing import Dict, Any
|
|
2
|
+
|
|
2
3
|
from ..helper.decorators import require_token, require_api_key, require_auth
|
|
3
|
-
|
|
4
|
+
from ..exceptions import (
|
|
5
|
+
ListGroupsError,
|
|
6
|
+
GetGroupError,
|
|
7
|
+
GetGroupDatasetsError,
|
|
8
|
+
NoDatasetsFoundForGroupError,
|
|
9
|
+
CreateGroupError,
|
|
10
|
+
DeleteGroupError,
|
|
11
|
+
AddUserToGroupError,
|
|
12
|
+
AddGroupToDatasetError,
|
|
13
|
+
AddUserToDatasetError,
|
|
14
|
+
RemoveUserFromGroupError,
|
|
15
|
+
RemoveUserFromDatasetError,
|
|
16
|
+
GroupNotFoundError,
|
|
17
|
+
GroupPermissionError,
|
|
18
|
+
CommandPermissionError,
|
|
19
|
+
UserNotFoundError,
|
|
20
|
+
DatasetNotFoundError,
|
|
21
|
+
RemoveGroupFromDatasetError,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
class GroupManagement:
|
|
4
25
|
"""Base class with common group management methods."""
|
|
5
26
|
def __init__(self, client):
|
|
6
27
|
self._client = client
|
|
7
28
|
|
|
8
29
|
@require_api_key
|
|
9
|
-
def get_group_datasets(self, group: str, collection: str = "terrakio-datasets") -> Dict[str, Any]:
|
|
30
|
+
async def get_group_datasets(self, group: str, collection: str = "terrakio-datasets") -> Dict[str, Any]:
|
|
10
31
|
"""
|
|
11
32
|
Get datasets of a group.
|
|
12
33
|
|
|
@@ -18,13 +39,49 @@ class BaseGroupManagement:
|
|
|
18
39
|
API response data
|
|
19
40
|
|
|
20
41
|
Raises:
|
|
21
|
-
|
|
42
|
+
GetGroupDatasetsError: If the API request fails
|
|
22
43
|
"""
|
|
23
44
|
params = {"collection": collection}
|
|
24
|
-
|
|
45
|
+
response, status = await self._client._terrakio_request("GET", f"/groups/{group}/datasets", params=params)
|
|
46
|
+
if status != 200:
|
|
47
|
+
if status == 404:
|
|
48
|
+
raise NoDatasetsFoundForGroupError(f"No datasets found for group {group}", status_code = status)
|
|
49
|
+
raise GetGroupDatasetsError(f"Get group datasets failed with status {status}", status_code = status)
|
|
50
|
+
else:
|
|
51
|
+
return response
|
|
52
|
+
|
|
53
|
+
@require_api_key
|
|
54
|
+
async def add_user_to_dataset(self, dataset: str, emails: list[str]) -> Dict[str, Any]:
|
|
55
|
+
"""
|
|
56
|
+
Add a user to a dataset.
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
dataset: Name of the dataset
|
|
60
|
+
email: List of user emails to add to the dataset
|
|
61
|
+
|
|
62
|
+
Returns:
|
|
63
|
+
API response data
|
|
64
|
+
|
|
65
|
+
Raises:
|
|
66
|
+
UserNotFoundError: If the user is not found
|
|
67
|
+
DatasetNotFoundError: If the dataset is not found
|
|
68
|
+
AddUserToDatasetError: If the API request fails
|
|
69
|
+
"""
|
|
70
|
+
payload = {"emails": emails}
|
|
71
|
+
response, status = await self._client._terrakio_request("POST", f"/datasets/{dataset}/share", json = payload)
|
|
72
|
+
if status != 200:
|
|
73
|
+
if status == 404:
|
|
74
|
+
detail = response.get("detail", "")
|
|
75
|
+
if "User" in detail and "not found" in detail:
|
|
76
|
+
raise UserNotFoundError(detail, status_code = status)
|
|
77
|
+
elif "Dataset" in detail and "not found" in detail:
|
|
78
|
+
raise DatasetNotFoundError(detail, status_code = status)
|
|
79
|
+
raise AddUserToDatasetError(f"Add user to dataset failed with status {status}", status_code = status)
|
|
80
|
+
else:
|
|
81
|
+
return response
|
|
25
82
|
|
|
26
83
|
@require_api_key
|
|
27
|
-
def add_user_to_group(self, group: str, emails: list[str]) -> Dict[str, Any]:
|
|
84
|
+
async def add_user_to_group(self, group: str, emails: list[str]) -> Dict[str, Any]:
|
|
28
85
|
"""
|
|
29
86
|
Add a user to a group.
|
|
30
87
|
|
|
@@ -34,57 +91,115 @@ class BaseGroupManagement:
|
|
|
34
91
|
|
|
35
92
|
Returns:
|
|
36
93
|
API response data
|
|
94
|
+
|
|
95
|
+
Raises:
|
|
96
|
+
UserNotFoundError: If the user is not found
|
|
97
|
+
GroupNotFoundError: If the group is not found
|
|
98
|
+
AddUserToGroupError: If the API request fails
|
|
37
99
|
"""
|
|
38
100
|
payload = {"emails": emails}
|
|
39
|
-
|
|
101
|
+
response, status = await self._client._terrakio_request("POST", f"/groups/{group}/users", json = payload)
|
|
102
|
+
if status != 200:
|
|
103
|
+
if status == 404:
|
|
104
|
+
detail = response.get("detail", "")
|
|
105
|
+
if "User" in detail:
|
|
106
|
+
raise UserNotFoundError(detail, status_code = status)
|
|
107
|
+
elif "Group" in detail:
|
|
108
|
+
raise GroupNotFoundError(detail, status_code = status)
|
|
109
|
+
raise AddUserToGroupError(f"Add user to group failed with status {status}", status_code = status)
|
|
110
|
+
else:
|
|
111
|
+
return response
|
|
40
112
|
|
|
41
113
|
@require_api_key
|
|
42
|
-
def
|
|
114
|
+
async def remove_user_from_group(self, group: str, emails: list[str]) -> Dict[str, Any]:
|
|
43
115
|
"""
|
|
44
|
-
|
|
116
|
+
Remove a user from a group.
|
|
45
117
|
|
|
46
118
|
Args:
|
|
47
|
-
|
|
48
|
-
|
|
119
|
+
group: Name of the group
|
|
120
|
+
email: List of user emails to remove from the group
|
|
49
121
|
|
|
50
122
|
Returns:
|
|
51
123
|
API response data
|
|
52
|
-
"""
|
|
53
|
-
payload = {"id": id}
|
|
54
|
-
return self._client._terrakio_request("POST", f"/datasets/{dataset}/groups", json = payload)
|
|
55
124
|
|
|
125
|
+
Raises:
|
|
126
|
+
UserNotFoundError: If the user is not found
|
|
127
|
+
GroupNotFoundError: If the group is not found
|
|
128
|
+
RemoveUserFromGroupError: If the API request fails
|
|
129
|
+
"""
|
|
130
|
+
payload = {"emails": emails}
|
|
131
|
+
response, status = await self._client._terrakio_request("DELETE", f"/groups/{group}/users", json = payload)
|
|
132
|
+
if status != 200:
|
|
133
|
+
if status == 404:
|
|
134
|
+
detail = response.get("detail", "")
|
|
135
|
+
if "User" in detail:
|
|
136
|
+
raise UserNotFoundError(detail, status_code = status)
|
|
137
|
+
elif "Group" in detail:
|
|
138
|
+
raise GroupNotFoundError(detail, status_code = status)
|
|
139
|
+
raise RemoveUserFromGroupError(f"Remove user from group failed with status {status}", status_code = status)
|
|
140
|
+
else:
|
|
141
|
+
return response
|
|
142
|
+
|
|
56
143
|
@require_api_key
|
|
57
|
-
def
|
|
144
|
+
async def add_group_to_dataset(self, dataset: str, id: str) -> Dict[str, Any]:
|
|
58
145
|
"""
|
|
59
|
-
Add a
|
|
146
|
+
Add a group to a dataset.
|
|
60
147
|
|
|
61
148
|
Args:
|
|
62
149
|
dataset: Name of the dataset
|
|
63
|
-
|
|
150
|
+
id: Group ID
|
|
64
151
|
|
|
65
152
|
Returns:
|
|
66
153
|
API response data
|
|
154
|
+
|
|
155
|
+
Raises:
|
|
156
|
+
AddGroupToDatasetError: If the API request fails
|
|
157
|
+
DatasetNotFoundError: If the dataset is not found
|
|
158
|
+
GroupNotFoundError: If the group is not found
|
|
67
159
|
"""
|
|
68
|
-
payload = {"
|
|
69
|
-
|
|
160
|
+
payload = {"id": id}
|
|
161
|
+
response, status = await self._client._terrakio_request("POST", f"/datasets/{dataset}/groups", json = payload)
|
|
162
|
+
if status != 200:
|
|
163
|
+
if status == 404:
|
|
164
|
+
if "Dataset" in response.get("detail", ""):
|
|
165
|
+
raise DatasetNotFoundError(response.get("detail", ""), status_code = status)
|
|
166
|
+
elif "Group" in response.get("detail", ""):
|
|
167
|
+
raise GroupNotFoundError(response.get("detail", ""), status_code = status)
|
|
168
|
+
raise AddGroupToDatasetError(f"Add group to dataset failed with status {status}", status_code = status)
|
|
169
|
+
else:
|
|
170
|
+
return response
|
|
70
171
|
|
|
71
172
|
@require_api_key
|
|
72
|
-
def
|
|
173
|
+
async def remove_group_from_dataset(self, dataset: str, id: str) -> Dict[str, Any]:
|
|
73
174
|
"""
|
|
74
|
-
Remove a
|
|
175
|
+
Remove a group from a dataset.
|
|
75
176
|
|
|
76
177
|
Args:
|
|
77
|
-
|
|
78
|
-
|
|
178
|
+
dataset: Name of the dataset
|
|
179
|
+
id: Group ID
|
|
79
180
|
|
|
80
181
|
Returns:
|
|
81
182
|
API response data
|
|
183
|
+
|
|
184
|
+
Raises:
|
|
185
|
+
RemoveGroupFromDatasetError: If the API request fails
|
|
186
|
+
DatasetNotFoundError: If the dataset is not found
|
|
187
|
+
GroupNotFoundError: If the group is not found
|
|
82
188
|
"""
|
|
83
|
-
payload = {"
|
|
84
|
-
|
|
85
|
-
|
|
189
|
+
payload = {"id": id}
|
|
190
|
+
response, status = await self._client._terrakio_request("DELETE", f"/datasets/{dataset}/groups", json = payload)
|
|
191
|
+
if status != 200:
|
|
192
|
+
if status == 404:
|
|
193
|
+
if "Dataset" in response.get("detail", ""):
|
|
194
|
+
raise DatasetNotFoundError(response.get("detail", ""), status_code = status)
|
|
195
|
+
elif "Group" in response.get("detail", ""):
|
|
196
|
+
raise GroupNotFoundError(response.get("detail", ""), status_code = status)
|
|
197
|
+
raise RemoveGroupFromDatasetError(f"Remove group from dataset failed with status {status}", status_code = status)
|
|
198
|
+
else:
|
|
199
|
+
return response
|
|
200
|
+
|
|
86
201
|
@require_api_key
|
|
87
|
-
def remove_user_from_dataset(self, dataset: str, emails: list[str]) -> Dict[str, Any]:
|
|
202
|
+
async def remove_user_from_dataset(self, dataset: str, emails: list[str]) -> Dict[str, Any]:
|
|
88
203
|
"""
|
|
89
204
|
Remove a user from a dataset.
|
|
90
205
|
|
|
@@ -94,14 +209,27 @@ class BaseGroupManagement:
|
|
|
94
209
|
|
|
95
210
|
Returns:
|
|
96
211
|
API response data
|
|
212
|
+
|
|
213
|
+
Raises:
|
|
214
|
+
UserNotFoundError: If the user is not found
|
|
215
|
+
DatasetNotFoundError: If the dataset is not found
|
|
216
|
+
RemoveUserFromDatasetError: If the API request fails
|
|
97
217
|
"""
|
|
98
218
|
payload = {"emails": emails}
|
|
99
|
-
|
|
219
|
+
response, status = await self._client._terrakio_request("PATCH", f"/datasets/{dataset}/share", json = payload)
|
|
220
|
+
if status != 200:
|
|
221
|
+
if status == 404:
|
|
222
|
+
detail = response.get("detail", "")
|
|
223
|
+
if "User" in detail and "not found" in detail:
|
|
224
|
+
raise UserNotFoundError(detail, status_code = status)
|
|
225
|
+
elif "Dataset" in detail and "not found" in detail:
|
|
226
|
+
raise DatasetNotFoundError(detail, status_code = status)
|
|
227
|
+
raise RemoveUserFromDatasetError(f"Remove user from dataset failed with status {status}", status_code = status)
|
|
228
|
+
else:
|
|
229
|
+
return response
|
|
100
230
|
|
|
101
|
-
class GroupManagement(BaseGroupManagement):
|
|
102
|
-
"""Normal user group management with regular user permissions."""
|
|
103
231
|
@require_api_key
|
|
104
|
-
def list_groups(self) -> Dict[str, Any]:
|
|
232
|
+
async def list_groups(self) -> Dict[str, Any]:
|
|
105
233
|
"""
|
|
106
234
|
List all groups.
|
|
107
235
|
|
|
@@ -109,112 +237,167 @@ class GroupManagement(BaseGroupManagement):
|
|
|
109
237
|
API response data
|
|
110
238
|
|
|
111
239
|
Raises:
|
|
112
|
-
|
|
240
|
+
GroupNotFoundError: If no group is linked to the current account
|
|
241
|
+
ListGroupsError: If the API request fails
|
|
113
242
|
"""
|
|
114
|
-
|
|
115
|
-
|
|
243
|
+
response, status = await self._client._terrakio_request("GET", "/groups")
|
|
244
|
+
if status != 200:
|
|
245
|
+
if status == 404:
|
|
246
|
+
raise GroupNotFoundError(f"No group is linked to the current account", status_code = status)
|
|
247
|
+
raise ListGroupsError(f"List groups failed with status {status}", status_code = status)
|
|
248
|
+
else:
|
|
249
|
+
return response
|
|
250
|
+
|
|
116
251
|
@require_api_key
|
|
117
|
-
def
|
|
252
|
+
async def list_groups_admin(self) -> Dict[str, Any]:
|
|
118
253
|
"""
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
Args:
|
|
122
|
-
group: Name of the group
|
|
254
|
+
List all groups (admin scope).
|
|
123
255
|
|
|
124
256
|
Returns:
|
|
125
257
|
API response data
|
|
126
258
|
|
|
127
259
|
Raises:
|
|
128
|
-
|
|
260
|
+
GroupNotFoundError: If no group is found
|
|
261
|
+
CommandPermissionError: If the user does not have permission to list groups
|
|
262
|
+
ListGroupsError: If the API request fails
|
|
129
263
|
"""
|
|
130
|
-
|
|
264
|
+
response, status = await self._client._terrakio_request("GET", "/admin/groups")
|
|
265
|
+
if status != 200:
|
|
266
|
+
if status == 404:
|
|
267
|
+
raise GroupNotFoundError("No group is found", status_code = status)
|
|
268
|
+
if status == 403:
|
|
269
|
+
raise CommandPermissionError(f"You do not have permission to list groups", status_code = status)
|
|
270
|
+
raise ListGroupsError(f"List groups failed with status {status}", status_code = status)
|
|
271
|
+
else:
|
|
272
|
+
return response
|
|
131
273
|
|
|
132
274
|
@require_api_key
|
|
133
|
-
def
|
|
275
|
+
async def get_group(self, group: str) -> Dict[str, Any]:
|
|
134
276
|
"""
|
|
135
|
-
|
|
277
|
+
Get a group.
|
|
136
278
|
|
|
137
279
|
Args:
|
|
138
|
-
|
|
280
|
+
group: Name of the group
|
|
139
281
|
|
|
140
282
|
Returns:
|
|
141
283
|
API response data
|
|
142
284
|
|
|
143
285
|
Raises:
|
|
144
|
-
|
|
286
|
+
GroupNotFoundError: If the group is not found
|
|
287
|
+
GetGroupError: If the API request fails
|
|
145
288
|
"""
|
|
146
|
-
|
|
147
|
-
|
|
289
|
+
response, status = await self._client._terrakio_request("GET", f"/groups/{group}")
|
|
290
|
+
if status != 200:
|
|
291
|
+
if status == 404:
|
|
292
|
+
raise GroupNotFoundError(f"Group {group} not found", status_code = status)
|
|
293
|
+
elif status == 403:
|
|
294
|
+
raise GroupPermissionError(f"You do not have permission to get group {group}", status_code = status)
|
|
295
|
+
raise GetGroupError(f"Get group failed with status {status}", status_code = status)
|
|
296
|
+
else:
|
|
297
|
+
return response
|
|
148
298
|
|
|
149
299
|
@require_api_key
|
|
150
|
-
def
|
|
300
|
+
async def get_group_admin(self, group_id: str) -> Dict[str, Any]:
|
|
151
301
|
"""
|
|
152
|
-
|
|
302
|
+
Get a group (admin scope).
|
|
153
303
|
|
|
154
304
|
Args:
|
|
155
|
-
|
|
305
|
+
group_id: ID of the group
|
|
156
306
|
|
|
157
307
|
Returns:
|
|
158
308
|
API response data
|
|
159
309
|
|
|
160
310
|
Raises:
|
|
161
|
-
|
|
311
|
+
GroupNotFoundError: If the group is not found
|
|
312
|
+
GetGroupError: If the API request fails
|
|
162
313
|
"""
|
|
163
|
-
|
|
314
|
+
response, status = await self._client._terrakio_request("GET", f"/admin/groups/{group_id}")
|
|
315
|
+
if status != 200:
|
|
316
|
+
if status == 404:
|
|
317
|
+
raise GroupNotFoundError(f"Group {group_id} not found", status_code = status)
|
|
318
|
+
raise GetGroupError(f"Get group failed with status {status}", status_code = status)
|
|
319
|
+
else:
|
|
320
|
+
return response
|
|
164
321
|
|
|
165
|
-
class AdminGroupManagement(BaseGroupManagement):
|
|
166
|
-
"""Admin user group management with admin permissions."""
|
|
167
322
|
@require_api_key
|
|
168
|
-
def
|
|
323
|
+
async def create_group(self, name: str) -> Dict[str, Any]:
|
|
169
324
|
"""
|
|
170
|
-
|
|
325
|
+
Create a group
|
|
326
|
+
|
|
327
|
+
Args:
|
|
328
|
+
name: Name of the group
|
|
171
329
|
|
|
172
330
|
Returns:
|
|
173
331
|
API response data
|
|
174
332
|
|
|
175
333
|
Raises:
|
|
176
|
-
|
|
334
|
+
CreateGroupError: If the API request fails
|
|
177
335
|
"""
|
|
178
|
-
|
|
179
|
-
|
|
336
|
+
payload = {"name": name}
|
|
337
|
+
response, status = await self._client._terrakio_request("POST", "/groups", json = payload)
|
|
338
|
+
if status != 200:
|
|
339
|
+
raise CreateGroupError(f"Create group failed with status {status}", status_code = status)
|
|
340
|
+
else:
|
|
341
|
+
return response
|
|
342
|
+
|
|
180
343
|
@require_api_key
|
|
181
|
-
def
|
|
344
|
+
async def create_group_admin(self, name: str, owner: str) -> Dict[str, Any]:
|
|
182
345
|
"""
|
|
183
|
-
|
|
346
|
+
Create a group (admin scope).
|
|
184
347
|
|
|
185
348
|
Args:
|
|
186
|
-
|
|
349
|
+
name: Name of the group
|
|
350
|
+
owner: User email of the owner
|
|
187
351
|
|
|
188
352
|
Returns:
|
|
189
353
|
API response data
|
|
190
354
|
|
|
191
355
|
Raises:
|
|
192
|
-
|
|
356
|
+
CommandPermissionError: If the user does not have permission to create a group
|
|
357
|
+
UserNotFoundError: If the user is not found
|
|
358
|
+
CreateGroupError: If the API request fails
|
|
193
359
|
"""
|
|
194
|
-
|
|
195
|
-
|
|
360
|
+
payload = {"name": name, "owner": owner}
|
|
361
|
+
response, status = await self._client._terrakio_request("POST", f"/admin/groups", json=payload)
|
|
362
|
+
if status != 200:
|
|
363
|
+
if status == 403:
|
|
364
|
+
raise CommandPermissionError(f"You do not have permission to create a group", status_code = status)
|
|
365
|
+
elif status == 404:
|
|
366
|
+
raise UserNotFoundError(f"User {owner} not found", status_code = status)
|
|
367
|
+
raise CreateGroupError(f"Create group failed with status {status}", status_code = status)
|
|
368
|
+
else:
|
|
369
|
+
return response
|
|
370
|
+
|
|
196
371
|
@require_api_key
|
|
197
|
-
def
|
|
372
|
+
async def delete_group(self, group: str) -> Dict[str, Any]:
|
|
198
373
|
"""
|
|
199
|
-
|
|
374
|
+
Delete a group.
|
|
200
375
|
|
|
201
376
|
Args:
|
|
202
|
-
|
|
203
|
-
owner: User email of the owner
|
|
377
|
+
group: Name of the group to delete
|
|
204
378
|
|
|
205
379
|
Returns:
|
|
206
380
|
API response data
|
|
207
381
|
|
|
208
382
|
Raises:
|
|
209
|
-
|
|
383
|
+
GroupNotFoundError: If the group is not found
|
|
384
|
+
GroupPermissionError: If the user does not have permission to delete the group
|
|
385
|
+
DeleteGroupError: If the API request fails
|
|
210
386
|
"""
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
387
|
+
response, status = await self._client._terrakio_request("DELETE", f"/groups/{group}")
|
|
388
|
+
if status != 200:
|
|
389
|
+
if status == 404:
|
|
390
|
+
raise GroupNotFoundError(f"Group {group} not found", status_code = status)
|
|
391
|
+
elif status == 403:
|
|
392
|
+
raise GroupPermissionError(f"You do not have permission to delete group {group}", status_code = status)
|
|
393
|
+
raise DeleteGroupError(f"Delete group failed with status {status}", status_code = status)
|
|
394
|
+
else:
|
|
395
|
+
return response
|
|
396
|
+
|
|
214
397
|
@require_api_key
|
|
215
|
-
def
|
|
398
|
+
async def delete_group_admin(self, group: str) -> Dict[str, Any]:
|
|
216
399
|
"""
|
|
217
|
-
Delete a group.
|
|
400
|
+
Delete a group (admin scope).
|
|
218
401
|
|
|
219
402
|
Args:
|
|
220
403
|
group: Name of the group to delete
|
|
@@ -223,6 +406,16 @@ class AdminGroupManagement(BaseGroupManagement):
|
|
|
223
406
|
API response data
|
|
224
407
|
|
|
225
408
|
Raises:
|
|
226
|
-
|
|
409
|
+
GroupNotFoundError: If the group is not found
|
|
410
|
+
CommandPermissionError: If the user does not have permission to delete the group
|
|
411
|
+
DeleteGroupError: If the API request fails
|
|
227
412
|
"""
|
|
228
|
-
|
|
413
|
+
response, status = await self._client._terrakio_request("DELETE", f"/admin/groups/{group}")
|
|
414
|
+
if status != 200:
|
|
415
|
+
if status == 404:
|
|
416
|
+
raise GroupNotFoundError(f"Group {group} not found", status_code = status)
|
|
417
|
+
elif status == 403:
|
|
418
|
+
raise CommandPermissionError(f"You do not have permission to delete group {group}", status_code = status)
|
|
419
|
+
raise DeleteGroupError(f"Delete group failed with status {status}", status_code = status)
|
|
420
|
+
else:
|
|
421
|
+
return response
|