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/services/authn/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.config import PangeaConfig
|
9
9
|
from pangea.response import PangeaResponse, PangeaResponseResult
|
10
10
|
from pangea.services.base import ServiceBase
|
11
11
|
|
12
|
-
|
12
|
+
__all__ = ["AuthN"]
|
13
|
+
|
14
|
+
|
15
|
+
_SERVICE_NAME = "authn"
|
13
16
|
|
14
17
|
|
15
18
|
class AuthN(ServiceBase):
|
@@ -35,7 +38,7 @@ class AuthN(ServiceBase):
|
|
35
38
|
authn = AuthN(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,
|
@@ -63,9 +66,10 @@ class AuthN(ServiceBase):
|
|
63
66
|
self.client = AuthN.Client(token, config, logger_name=logger_name)
|
64
67
|
self.session = AuthN.Session(token, config, logger_name=logger_name)
|
65
68
|
self.agreements = AuthN.Agreements(token, config, logger_name=logger_name)
|
69
|
+
self.group = AuthN.Group(token, config, logger_name=logger_name)
|
66
70
|
|
67
71
|
class Session(ServiceBase):
|
68
|
-
service_name =
|
72
|
+
service_name = _SERVICE_NAME
|
69
73
|
|
70
74
|
def __init__(
|
71
75
|
self,
|
@@ -124,7 +128,7 @@ class AuthN(ServiceBase):
|
|
124
128
|
Returns:
|
125
129
|
A PangeaResponse with a list of sessions in the response.result field.
|
126
130
|
Available response fields can be found in our
|
127
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/session#/v2/session/list).
|
131
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/session#/v2/session/list-post).
|
128
132
|
|
129
133
|
Examples:
|
130
134
|
response = authn.session.list()
|
@@ -161,7 +165,7 @@ class AuthN(ServiceBase):
|
|
161
165
|
)
|
162
166
|
|
163
167
|
class Client(ServiceBase):
|
164
|
-
service_name =
|
168
|
+
service_name = _SERVICE_NAME
|
165
169
|
|
166
170
|
def __init__(
|
167
171
|
self,
|
@@ -188,7 +192,7 @@ class AuthN(ServiceBase):
|
|
188
192
|
Returns:
|
189
193
|
A PangeaResponse with credentials for a login session in the response.result field.
|
190
194
|
Available response fields can be found in our
|
191
|
-
[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).
|
192
196
|
|
193
197
|
Examples:
|
194
198
|
response = authn.client.userinfo(
|
@@ -213,7 +217,7 @@ class AuthN(ServiceBase):
|
|
213
217
|
Returns:
|
214
218
|
A PangeaResponse with jwt verification keys in the response.result field.
|
215
219
|
Available response fields can be found in our
|
216
|
-
[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).
|
217
221
|
|
218
222
|
Examples:
|
219
223
|
response = authn.client.jwks()
|
@@ -221,7 +225,7 @@ class AuthN(ServiceBase):
|
|
221
225
|
return self.request.post("v2/client/jwks", m.ClientJWKSResult, {})
|
222
226
|
|
223
227
|
class Session(ServiceBase):
|
224
|
-
service_name =
|
228
|
+
service_name = _SERVICE_NAME
|
225
229
|
|
226
230
|
def __init__(
|
227
231
|
self,
|
@@ -286,7 +290,7 @@ class AuthN(ServiceBase):
|
|
286
290
|
Returns:
|
287
291
|
A PangeaResponse with a list of sessions in the response.result field.
|
288
292
|
Available response fields can be found in our
|
289
|
-
[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).
|
290
294
|
|
291
295
|
Examples:
|
292
296
|
response = authn.client.session.list(
|
@@ -345,7 +349,7 @@ class AuthN(ServiceBase):
|
|
345
349
|
Returns:
|
346
350
|
A PangeaResponse with credentials for a login session in the response.result field.
|
347
351
|
Available response fields can be found in our
|
348
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/session#/v2/client/session/refresh).
|
352
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/session#/v2/client/session/refresh-post).
|
349
353
|
|
350
354
|
Examples:
|
351
355
|
response = authn.client.session.refresh(
|
@@ -359,7 +363,7 @@ class AuthN(ServiceBase):
|
|
359
363
|
)
|
360
364
|
|
361
365
|
class Password(ServiceBase):
|
362
|
-
service_name =
|
366
|
+
service_name = _SERVICE_NAME
|
363
367
|
|
364
368
|
def __init__(
|
365
369
|
self,
|
@@ -419,7 +423,7 @@ class AuthN(ServiceBase):
|
|
419
423
|
return self.request.post("v2/user/password/expire", PangeaResponseResult, {"id": user_id})
|
420
424
|
|
421
425
|
class Token(ServiceBase):
|
422
|
-
service_name =
|
426
|
+
service_name = _SERVICE_NAME
|
423
427
|
|
424
428
|
def __init__(
|
425
429
|
self,
|
@@ -443,7 +447,7 @@ class AuthN(ServiceBase):
|
|
443
447
|
Returns:
|
444
448
|
A PangeaResponse with a token and its information in the response.result field.
|
445
449
|
Available response fields can be found in our
|
446
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/flow#/v2/client/token/check).
|
450
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/flow#/v2/client/token/check-post).
|
447
451
|
|
448
452
|
Examples:
|
449
453
|
response = authn.client.token_endpoints.check(
|
@@ -456,18 +460,19 @@ class AuthN(ServiceBase):
|
|
456
460
|
)
|
457
461
|
|
458
462
|
class User(ServiceBase):
|
459
|
-
service_name =
|
463
|
+
service_name = _SERVICE_NAME
|
460
464
|
|
461
465
|
def __init__(
|
462
466
|
self,
|
463
|
-
token,
|
464
|
-
config=None,
|
465
|
-
logger_name="pangea",
|
466
|
-
):
|
467
|
+
token: str,
|
468
|
+
config: PangeaConfig | None = None,
|
469
|
+
logger_name: str = "pangea",
|
470
|
+
) -> None:
|
467
471
|
super().__init__(token, config, logger_name=logger_name)
|
468
472
|
self.profile = AuthN.User.Profile(token, config, logger_name=logger_name)
|
469
473
|
self.authenticators = AuthN.User.Authenticators(token, config, logger_name=logger_name)
|
470
474
|
self.invites = AuthN.User.Invites(token, config, logger_name=logger_name)
|
475
|
+
self.group = AuthN.User.Group(token, config, logger_name=logger_name)
|
471
476
|
|
472
477
|
def create(
|
473
478
|
self,
|
@@ -491,7 +496,7 @@ class AuthN(ServiceBase):
|
|
491
496
|
Returns:
|
492
497
|
A PangeaResponse with a user and its information in the response.result field.
|
493
498
|
Available response fields can be found in our
|
494
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/create).
|
499
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/create-post).
|
495
500
|
|
496
501
|
Examples:
|
497
502
|
response = authn.user.create(
|
@@ -556,7 +561,7 @@ class AuthN(ServiceBase):
|
|
556
561
|
Returns:
|
557
562
|
A PangeaResponse with a pending user invitation in the response.result field.
|
558
563
|
Available response fields can be found in our
|
559
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/invite#/v2/user/invite).
|
564
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/invite#/v2/user/invite-post).
|
560
565
|
|
561
566
|
Examples:
|
562
567
|
response = authn.user.invite(
|
@@ -601,7 +606,7 @@ class AuthN(ServiceBase):
|
|
601
606
|
Returns:
|
602
607
|
A PangeaResponse with a user and its information in the response.result field.
|
603
608
|
Available response fields can be found in our
|
604
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/update).
|
609
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/update-post).
|
605
610
|
|
606
611
|
Examples:
|
607
612
|
response = authn.user.update(
|
@@ -644,7 +649,7 @@ class AuthN(ServiceBase):
|
|
644
649
|
Returns:
|
645
650
|
A PangeaResponse with a list of users in the response.result field.
|
646
651
|
Available response fields can be found in our
|
647
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/list).
|
652
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/list-post).
|
648
653
|
|
649
654
|
Examples:
|
650
655
|
response = authn.user.list()
|
@@ -663,7 +668,7 @@ class AuthN(ServiceBase):
|
|
663
668
|
return self.request.post("v2/user/list", m.UserListResult, data=input.model_dump(exclude_none=True))
|
664
669
|
|
665
670
|
class Invites(ServiceBase):
|
666
|
-
service_name =
|
671
|
+
service_name = _SERVICE_NAME
|
667
672
|
|
668
673
|
def __init__(
|
669
674
|
self,
|
@@ -698,7 +703,7 @@ class AuthN(ServiceBase):
|
|
698
703
|
Returns:
|
699
704
|
A PangeaResponse with a list of pending user invitations in the response.result field.
|
700
705
|
Available response fields can be found in our
|
701
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/invite#/v2/user/invite/list).
|
706
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/invite#/v2/user/invite/list-post).
|
702
707
|
Examples:
|
703
708
|
response = authn.user.invites.list()
|
704
709
|
"""
|
@@ -735,7 +740,7 @@ class AuthN(ServiceBase):
|
|
735
740
|
)
|
736
741
|
|
737
742
|
class Authenticators(ServiceBase):
|
738
|
-
service_name =
|
743
|
+
service_name = _SERVICE_NAME
|
739
744
|
|
740
745
|
def __init__(
|
741
746
|
self,
|
@@ -802,7 +807,7 @@ class AuthN(ServiceBase):
|
|
802
807
|
Returns:
|
803
808
|
A PangeaResponse with a list of authenticators in the response.result field.
|
804
809
|
Available response fields can be found in our
|
805
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/authenticators/list).
|
810
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/authenticators/list-post).
|
806
811
|
|
807
812
|
Examples:
|
808
813
|
response = authn.user.authenticators.list(
|
@@ -817,7 +822,7 @@ class AuthN(ServiceBase):
|
|
817
822
|
)
|
818
823
|
|
819
824
|
class Profile(ServiceBase):
|
820
|
-
service_name =
|
825
|
+
service_name = _SERVICE_NAME
|
821
826
|
|
822
827
|
def __init__(
|
823
828
|
self,
|
@@ -845,7 +850,7 @@ class AuthN(ServiceBase):
|
|
845
850
|
Returns:
|
846
851
|
A PangeaResponse with a user and its information in the response.result field.
|
847
852
|
Available response fields can be found in our
|
848
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/profile/get).
|
853
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/profile/get-post).
|
849
854
|
|
850
855
|
Examples:
|
851
856
|
response = authn.user.profile.get(
|
@@ -881,7 +886,7 @@ class AuthN(ServiceBase):
|
|
881
886
|
Returns:
|
882
887
|
A PangeaResponse with a user and its information in the response.result field.
|
883
888
|
Available response fields can be found in our
|
884
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/profile/update).
|
889
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/profile/update-post).
|
885
890
|
|
886
891
|
Examples:
|
887
892
|
response = authn.user.profile.update(
|
@@ -901,8 +906,57 @@ class AuthN(ServiceBase):
|
|
901
906
|
"v2/user/profile/update", m.UserProfileUpdateResult, data=input.model_dump(exclude_none=True)
|
902
907
|
)
|
903
908
|
|
909
|
+
class Group(ServiceBase):
|
910
|
+
service_name = _SERVICE_NAME
|
911
|
+
|
912
|
+
def __init__(
|
913
|
+
self,
|
914
|
+
token: str,
|
915
|
+
config: PangeaConfig | None = None,
|
916
|
+
logger_name: str = "pangea",
|
917
|
+
) -> None:
|
918
|
+
super().__init__(token, config, logger_name=logger_name)
|
919
|
+
|
920
|
+
def assign(self, user_id: str, group_ids: list[str]) -> PangeaResponse[PangeaResponseResult]:
|
921
|
+
"""
|
922
|
+
Assign groups to a user
|
923
|
+
|
924
|
+
Add a list of groups to a specified user
|
925
|
+
|
926
|
+
OperationId: authn_post_v2_user_group_assign
|
927
|
+
"""
|
928
|
+
return self.request.post(
|
929
|
+
"v2/user/group/assign",
|
930
|
+
data={"id": user_id, "group_ids": group_ids},
|
931
|
+
result_class=m.PangeaResponseResult,
|
932
|
+
)
|
933
|
+
|
934
|
+
def remove(self, user_id: str, group_id: str) -> PangeaResponse[PangeaResponseResult]:
|
935
|
+
"""
|
936
|
+
Remove a group assigned to a user
|
937
|
+
|
938
|
+
Remove a group assigned to a user
|
939
|
+
|
940
|
+
OperationId: authn_post_v2_user_group_remove
|
941
|
+
"""
|
942
|
+
return self.request.post(
|
943
|
+
"v2/user/group/remove",
|
944
|
+
data={"id": user_id, "group_id": group_id},
|
945
|
+
result_class=m.PangeaResponseResult,
|
946
|
+
)
|
947
|
+
|
948
|
+
def list(self, user_id: str) -> PangeaResponse[m.GroupList]:
|
949
|
+
"""
|
950
|
+
List of groups assigned to a user
|
951
|
+
|
952
|
+
Return a list of ids for groups assigned to a user
|
953
|
+
|
954
|
+
OperationId: authn_post_v2_user_group_list
|
955
|
+
"""
|
956
|
+
return self.request.post("v2/user/group/list", data={"id": user_id}, result_class=m.GroupList)
|
957
|
+
|
904
958
|
class Flow(ServiceBase):
|
905
|
-
service_name =
|
959
|
+
service_name = _SERVICE_NAME
|
906
960
|
|
907
961
|
def __init__(
|
908
962
|
self,
|
@@ -926,7 +980,7 @@ class AuthN(ServiceBase):
|
|
926
980
|
Returns:
|
927
981
|
A PangeaResponse with credentials for a login session in the response.result field.
|
928
982
|
Available response fields can be found in our
|
929
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/flow#/v2/flow/complete).
|
983
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/flow#/v2/flow/complete-post).
|
930
984
|
|
931
985
|
Examples:
|
932
986
|
response = authn.flow.complete(
|
@@ -955,7 +1009,7 @@ class AuthN(ServiceBase):
|
|
955
1009
|
A PangeaResponse with information about next steps needed
|
956
1010
|
to complete a flow in the response.result field.
|
957
1011
|
Available response fields can be found in our
|
958
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/flow#/v2/flow/restart).
|
1012
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/flow#/v2/flow/restart-post).
|
959
1013
|
|
960
1014
|
Examples:
|
961
1015
|
response = authn.flow.restart(
|
@@ -992,7 +1046,7 @@ class AuthN(ServiceBase):
|
|
992
1046
|
A PangeaResponse with information about next steps needed
|
993
1047
|
to complete a flow in the response.result field.
|
994
1048
|
Available response fields can be found in our
|
995
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/flow#/v2/flow/start).
|
1049
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/flow#/v2/flow/start-post).
|
996
1050
|
|
997
1051
|
Examples:
|
998
1052
|
response = authn.flow.start(
|
@@ -1026,7 +1080,7 @@ class AuthN(ServiceBase):
|
|
1026
1080
|
A PangeaResponse with information about next steps needed
|
1027
1081
|
to complete a flow in the response.result field.
|
1028
1082
|
Available response fields can be found in our
|
1029
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/flow#/v2/flow/update).
|
1083
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/flow#/v2/flow/update-post).
|
1030
1084
|
|
1031
1085
|
Examples:
|
1032
1086
|
response = authn.flow.update(
|
@@ -1042,7 +1096,7 @@ class AuthN(ServiceBase):
|
|
1042
1096
|
return self.request.post("v2/flow/update", m.FlowUpdateResult, data=input.model_dump(exclude_none=True))
|
1043
1097
|
|
1044
1098
|
class Agreements(ServiceBase):
|
1045
|
-
service_name =
|
1099
|
+
service_name = _SERVICE_NAME
|
1046
1100
|
|
1047
1101
|
def __init__(
|
1048
1102
|
self,
|
@@ -1071,7 +1125,7 @@ class AuthN(ServiceBase):
|
|
1071
1125
|
Returns:
|
1072
1126
|
A PangeaResponse with a EULA object in the response.result field.
|
1073
1127
|
Available response fields can be found in our
|
1074
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/agreements#/v2/agreements/create).
|
1128
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/agreements#/v2/agreements/create-post).
|
1075
1129
|
|
1076
1130
|
Examples:
|
1077
1131
|
response = authn.agreements.create(
|
@@ -1138,7 +1192,7 @@ class AuthN(ServiceBase):
|
|
1138
1192
|
Returns:
|
1139
1193
|
A PangeaResponse with a list of EULA objects in the response.result field.
|
1140
1194
|
Available response fields can be found in our
|
1141
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/agreements#/v2/agreements/list).
|
1195
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/agreements#/v2/agreements/list-post).
|
1142
1196
|
|
1143
1197
|
Examples:
|
1144
1198
|
response = authn.agreements.list()
|
@@ -1177,7 +1231,7 @@ class AuthN(ServiceBase):
|
|
1177
1231
|
Returns:
|
1178
1232
|
A PangeaResponse with the updated EULA object in the response.result field.
|
1179
1233
|
Available response fields can be found in our
|
1180
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/agreements#/v2/agreements/update).
|
1234
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/agreements#/v2/agreements/update-post).
|
1181
1235
|
|
1182
1236
|
Examples:
|
1183
1237
|
response = authn.agreements.update(
|
@@ -1192,3 +1246,108 @@ class AuthN(ServiceBase):
|
|
1192
1246
|
return self.request.post(
|
1193
1247
|
"v2/agreements/update", m.AgreementUpdateResult, data=input.model_dump(exclude_none=True)
|
1194
1248
|
)
|
1249
|
+
|
1250
|
+
class Group(ServiceBase):
|
1251
|
+
service_name = _SERVICE_NAME
|
1252
|
+
|
1253
|
+
def __init__(
|
1254
|
+
self,
|
1255
|
+
token: str,
|
1256
|
+
config: PangeaConfig | None = None,
|
1257
|
+
logger_name: str = "pangea",
|
1258
|
+
) -> None:
|
1259
|
+
super().__init__(token, config, logger_name=logger_name)
|
1260
|
+
|
1261
|
+
def create(
|
1262
|
+
self, name: str, type: str, *, description: str | None = None, attributes: dict[str, str] | None = None
|
1263
|
+
) -> PangeaResponse[m.GroupInfo]:
|
1264
|
+
"""
|
1265
|
+
Create a new group
|
1266
|
+
|
1267
|
+
Create a new group
|
1268
|
+
|
1269
|
+
OperationId: authn_post_v2_group_create
|
1270
|
+
"""
|
1271
|
+
return self.request.post(
|
1272
|
+
"v2/group/create",
|
1273
|
+
data={"name": name, "type": type, "description": description, "attributes": attributes},
|
1274
|
+
result_class=m.GroupInfo,
|
1275
|
+
)
|
1276
|
+
|
1277
|
+
def delete(self, id: str) -> PangeaResponse[PangeaResponseResult]:
|
1278
|
+
"""
|
1279
|
+
Delete a group
|
1280
|
+
|
1281
|
+
Delete a group
|
1282
|
+
|
1283
|
+
OperationId: authn_post_v2_group_delete
|
1284
|
+
"""
|
1285
|
+
return self.request.post("v2/group/delete", data={"id": id}, result_class=PangeaResponseResult)
|
1286
|
+
|
1287
|
+
def get(self, id: str) -> PangeaResponse[m.GroupInfo]:
|
1288
|
+
"""
|
1289
|
+
Get group information
|
1290
|
+
|
1291
|
+
Look up a group by ID and return its information.
|
1292
|
+
|
1293
|
+
OperationId: authn_post_v2_group_get
|
1294
|
+
"""
|
1295
|
+
return self.request.post("v2/group/get", data={"id": id}, result_class=m.GroupInfo)
|
1296
|
+
|
1297
|
+
def list(
|
1298
|
+
self,
|
1299
|
+
*,
|
1300
|
+
filter: m.GroupsFilter | None = None,
|
1301
|
+
last: str | None = None,
|
1302
|
+
order: Literal["asc", "desc"] | None = None,
|
1303
|
+
order_by: Literal["id", "created_at", "updated_at", "name", "type"] | None = None,
|
1304
|
+
size: int | None = None,
|
1305
|
+
) -> PangeaResponse[m.GroupList]:
|
1306
|
+
"""
|
1307
|
+
List groups
|
1308
|
+
|
1309
|
+
Look up groups by name, type, or attributes.
|
1310
|
+
"""
|
1311
|
+
return self.request.post(
|
1312
|
+
"v2/group/list",
|
1313
|
+
data={"filter": filter, "last": last, "order": order, "order_by": order_by, "size": size},
|
1314
|
+
result_class=m.GroupList,
|
1315
|
+
)
|
1316
|
+
|
1317
|
+
def list_users(
|
1318
|
+
self, id: str, *, last: str | None = None, size: int | None = None
|
1319
|
+
) -> PangeaResponse[m.GroupUserList]:
|
1320
|
+
"""
|
1321
|
+
List of users assigned to a group
|
1322
|
+
|
1323
|
+
Return a list of ids for users assigned to a group
|
1324
|
+
|
1325
|
+
OperationId: authn_post_v2_group_user_list
|
1326
|
+
"""
|
1327
|
+
return self.request.post(
|
1328
|
+
"v2/group/user/list",
|
1329
|
+
data={"id": id, "last": last, "size": size},
|
1330
|
+
result_class=m.GroupUserList,
|
1331
|
+
)
|
1332
|
+
|
1333
|
+
def update(
|
1334
|
+
self,
|
1335
|
+
id: str,
|
1336
|
+
*,
|
1337
|
+
name: str | None = None,
|
1338
|
+
description: str | None = None,
|
1339
|
+
type: str | None = None,
|
1340
|
+
attributes: dict[str, str] | None = None,
|
1341
|
+
) -> PangeaResponse[m.GroupInfo]:
|
1342
|
+
"""
|
1343
|
+
Update group information
|
1344
|
+
|
1345
|
+
Update group information
|
1346
|
+
|
1347
|
+
OperationId: authn_post_v2_group_update
|
1348
|
+
"""
|
1349
|
+
return self.request.post(
|
1350
|
+
"v2/group/update",
|
1351
|
+
data={"id": id, "name": name, "description": description, "type": type, "attributes": attributes},
|
1352
|
+
result_class=m.GroupInfo,
|
1353
|
+
)
|
pangea/services/authn/models.py
CHANGED
@@ -939,3 +939,97 @@ class AgreementUpdateRequest(APIRequestModel):
|
|
939
939
|
|
940
940
|
class AgreementUpdateResult(AgreementInfo):
|
941
941
|
pass
|
942
|
+
|
943
|
+
|
944
|
+
class GroupInfo(PangeaResponseResult):
|
945
|
+
"""A group and its information"""
|
946
|
+
|
947
|
+
id: str
|
948
|
+
name: str
|
949
|
+
type: str
|
950
|
+
|
951
|
+
description: Optional[str] = None
|
952
|
+
attributes: Optional[Dict[str, str]] = None
|
953
|
+
created_at: Optional[str] = None
|
954
|
+
updated_at: Optional[str] = None
|
955
|
+
|
956
|
+
|
957
|
+
class GroupsFilter(APIRequestModel):
|
958
|
+
"""Search filter for groups"""
|
959
|
+
|
960
|
+
created_at: Optional[str] = None
|
961
|
+
"""Only records where created_at equals this value."""
|
962
|
+
|
963
|
+
created_at__gt: Optional[str] = None
|
964
|
+
"""Only records where created_at is greater than this value."""
|
965
|
+
|
966
|
+
created_at__gte: Optional[str] = None
|
967
|
+
"""Only records where created_at is greater than or equal to this value."""
|
968
|
+
|
969
|
+
created_at__lt: Optional[str] = None
|
970
|
+
"""Only records where created_at is less than this value."""
|
971
|
+
|
972
|
+
created_at__lte: Optional[str] = None
|
973
|
+
"""Only records where created_at is less than or equal to this value."""
|
974
|
+
|
975
|
+
created_at__contains: Optional[str] = None
|
976
|
+
"""Only records where created_at includes this value."""
|
977
|
+
|
978
|
+
id: Optional[str] = None
|
979
|
+
"""Only records where id equals this value."""
|
980
|
+
|
981
|
+
id__contains: Optional[List[str]] = None
|
982
|
+
"""Only records where id includes each substring."""
|
983
|
+
|
984
|
+
id__in: Optional[List[str]] = None
|
985
|
+
"""Only records where id equals one of the provided substrings."""
|
986
|
+
|
987
|
+
name: Optional[str] = None
|
988
|
+
"""Only records where name equals this value."""
|
989
|
+
|
990
|
+
name__contains: Optional[List[str]] = None
|
991
|
+
"""Only records where name includes each substring."""
|
992
|
+
|
993
|
+
name__in: Optional[List[str]] = None
|
994
|
+
"""Only records where name equals one of the provided substrings."""
|
995
|
+
|
996
|
+
type: Optional[str] = None
|
997
|
+
"""Only records where type equals this value."""
|
998
|
+
|
999
|
+
type__contains: Optional[List[str]] = None
|
1000
|
+
"""Only records where type includes each substring."""
|
1001
|
+
|
1002
|
+
type__in: Optional[List[str]] = None
|
1003
|
+
"""Only records where type equals one of the provided substrings."""
|
1004
|
+
|
1005
|
+
updated_at: Optional[str] = None
|
1006
|
+
"""Only records where updated_at equals this value."""
|
1007
|
+
|
1008
|
+
updated_at__gt: Optional[str] = None
|
1009
|
+
"""Only records where updated_at is greater than this value."""
|
1010
|
+
|
1011
|
+
updated_at__gte: Optional[str] = None
|
1012
|
+
"""Only records where updated_at is greater than or equal to this value."""
|
1013
|
+
|
1014
|
+
updated_at__lt: Optional[str] = None
|
1015
|
+
"""Only records where updated_at is less than this value."""
|
1016
|
+
|
1017
|
+
updated_at__lte: Optional[str] = None
|
1018
|
+
"""Only records where updated_at is less than or equal to this value."""
|
1019
|
+
|
1020
|
+
updated_at__contains: Optional[str] = None
|
1021
|
+
"""Only records where updated_at includes this value."""
|
1022
|
+
|
1023
|
+
|
1024
|
+
class GroupList(PangeaResponseResult):
|
1025
|
+
groups: List[GroupInfo]
|
1026
|
+
"""List of matching groups"""
|
1027
|
+
|
1028
|
+
count: int
|
1029
|
+
last: Optional[str] = None
|
1030
|
+
|
1031
|
+
|
1032
|
+
class GroupUserList(PangeaResponseResult):
|
1033
|
+
users: List[User]
|
1034
|
+
count: int
|
1035
|
+
last: Optional[str] = None
|