pangea-sdk 6.0.0__py3-none-any.whl → 6.1.1__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.
- pangea/__init__.py +1 -1
- pangea/asyncio/request.py +1 -1
- pangea/asyncio/services/audit.py +6 -6
- pangea/asyncio/services/authn.py +192 -35
- pangea/asyncio/services/authz.py +34 -34
- pangea/asyncio/services/file_scan.py +1 -1
- pangea/asyncio/services/redact.py +3 -3
- pangea/asyncio/services/vault.py +15 -15
- pangea/request.py +1 -1
- pangea/services/audit/audit.py +6 -6
- pangea/services/authn/authn.py +198 -39
- pangea/services/authn/models.py +94 -0
- pangea/services/authz.py +71 -36
- pangea/services/file_scan.py +1 -1
- pangea/services/redact.py +3 -3
- pangea/services/vault/vault.py +15 -15
- {pangea_sdk-6.0.0.dist-info → pangea_sdk-6.1.1.dist-info}/METADATA +4 -4
- {pangea_sdk-6.0.0.dist-info → pangea_sdk-6.1.1.dist-info}/RECORD +19 -19
- {pangea_sdk-6.0.0.dist-info → pangea_sdk-6.1.1.dist-info}/WHEEL +1 -1
pangea/__init__.py
CHANGED
pangea/asyncio/request.py
CHANGED
@@ -61,7 +61,7 @@ class PangeaRequestAsync(PangeaRequestBase):
|
|
61
61
|
data = {}
|
62
62
|
|
63
63
|
# Normalize.
|
64
|
-
data = cast(dict[str, Any], to_jsonable_python(data))
|
64
|
+
data = cast(dict[str, Any], to_jsonable_python(data, exclude_none=True))
|
65
65
|
|
66
66
|
if url is None:
|
67
67
|
url = self._url(endpoint)
|
pangea/asyncio/services/audit.py
CHANGED
@@ -135,7 +135,7 @@ class AuditAsync(ServiceBaseAsync, AuditBase):
|
|
135
135
|
A PangeaResponse where the hash of event data and optional verbose
|
136
136
|
results are returned in the response.result field.
|
137
137
|
Available response fields can be found in our
|
138
|
-
[API documentation](https://pangea.cloud/docs/api/audit
|
138
|
+
[API documentation](https://pangea.cloud/docs/api/audit#/v1/log-post).
|
139
139
|
|
140
140
|
Examples:
|
141
141
|
try:
|
@@ -186,7 +186,7 @@ class AuditAsync(ServiceBaseAsync, AuditBase):
|
|
186
186
|
Returns:
|
187
187
|
A PangeaResponse where the hash of event data and optional verbose
|
188
188
|
results are returned in the response.result field.
|
189
|
-
Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/audit
|
189
|
+
Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/audit#/v1/log-post).
|
190
190
|
|
191
191
|
Examples:
|
192
192
|
response = await audit.log_event({"message": "hello world"}, verbose=True)
|
@@ -222,7 +222,7 @@ class AuditAsync(ServiceBaseAsync, AuditBase):
|
|
222
222
|
Returns:
|
223
223
|
A PangeaResponse where the hash of event data and optional verbose
|
224
224
|
results are returned in the response.result field.
|
225
|
-
Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/audit
|
225
|
+
Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/audit#/v1/log-post).
|
226
226
|
|
227
227
|
Examples:
|
228
228
|
FIXME:
|
@@ -259,7 +259,7 @@ class AuditAsync(ServiceBaseAsync, AuditBase):
|
|
259
259
|
Returns:
|
260
260
|
A PangeaResponse where the hash of event data and optional verbose
|
261
261
|
results are returned in the response.result field.
|
262
|
-
Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/audit
|
262
|
+
Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/audit#/v1/log-post).
|
263
263
|
|
264
264
|
Examples:
|
265
265
|
FIXME:
|
@@ -328,8 +328,8 @@ class AuditAsync(ServiceBaseAsync, AuditBase):
|
|
328
328
|
|
329
329
|
Returns:
|
330
330
|
A PangeaResponse[SearchOutput] where the first page of matched events is returned in the
|
331
|
-
response.result field. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/audit
|
332
|
-
Pagination can be found in the [search results endpoint](https://pangea.cloud/docs/api/audit
|
331
|
+
response.result field. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/audit#/v1/results-post).
|
332
|
+
Pagination can be found in the [search results endpoint](https://pangea.cloud/docs/api/audit#/v1/download_results-post).
|
333
333
|
|
334
334
|
Examples:
|
335
335
|
response: PangeaResponse[SearchOutput] = audit.search(query="message:test", search_restriction={'source': ["monitor"]}, limit=1, verify_consistency=True, verify_events=True)
|
pangea/asyncio/services/authn.py
CHANGED
@@ -2,14 +2,17 @@
|
|
2
2
|
# Author: Pangea Cyber Corporation
|
3
3
|
from __future__ import annotations
|
4
4
|
|
5
|
-
from typing import Dict, List, Optional, Union
|
5
|
+
from typing import Dict, List, Literal, Optional, Union
|
6
6
|
|
7
7
|
import pangea.services.authn.models as m
|
8
8
|
from pangea.asyncio.services.base import ServiceBaseAsync
|
9
9
|
from pangea.config import PangeaConfig
|
10
10
|
from pangea.response import PangeaResponse, PangeaResponseResult
|
11
11
|
|
12
|
-
|
12
|
+
__all__ = ["AuthNAsync"]
|
13
|
+
|
14
|
+
|
15
|
+
_SERVICE_NAME = "authn"
|
13
16
|
|
14
17
|
|
15
18
|
class AuthNAsync(ServiceBaseAsync):
|
@@ -35,7 +38,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
35
38
|
authn = AuthNAsync(token=PANGEA_TOKEN, config=authn_config)
|
36
39
|
"""
|
37
40
|
|
38
|
-
service_name =
|
41
|
+
service_name = _SERVICE_NAME
|
39
42
|
|
40
43
|
def __init__(
|
41
44
|
self,
|
@@ -65,7 +68,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
65
68
|
self.agreements = AuthNAsync.AgreementsAsync(token, config, logger_name=logger_name)
|
66
69
|
|
67
70
|
class SessionAsync(ServiceBaseAsync):
|
68
|
-
service_name =
|
71
|
+
service_name = _SERVICE_NAME
|
69
72
|
|
70
73
|
def __init__(
|
71
74
|
self,
|
@@ -124,7 +127,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
124
127
|
Returns:
|
125
128
|
A PangeaResponse with a list of sessions in the response.result field.
|
126
129
|
Available response fields can be found in our
|
127
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/session#/v2/session/list).
|
130
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/session#/v2/session/list-post).
|
128
131
|
|
129
132
|
Examples:
|
130
133
|
response = authn.session.list()
|
@@ -162,7 +165,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
162
165
|
)
|
163
166
|
|
164
167
|
class ClientAsync(ServiceBaseAsync):
|
165
|
-
service_name =
|
168
|
+
service_name = _SERVICE_NAME
|
166
169
|
|
167
170
|
def __init__(
|
168
171
|
self,
|
@@ -189,7 +192,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
189
192
|
Returns:
|
190
193
|
A PangeaResponse with credentials for a login session in the response.result field.
|
191
194
|
Available response fields can be found in our
|
192
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/client/userinfo).
|
195
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/client/userinfo-post).
|
193
196
|
|
194
197
|
Examples:
|
195
198
|
response = authn.client.userinfo(
|
@@ -214,7 +217,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
214
217
|
Returns:
|
215
218
|
A PangeaResponse with jwt verification keys in the response.result field.
|
216
219
|
Available response fields can be found in our
|
217
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/jwt#/v2/client/jwks).
|
220
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/jwt#/v2/client/jwks-post).
|
218
221
|
|
219
222
|
Examples:
|
220
223
|
response = authn.client.jwks()
|
@@ -222,7 +225,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
222
225
|
return await self.request.post("v2/client/jwks", m.ClientJWKSResult, {})
|
223
226
|
|
224
227
|
class SessionAsync(ServiceBaseAsync):
|
225
|
-
service_name =
|
228
|
+
service_name = _SERVICE_NAME
|
226
229
|
|
227
230
|
def __init__(
|
228
231
|
self,
|
@@ -287,7 +290,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
287
290
|
Returns:
|
288
291
|
A PangeaResponse with a list of sessions in the response.result field.
|
289
292
|
Available response fields can be found in our
|
290
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/session#/v2/client/session/list).
|
293
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/session#/v2/client/session/list-post).
|
291
294
|
|
292
295
|
Examples:
|
293
296
|
response = authn.client.session.list(
|
@@ -345,7 +348,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
345
348
|
Returns:
|
346
349
|
A PangeaResponse with credentials for a login session in the response.result field.
|
347
350
|
Available response fields can be found in our
|
348
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/session#/v2/client/session/refresh).
|
351
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/session#/v2/client/session/refresh-post).
|
349
352
|
|
350
353
|
Examples:
|
351
354
|
response = authn.client.session.refresh(
|
@@ -359,7 +362,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
359
362
|
)
|
360
363
|
|
361
364
|
class PasswordAsync(ServiceBaseAsync):
|
362
|
-
service_name =
|
365
|
+
service_name = _SERVICE_NAME
|
363
366
|
|
364
367
|
def __init__(
|
365
368
|
self,
|
@@ -419,7 +422,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
419
422
|
return await self.request.post("v2/user/password/expire", PangeaResponseResult, {"id": user_id})
|
420
423
|
|
421
424
|
class TokenAsync(ServiceBaseAsync):
|
422
|
-
service_name =
|
425
|
+
service_name = _SERVICE_NAME
|
423
426
|
|
424
427
|
def __init__(
|
425
428
|
self,
|
@@ -443,7 +446,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
443
446
|
Returns:
|
444
447
|
A PangeaResponse with a token and its information in the response.result field.
|
445
448
|
Available response fields can be found in our
|
446
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/flow#/v2/client/token/check).
|
449
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/flow#/v2/client/token/check-post).
|
447
450
|
|
448
451
|
Examples:
|
449
452
|
response = authn.client.token_endpoints.check(
|
@@ -456,7 +459,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
456
459
|
)
|
457
460
|
|
458
461
|
class UserAsync(ServiceBaseAsync):
|
459
|
-
service_name =
|
462
|
+
service_name = _SERVICE_NAME
|
460
463
|
|
461
464
|
def __init__(
|
462
465
|
self,
|
@@ -491,7 +494,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
491
494
|
Returns:
|
492
495
|
A PangeaResponse with a user and its information in the response.result field.
|
493
496
|
Available response fields can be found in our
|
494
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/create).
|
497
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/create-post).
|
495
498
|
|
496
499
|
Examples:
|
497
500
|
response = authn.user.create(
|
@@ -560,7 +563,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
560
563
|
Returns:
|
561
564
|
A PangeaResponse with a pending user invitation in the response.result field.
|
562
565
|
Available response fields can be found in our
|
563
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/invite#/v2/user/invite).
|
566
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/invite#/v2/user/invite-post).
|
564
567
|
|
565
568
|
Examples:
|
566
569
|
response = authn.user.invite(
|
@@ -605,7 +608,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
605
608
|
Returns:
|
606
609
|
A PangeaResponse with a user and its information in the response.result field.
|
607
610
|
Available response fields can be found in our
|
608
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/update).
|
611
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/update-post).
|
609
612
|
|
610
613
|
Examples:
|
611
614
|
response = authn.user.update(
|
@@ -649,7 +652,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
649
652
|
Returns:
|
650
653
|
A PangeaResponse with a list of users in the response.result field.
|
651
654
|
Available response fields can be found in our
|
652
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/list).
|
655
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/list-post).
|
653
656
|
|
654
657
|
Examples:
|
655
658
|
response = authn.user.list()
|
@@ -667,7 +670,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
667
670
|
return await self.request.post("v2/user/list", m.UserListResult, data=input.model_dump(exclude_none=True))
|
668
671
|
|
669
672
|
class InvitesAsync(ServiceBaseAsync):
|
670
|
-
service_name =
|
673
|
+
service_name = _SERVICE_NAME
|
671
674
|
|
672
675
|
def __init__(
|
673
676
|
self,
|
@@ -702,7 +705,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
702
705
|
Returns:
|
703
706
|
A PangeaResponse with a list of pending user invitations in the response.result field.
|
704
707
|
Available response fields can be found in our
|
705
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/invite#/v2/user/invite/list).
|
708
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/invite#/v2/user/invite/list-post).
|
706
709
|
Examples:
|
707
710
|
response = authn.user.invites.list()
|
708
711
|
"""
|
@@ -739,7 +742,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
739
742
|
)
|
740
743
|
|
741
744
|
class AuthenticatorsAsync(ServiceBaseAsync):
|
742
|
-
service_name =
|
745
|
+
service_name = _SERVICE_NAME
|
743
746
|
|
744
747
|
def __init__(
|
745
748
|
self,
|
@@ -806,7 +809,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
806
809
|
Returns:
|
807
810
|
A PangeaResponse with a list of authenticators in the response.result field.
|
808
811
|
Available response fields can be found in our
|
809
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/authenticators/list).
|
812
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/authenticators/list-post).
|
810
813
|
|
811
814
|
Examples:
|
812
815
|
response = authn.user.authenticators.list(
|
@@ -821,7 +824,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
821
824
|
)
|
822
825
|
|
823
826
|
class ProfileAsync(ServiceBaseAsync):
|
824
|
-
service_name =
|
827
|
+
service_name = _SERVICE_NAME
|
825
828
|
|
826
829
|
def __init__(
|
827
830
|
self,
|
@@ -849,7 +852,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
849
852
|
Returns:
|
850
853
|
A PangeaResponse with a user and its information in the response.result field.
|
851
854
|
Available response fields can be found in our
|
852
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/profile/get).
|
855
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/profile/get-post).
|
853
856
|
|
854
857
|
Examples:
|
855
858
|
response = authn.user.profile.get(
|
@@ -885,7 +888,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
885
888
|
Returns:
|
886
889
|
A PangeaResponse with a user and its information in the response.result field.
|
887
890
|
Available response fields can be found in our
|
888
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/profile/update).
|
891
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/profile/update-post).
|
889
892
|
|
890
893
|
Examples:
|
891
894
|
response = authn.user.profile.update(
|
@@ -905,8 +908,57 @@ class AuthNAsync(ServiceBaseAsync):
|
|
905
908
|
"v2/user/profile/update", m.UserProfileUpdateResult, data=input.model_dump(exclude_none=True)
|
906
909
|
)
|
907
910
|
|
911
|
+
class GroupAsync(ServiceBaseAsync):
|
912
|
+
service_name = _SERVICE_NAME
|
913
|
+
|
914
|
+
def __init__(
|
915
|
+
self,
|
916
|
+
token: str,
|
917
|
+
config: PangeaConfig | None = None,
|
918
|
+
logger_name: str = "pangea",
|
919
|
+
) -> None:
|
920
|
+
super().__init__(token, config, logger_name=logger_name)
|
921
|
+
|
922
|
+
async def assign(self, user_id: str, group_ids: list[str]) -> PangeaResponse[PangeaResponseResult]:
|
923
|
+
"""
|
924
|
+
Assign groups to a user
|
925
|
+
|
926
|
+
Add a list of groups to a specified user
|
927
|
+
|
928
|
+
OperationId: authn_post_v2_user_group_assign
|
929
|
+
"""
|
930
|
+
return await self.request.post(
|
931
|
+
"v2/user/group/assign",
|
932
|
+
data={"id": user_id, "group_ids": group_ids},
|
933
|
+
result_class=m.PangeaResponseResult,
|
934
|
+
)
|
935
|
+
|
936
|
+
async def remove(self, user_id: str, group_id: str) -> PangeaResponse[PangeaResponseResult]:
|
937
|
+
"""
|
938
|
+
Remove a group assigned to a user
|
939
|
+
|
940
|
+
Remove a group assigned to a user
|
941
|
+
|
942
|
+
OperationId: authn_post_v2_user_group_remove
|
943
|
+
"""
|
944
|
+
return await self.request.post(
|
945
|
+
"v2/user/group/remove",
|
946
|
+
data={"id": user_id, "group_id": group_id},
|
947
|
+
result_class=m.PangeaResponseResult,
|
948
|
+
)
|
949
|
+
|
950
|
+
async def list(self, user_id: str) -> PangeaResponse[m.GroupList]:
|
951
|
+
"""
|
952
|
+
List of groups assigned to a user
|
953
|
+
|
954
|
+
Return a list of ids for groups assigned to a user
|
955
|
+
|
956
|
+
OperationId: authn_post_v2_user_group_list
|
957
|
+
"""
|
958
|
+
return await self.request.post("v2/user/group/list", data={"id": user_id}, result_class=m.GroupList)
|
959
|
+
|
908
960
|
class FlowAsync(ServiceBaseAsync):
|
909
|
-
service_name =
|
961
|
+
service_name = _SERVICE_NAME
|
910
962
|
|
911
963
|
def __init__(
|
912
964
|
self,
|
@@ -930,7 +982,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
930
982
|
Returns:
|
931
983
|
A PangeaResponse with credentials for a login session in the response.result field.
|
932
984
|
Available response fields can be found in our
|
933
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/flow#/v2/flow/complete).
|
985
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/flow#/v2/flow/complete-post).
|
934
986
|
|
935
987
|
Examples:
|
936
988
|
response = authn.flow.complete(
|
@@ -961,7 +1013,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
961
1013
|
A PangeaResponse with information about next steps needed
|
962
1014
|
to complete a flow in the response.result field.
|
963
1015
|
Available response fields can be found in our
|
964
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/flow#/v2/flow/restart).
|
1016
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/flow#/v2/flow/restart-post).
|
965
1017
|
|
966
1018
|
Examples:
|
967
1019
|
response = authn.flow.restart(
|
@@ -1000,7 +1052,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
1000
1052
|
A PangeaResponse with information about next steps needed
|
1001
1053
|
to complete a flow in the response.result field.
|
1002
1054
|
Available response fields can be found in our
|
1003
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/flow#/v2/flow/start).
|
1055
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/flow#/v2/flow/start-post).
|
1004
1056
|
|
1005
1057
|
Examples:
|
1006
1058
|
response = authn.flow.start(
|
@@ -1034,7 +1086,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
1034
1086
|
A PangeaResponse with information about next steps needed
|
1035
1087
|
to complete a flow in the response.result field.
|
1036
1088
|
Available response fields can be found in our
|
1037
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/flow#/v2/flow/update).
|
1089
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/flow#/v2/flow/update-post).
|
1038
1090
|
|
1039
1091
|
Examples:
|
1040
1092
|
response = authn.flow.update(
|
@@ -1052,7 +1104,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
1052
1104
|
)
|
1053
1105
|
|
1054
1106
|
class AgreementsAsync(ServiceBaseAsync):
|
1055
|
-
service_name =
|
1107
|
+
service_name = _SERVICE_NAME
|
1056
1108
|
|
1057
1109
|
def __init__(
|
1058
1110
|
self,
|
@@ -1081,7 +1133,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
1081
1133
|
Returns:
|
1082
1134
|
A PangeaResponse with a EULA object in the response.result field.
|
1083
1135
|
Available response fields can be found in our
|
1084
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/agreements#/v2/agreements/create).
|
1136
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/agreements#/v2/agreements/create-post).
|
1085
1137
|
|
1086
1138
|
Examples:
|
1087
1139
|
response = authn.agreements.create(
|
@@ -1148,7 +1200,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
1148
1200
|
Returns:
|
1149
1201
|
A PangeaResponse with a list of EULA objects in the response.result field.
|
1150
1202
|
Available response fields can be found in our
|
1151
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/agreements#/v2/agreements/list).
|
1203
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/agreements#/v2/agreements/list-post).
|
1152
1204
|
|
1153
1205
|
Examples:
|
1154
1206
|
response = authn.agreements.list()
|
@@ -1186,7 +1238,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
1186
1238
|
Returns:
|
1187
1239
|
A PangeaResponse with the updated EULA object in the response.result field.
|
1188
1240
|
Available response fields can be found in our
|
1189
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/agreements#/v2/agreements/update).
|
1241
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/agreements#/v2/agreements/update-post).
|
1190
1242
|
|
1191
1243
|
Examples:
|
1192
1244
|
response = authn.agreements.update(
|
@@ -1201,3 +1253,108 @@ class AuthNAsync(ServiceBaseAsync):
|
|
1201
1253
|
return await self.request.post(
|
1202
1254
|
"v2/agreements/update", m.AgreementUpdateResult, data=input.model_dump(exclude_none=True)
|
1203
1255
|
)
|
1256
|
+
|
1257
|
+
class GroupAsync(ServiceBaseAsync):
|
1258
|
+
service_name = _SERVICE_NAME
|
1259
|
+
|
1260
|
+
def __init__(
|
1261
|
+
self,
|
1262
|
+
token: str,
|
1263
|
+
config: PangeaConfig | None = None,
|
1264
|
+
logger_name: str = "pangea",
|
1265
|
+
) -> None:
|
1266
|
+
super().__init__(token, config, logger_name=logger_name)
|
1267
|
+
|
1268
|
+
async def create(
|
1269
|
+
self, name: str, type: str, *, description: str | None = None, attributes: dict[str, str] | None = None
|
1270
|
+
) -> PangeaResponse[m.GroupInfo]:
|
1271
|
+
"""
|
1272
|
+
Create a new group
|
1273
|
+
|
1274
|
+
Create a new group
|
1275
|
+
|
1276
|
+
OperationId: authn_post_v2_group_create
|
1277
|
+
"""
|
1278
|
+
return await self.request.post(
|
1279
|
+
"v2/group/create",
|
1280
|
+
data={"name": name, "type": type, "description": description, "attributes": attributes},
|
1281
|
+
result_class=m.GroupInfo,
|
1282
|
+
)
|
1283
|
+
|
1284
|
+
async def delete(self, id: str) -> PangeaResponse[PangeaResponseResult]:
|
1285
|
+
"""
|
1286
|
+
Delete a group
|
1287
|
+
|
1288
|
+
Delete a group
|
1289
|
+
|
1290
|
+
OperationId: authn_post_v2_group_delete
|
1291
|
+
"""
|
1292
|
+
return await self.request.post("v2/group/delete", data={"id": id}, result_class=PangeaResponseResult)
|
1293
|
+
|
1294
|
+
async def get(self, id: str) -> PangeaResponse[m.GroupInfo]:
|
1295
|
+
"""
|
1296
|
+
Get group information
|
1297
|
+
|
1298
|
+
Look up a group by ID and return its information.
|
1299
|
+
|
1300
|
+
OperationId: authn_post_v2_group_get
|
1301
|
+
"""
|
1302
|
+
return await self.request.post("v2/group/get", data={"id": id}, result_class=m.GroupInfo)
|
1303
|
+
|
1304
|
+
async def list(
|
1305
|
+
self,
|
1306
|
+
*,
|
1307
|
+
filter: m.GroupsFilter | None = None,
|
1308
|
+
last: str | None = None,
|
1309
|
+
order: Literal["asc", "desc"] | None = None,
|
1310
|
+
order_by: Literal["id", "created_at", "updated_at", "name", "type"] | None = None,
|
1311
|
+
size: int | None = None,
|
1312
|
+
) -> PangeaResponse[m.GroupList]:
|
1313
|
+
"""
|
1314
|
+
List groups
|
1315
|
+
|
1316
|
+
Look up groups by name, type, or attributes.
|
1317
|
+
"""
|
1318
|
+
return await self.request.post(
|
1319
|
+
"v2/group/list",
|
1320
|
+
data={"filter": filter, "last": last, "order": order, "order_by": order_by, "size": size},
|
1321
|
+
result_class=m.GroupList,
|
1322
|
+
)
|
1323
|
+
|
1324
|
+
async def list_users(
|
1325
|
+
self, id: str, *, last: str | None = None, size: int | None = None
|
1326
|
+
) -> PangeaResponse[m.GroupUserList]:
|
1327
|
+
"""
|
1328
|
+
List of users assigned to a group
|
1329
|
+
|
1330
|
+
Return a list of ids for users assigned to a group
|
1331
|
+
|
1332
|
+
OperationId: authn_post_v2_group_user_list
|
1333
|
+
"""
|
1334
|
+
return await self.request.post(
|
1335
|
+
"v2/group/user/list",
|
1336
|
+
data={"id": id, "last": last, "size": size},
|
1337
|
+
result_class=m.GroupUserList,
|
1338
|
+
)
|
1339
|
+
|
1340
|
+
async def update(
|
1341
|
+
self,
|
1342
|
+
id: str,
|
1343
|
+
*,
|
1344
|
+
name: str | None = None,
|
1345
|
+
description: str | None = None,
|
1346
|
+
type: str | None = None,
|
1347
|
+
attributes: dict[str, str] | None = None,
|
1348
|
+
) -> PangeaResponse[m.GroupInfo]:
|
1349
|
+
"""
|
1350
|
+
Update group information
|
1351
|
+
|
1352
|
+
Update group information
|
1353
|
+
|
1354
|
+
OperationId: authn_post_v2_group_update
|
1355
|
+
"""
|
1356
|
+
return await self.request.post(
|
1357
|
+
"v2/group/update",
|
1358
|
+
data={"id": id, "name": name, "description": description, "type": type, "attributes": attributes},
|
1359
|
+
result_class=m.GroupInfo,
|
1360
|
+
)
|