meshtrade 1.23.0__py3-none-any.whl → 1.24.0__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 meshtrade might be problematic. Click here for more details.
- meshtrade/compliance/client/v1/__init__.py +12 -0
- meshtrade/compliance/client/v1/service_meshpy.py +1 -0
- meshtrade/iam/api_user/v1/__init__.py +10 -4
- meshtrade/iam/api_user/v1/api_user_pb2.py +7 -7
- meshtrade/iam/api_user/v1/service_meshpy.py +13 -12
- meshtrade/iam/api_user/v1/service_pb2.py +31 -31
- meshtrade/iam/api_user/v1/service_pb2.pyi +10 -10
- meshtrade/iam/api_user/v1/service_pb2_grpc.py +22 -22
- meshtrade/iam/group/v1/service_meshpy.py +1 -0
- meshtrade/iam/role/v1/__init__.py +15 -1
- meshtrade/iam/role/v1/role.py +14 -14
- meshtrade/iam/user/v1/__init__.py +4 -2
- meshtrade/iam/user/v1/service_meshpy.py +24 -6
- meshtrade/iam/user/v1/service_pb2.py +37 -29
- meshtrade/iam/user/v1/service_pb2.pyi +13 -5
- meshtrade/iam/user/v1/service_pb2_grpc.py +60 -11
- meshtrade/iam/user/v1/user_pb2.py +3 -3
- meshtrade/ledger/transaction/v1/__init__.py +4 -0
- meshtrade/ledger/transaction/v1/service_meshpy.py +2 -1
- meshtrade/reporting/account_report/v1/__init__.py +4 -0
- meshtrade/reporting/account_report/v1/service_meshpy.py +1 -0
- meshtrade/trading/limit_order/v1/service_meshpy.py +1 -0
- meshtrade/trading/market_order/v1/service_meshpy.py +1 -0
- meshtrade/type/v1/__init__.py +81 -11
- meshtrade/wallet/account/v1/service_meshpy.py +1 -0
- {meshtrade-1.23.0.dist-info → meshtrade-1.24.0.dist-info}/METADATA +1 -1
- {meshtrade-1.23.0.dist-info → meshtrade-1.24.0.dist-info}/RECORD +29 -30
- meshtrade/iam/api_user/v1/service.py +0 -58
- {meshtrade-1.23.0.dist-info → meshtrade-1.24.0.dist-info}/WHEEL +0 -0
- {meshtrade-1.23.0.dist-info → meshtrade-1.24.0.dist-info}/top_level.txt +0 -0
|
@@ -55,6 +55,13 @@ from .service_meshpy import (
|
|
|
55
55
|
#
|
|
56
56
|
# ===================================================================
|
|
57
57
|
|
|
58
|
+
from .client_roles import (
|
|
59
|
+
get_client_default_role_index,
|
|
60
|
+
get_client_default_roles,
|
|
61
|
+
must_get_client_default_role_index,
|
|
62
|
+
must_get_client_default_roles,
|
|
63
|
+
)
|
|
64
|
+
|
|
58
65
|
# ===================================================================
|
|
59
66
|
# MODULE EXPORTS
|
|
60
67
|
# ===================================================================
|
|
@@ -84,4 +91,9 @@ __all__ = [
|
|
|
84
91
|
"TaxResidency",
|
|
85
92
|
"Trust",
|
|
86
93
|
"VerificationStatus",
|
|
94
|
+
# Manual exports
|
|
95
|
+
"get_client_default_role_index",
|
|
96
|
+
"get_client_default_roles",
|
|
97
|
+
"must_get_client_default_role_index",
|
|
98
|
+
"must_get_client_default_roles",
|
|
87
99
|
]
|
|
@@ -17,14 +17,14 @@ from .api_credentials_pb2 import APICredentials
|
|
|
17
17
|
from .api_user_pb2 import APIUser, APIUserAction, APIUserState
|
|
18
18
|
from .service_pb2 import (
|
|
19
19
|
ActivateApiUserRequest,
|
|
20
|
-
|
|
20
|
+
AssignRolesToAPIUserRequest,
|
|
21
21
|
CreateApiUserRequest,
|
|
22
22
|
DeactivateApiUserRequest,
|
|
23
23
|
GetApiUserByKeyHashRequest,
|
|
24
24
|
GetApiUserRequest,
|
|
25
25
|
ListApiUsersRequest,
|
|
26
26
|
ListApiUsersResponse,
|
|
27
|
-
|
|
27
|
+
RevokeRolesFromAPIUserRequest,
|
|
28
28
|
SearchApiUsersRequest,
|
|
29
29
|
SearchApiUsersResponse,
|
|
30
30
|
)
|
|
@@ -62,7 +62,10 @@ from meshtrade.common import (
|
|
|
62
62
|
from .api_credentials import (
|
|
63
63
|
MESH_API_CREDENTIALS_ENV_VAR,
|
|
64
64
|
api_credentials_from_environment,
|
|
65
|
+
default_credentials_path,
|
|
66
|
+
find_credentials,
|
|
65
67
|
load_api_credentials_from_file,
|
|
68
|
+
load_default_credentials,
|
|
66
69
|
)
|
|
67
70
|
|
|
68
71
|
# ===================================================================
|
|
@@ -79,14 +82,14 @@ __all__ = [
|
|
|
79
82
|
"ApiUserService",
|
|
80
83
|
"ApiUserServiceGRPCClient",
|
|
81
84
|
"ApiUserServiceGRPCClientInterface",
|
|
82
|
-
"
|
|
85
|
+
"AssignRolesToAPIUserRequest",
|
|
83
86
|
"CreateApiUserRequest",
|
|
84
87
|
"DeactivateApiUserRequest",
|
|
85
88
|
"GetApiUserByKeyHashRequest",
|
|
86
89
|
"GetApiUserRequest",
|
|
87
90
|
"ListApiUsersRequest",
|
|
88
91
|
"ListApiUsersResponse",
|
|
89
|
-
"
|
|
92
|
+
"RevokeRolesFromAPIUserRequest",
|
|
90
93
|
"SearchApiUsersRequest",
|
|
91
94
|
"SearchApiUsersResponse",
|
|
92
95
|
# Manual exports
|
|
@@ -97,5 +100,8 @@ __all__ = [
|
|
|
97
100
|
"MESH_API_CREDENTIALS_ENV_VAR",
|
|
98
101
|
"api_credentials_from_environment",
|
|
99
102
|
"create_auth_metadata",
|
|
103
|
+
"default_credentials_path",
|
|
104
|
+
"find_credentials",
|
|
100
105
|
"load_api_credentials_from_file",
|
|
106
|
+
"load_default_credentials",
|
|
101
107
|
]
|
|
@@ -25,7 +25,7 @@ _sym_db = _symbol_database.Default()
|
|
|
25
25
|
from buf.validate import validate_pb2 as buf_dot_validate_dot_validate__pb2
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n(meshtrade/iam/api_user/v1/api_user.proto\x12\x19meshtrade.iam.api_user.v1\x1a\x1b\x62uf/validate/validate.proto\"\
|
|
28
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n(meshtrade/iam/api_user/v1/api_user.proto\x12\x19meshtrade.iam.api_user.v1\x1a\x1b\x62uf/validate/validate.proto\"\xa0\x06\n\x07\x41PIUser\x12\xc2\x01\n\x04name\x18\x01 \x01(\tB\xad\x01\xbaH\xa9\x01\xba\x01\xa5\x01\n\x14name.format.optional\x12\x36name must be empty or in the format api_users/{ULIDv2}\x1aUsize(this) == 0 || this.matches(\'^api_users/[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}$\')R\x04name\x12R\n\x05owner\x18\x02 \x01(\tB<\xbaH9r42/^groups/[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}$\x98\x01!\xc8\x01\x01R\x05owner\x12\xb4\x01\n\x0c\x64isplay_name\x18\x03 \x01(\tB\x90\x01\xbaH\x8c\x01r\x05\x10\x01\x18\xff\x01\xba\x01\x7f\n\x15\x64isplay_name.required\x12\x41\x64isplay name is required and must be between 1 and 255 characters\x1a#size(this) > 0 && size(this) <= 255\xc8\x01\x01R\x0b\x64isplayName\x12\xbe\x01\n\x05state\x18\x04 \x01(\x0e\x32\'.meshtrade.iam.api_user.v1.APIUserStateB\x7f\xbaH|\x82\x01\x02\x10\x01\xba\x01t\n\x0bstate.valid\x12/state must be a valid APIUserState if specified\x1a\x34int(this) == 0 || (int(this) >= 1 && int(this) <= 2)R\x05state\x12k\n\x05roles\x18\x05 \x03(\tBU\xbaHR\x92\x01O\"MrK\x10/\x18\x30\x32\x45^groups/[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}/roles/[1-9][0-9]{6,7}$R\x05roles\x12\x17\n\x07\x61pi_key\x18\x06 \x01(\tR\x06\x61piKey*f\n\x0c\x41PIUserState\x12\x1e\n\x1a\x41PI_USER_STATE_UNSPECIFIED\x10\x00\x12\x19\n\x15\x41PI_USER_STATE_ACTIVE\x10\x01\x12\x1b\n\x17\x41PI_USER_STATE_INACTIVE\x10\x02*\xa6\x01\n\rAPIUserAction\x12\x1f\n\x1b\x41PI_USER_ACTION_UNSPECIFIED\x10\x00\x12\x1c\n\x18\x41PI_USER_ACTION_ACTIVATE\x10\x01\x12\x1e\n\x1a\x41PI_USER_ACTION_DEACTIVATE\x10\x02\x12\x1a\n\x16\x41PI_USER_ACTION_CREATE\x10\x03\x12\x1a\n\x16\x41PI_USER_ACTION_UPDATE\x10\x04\x42[\n co.meshtrade.api.iam.api_user.v1Z7github.com/meshtrade/api/go/iam/api_user/v1;api_user_v1b\x06proto3')
|
|
29
29
|
|
|
30
30
|
_globals = globals()
|
|
31
31
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
@@ -42,11 +42,11 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
|
42
42
|
_globals['_APIUSER'].fields_by_name['state']._loaded_options = None
|
|
43
43
|
_globals['_APIUSER'].fields_by_name['state']._serialized_options = b'\272H|\202\001\002\020\001\272\001t\n\013state.valid\022/state must be a valid APIUserState if specified\0324int(this) == 0 || (int(this) >= 1 && int(this) <= 2)'
|
|
44
44
|
_globals['_APIUSER'].fields_by_name['roles']._loaded_options = None
|
|
45
|
-
_globals['_APIUSER'].fields_by_name['roles']._serialized_options = b'\
|
|
46
|
-
_globals['_APIUSERSTATE']._serialized_start=
|
|
47
|
-
_globals['_APIUSERSTATE']._serialized_end=
|
|
48
|
-
_globals['_APIUSERACTION']._serialized_start=
|
|
49
|
-
_globals['_APIUSERACTION']._serialized_end=
|
|
45
|
+
_globals['_APIUSER'].fields_by_name['roles']._serialized_options = b'\272HR\222\001O\"MrK\020/\03002E^groups/[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}/roles/[1-9][0-9]{6,7}$'
|
|
46
|
+
_globals['_APIUSERSTATE']._serialized_start=903
|
|
47
|
+
_globals['_APIUSERSTATE']._serialized_end=1005
|
|
48
|
+
_globals['_APIUSERACTION']._serialized_start=1008
|
|
49
|
+
_globals['_APIUSERACTION']._serialized_end=1174
|
|
50
50
|
_globals['_APIUSER']._serialized_start=101
|
|
51
|
-
_globals['_APIUSER']._serialized_end=
|
|
51
|
+
_globals['_APIUSER']._serialized_end=901
|
|
52
52
|
# @@protoc_insertion_point(module_scope)
|
|
@@ -9,6 +9,7 @@ the service interface with resource management capabilities, providing authentic
|
|
|
9
9
|
timeouts, and proper connection handling.
|
|
10
10
|
"""
|
|
11
11
|
|
|
12
|
+
from collections.abc import Iterator
|
|
12
13
|
from datetime import timedelta
|
|
13
14
|
from typing import Optional
|
|
14
15
|
|
|
@@ -19,14 +20,14 @@ from .api_user_pb2 import APIUser
|
|
|
19
20
|
from meshtrade.common.service_options import ServiceOptions
|
|
20
21
|
from .service_pb2 import (
|
|
21
22
|
ActivateApiUserRequest,
|
|
22
|
-
|
|
23
|
+
AssignRolesToAPIUserRequest,
|
|
23
24
|
CreateApiUserRequest,
|
|
24
25
|
DeactivateApiUserRequest,
|
|
25
26
|
GetApiUserByKeyHashRequest,
|
|
26
27
|
GetApiUserRequest,
|
|
27
28
|
ListApiUsersRequest,
|
|
28
29
|
ListApiUsersResponse,
|
|
29
|
-
|
|
30
|
+
RevokeRolesFromAPIUserRequest,
|
|
30
31
|
SearchApiUsersRequest,
|
|
31
32
|
SearchApiUsersResponse,
|
|
32
33
|
)
|
|
@@ -171,37 +172,37 @@ class ApiUserService(BaseGRPCClient):
|
|
|
171
172
|
"""
|
|
172
173
|
return self._execute_method("CreateApiUser", request, timeout)
|
|
173
174
|
|
|
174
|
-
def
|
|
175
|
-
"""
|
|
175
|
+
def assign_roles_to_apiuser(self, request: AssignRolesToAPIUserRequest, timeout: Optional[timedelta] = None) -> APIUser:
|
|
176
|
+
"""AssignRolesToAPIUser method.
|
|
176
177
|
|
|
177
178
|
Args:
|
|
178
|
-
request: The
|
|
179
|
+
request: The AssignRolesToAPIUser request message
|
|
179
180
|
timeout: Optional timeout override for this call
|
|
180
181
|
|
|
181
182
|
Returns:
|
|
182
|
-
The
|
|
183
|
+
The AssignRolesToAPIUser response message
|
|
183
184
|
|
|
184
185
|
Raises:
|
|
185
186
|
grpc.RpcError: If the gRPC call fails
|
|
186
187
|
ValueError: If authentication credentials are missing
|
|
187
188
|
"""
|
|
188
|
-
return self._execute_method("
|
|
189
|
+
return self._execute_method("AssignRolesToAPIUser", request, timeout)
|
|
189
190
|
|
|
190
|
-
def
|
|
191
|
-
"""
|
|
191
|
+
def revoke_roles_from_apiuser(self, request: RevokeRolesFromAPIUserRequest, timeout: Optional[timedelta] = None) -> APIUser:
|
|
192
|
+
"""RevokeRolesFromAPIUser method.
|
|
192
193
|
|
|
193
194
|
Args:
|
|
194
|
-
request: The
|
|
195
|
+
request: The RevokeRolesFromAPIUser request message
|
|
195
196
|
timeout: Optional timeout override for this call
|
|
196
197
|
|
|
197
198
|
Returns:
|
|
198
|
-
The
|
|
199
|
+
The RevokeRolesFromAPIUser response message
|
|
199
200
|
|
|
200
201
|
Raises:
|
|
201
202
|
grpc.RpcError: If the gRPC call fails
|
|
202
203
|
ValueError: If authentication credentials are missing
|
|
203
204
|
"""
|
|
204
|
-
return self._execute_method("
|
|
205
|
+
return self._execute_method("RevokeRolesFromAPIUser", request, timeout)
|
|
205
206
|
|
|
206
207
|
def list_api_users(self, request: ListApiUsersRequest, timeout: Optional[timedelta] = None) -> ListApiUsersResponse:
|
|
207
208
|
"""ListApiUsers method.
|
|
@@ -28,7 +28,7 @@ from meshtrade.iam.role.v1 import role_pb2 as meshtrade_dot_iam_dot_role_dot_v1_
|
|
|
28
28
|
from meshtrade.option.v1 import method_type_pb2 as meshtrade_dot_option_dot_v1_dot_method__type__pb2
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\'meshtrade/iam/api_user/v1/service.proto\x12\x19meshtrade.iam.api_user.v1\x1a\x1b\x62uf/validate/validate.proto\x1a(meshtrade/iam/api_user/v1/api_user.proto\x1a meshtrade/iam/role/v1/role.proto\x1a%meshtrade/option/v1/method_type.proto\"h\n\x11GetApiUserRequest\x12S\n\x04name\x18\x01 \x01(\tB?\xbaH<r722^api_users/[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}$\x98\x01$\xc8\x01\x01R\x04name\"Z\n\x1aGetApiUserByKeyHashRequest\x12<\n\x08key_hash\x18\x01 \x01(\tB!\xbaH\x1er\x19\x32\x14^[A-Za-z0-9+/]{43}=$\x98\x01,\xc8\x01\x01R\x07keyHash\"]\n\x14\x43reateApiUserRequest\x12\x45\n\x08\x61pi_user\x18\x01 \x01(\x0b\x32\".meshtrade.iam.api_user.v1.APIUserB\x06\xbaH\x03\xc8\x01\x01R\x07\x61piUser\"\
|
|
31
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\'meshtrade/iam/api_user/v1/service.proto\x12\x19meshtrade.iam.api_user.v1\x1a\x1b\x62uf/validate/validate.proto\x1a(meshtrade/iam/api_user/v1/api_user.proto\x1a meshtrade/iam/role/v1/role.proto\x1a%meshtrade/option/v1/method_type.proto\"h\n\x11GetApiUserRequest\x12S\n\x04name\x18\x01 \x01(\tB?\xbaH<r722^api_users/[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}$\x98\x01$\xc8\x01\x01R\x04name\"Z\n\x1aGetApiUserByKeyHashRequest\x12<\n\x08key_hash\x18\x01 \x01(\tB!\xbaH\x1er\x19\x32\x14^[A-Za-z0-9+/]{43}=$\x98\x01,\xc8\x01\x01R\x07keyHash\"]\n\x14\x43reateApiUserRequest\x12\x45\n\x08\x61pi_user\x18\x01 \x01(\x0b\x32\".meshtrade.iam.api_user.v1.APIUserB\x06\xbaH\x03\xc8\x01\x01R\x07\x61piUser\"\xe2\x01\n\x1b\x41ssignRolesToAPIUserRequest\x12S\n\x04name\x18\x01 \x01(\tB?\xbaH<r722^api_users/[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}$\x98\x01$\xc8\x01\x01R\x04name\x12n\n\x05roles\x18\x02 \x03(\tBX\xbaHU\x92\x01O\"MrK\x10/\x18\x30\x32\x45^groups/[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}/roles/[1-9][0-9]{6,7}$\xc8\x01\x01R\x05roles\"\xe4\x01\n\x1dRevokeRolesFromAPIUserRequest\x12S\n\x04name\x18\x01 \x01(\tB?\xbaH<r722^api_users/[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}$\x98\x01$\xc8\x01\x01R\x04name\x12n\n\x05roles\x18\x02 \x03(\tBX\xbaHU\x92\x01O\"MrK\x10/\x18\x30\x32\x45^groups/[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}/roles/[1-9][0-9]{6,7}$\xc8\x01\x01R\x05roles\"\x15\n\x13ListApiUsersRequest\"W\n\x14ListApiUsersResponse\x12?\n\tapi_users\x18\x01 \x03(\x0b\x32\".meshtrade.iam.api_user.v1.APIUserR\x08\x61piUsers\":\n\x15SearchApiUsersRequest\x12!\n\x0c\x64isplay_name\x18\x01 \x01(\tR\x0b\x64isplayName\"Y\n\x16SearchApiUsersResponse\x12?\n\tapi_users\x18\x01 \x03(\x0b\x32\".meshtrade.iam.api_user.v1.APIUserR\x08\x61piUsers\"m\n\x16\x41\x63tivateApiUserRequest\x12S\n\x04name\x18\x01 \x01(\tB?\xbaH<r722^api_users/[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}$\x98\x01$\xc8\x01\x01R\x04name\"o\n\x18\x44\x65\x61\x63tivateApiUserRequest\x12S\n\x04name\x18\x01 \x01(\tB?\xbaH<r722^api_users/[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}$\x98\x01$\xc8\x01\x01R\x04name2\xce\t\n\x0e\x41piUserService\x12z\n\nGetApiUser\x12,.meshtrade.iam.api_user.v1.GetApiUserRequest\x1a\".meshtrade.iam.api_user.v1.APIUser\"\x1a\xa0\xb5\x18\x01\xaa\xb5\x18\x12\n\x10\xc0\x8d\xb7\x01\xc1\x8d\xb7\x01\xc2\x8d\xb7\x01\xc3\x8d\xb7\x01\x12x\n\rCreateApiUser\x12/.meshtrade.iam.api_user.v1.CreateApiUserRequest\x1a\".meshtrade.iam.api_user.v1.APIUser\"\x12\xa0\xb5\x18\x02\xaa\xb5\x18\n\n\x08\xc0\x8d\xb7\x01\xc2\x8d\xb7\x01\x12\x86\x01\n\x14\x41ssignRolesToAPIUser\x12\x36.meshtrade.iam.api_user.v1.AssignRolesToAPIUserRequest\x1a\".meshtrade.iam.api_user.v1.APIUser\"\x12\xa0\xb5\x18\x02\xaa\xb5\x18\n\n\x08\xc0\x8d\xb7\x01\xc2\x8d\xb7\x01\x12\x8a\x01\n\x16RevokeRolesFromAPIUser\x12\x38.meshtrade.iam.api_user.v1.RevokeRolesFromAPIUserRequest\x1a\".meshtrade.iam.api_user.v1.APIUser\"\x12\xa0\xb5\x18\x02\xaa\xb5\x18\n\n\x08\xc0\x8d\xb7\x01\xc2\x8d\xb7\x01\x12\x8b\x01\n\x0cListApiUsers\x12..meshtrade.iam.api_user.v1.ListApiUsersRequest\x1a/.meshtrade.iam.api_user.v1.ListApiUsersResponse\"\x1a\xa0\xb5\x18\x01\xaa\xb5\x18\x12\n\x10\xc0\x8d\xb7\x01\xc1\x8d\xb7\x01\xc2\x8d\xb7\x01\xc3\x8d\xb7\x01\x12\x91\x01\n\x0eSearchApiUsers\x12\x30.meshtrade.iam.api_user.v1.SearchApiUsersRequest\x1a\x31.meshtrade.iam.api_user.v1.SearchApiUsersResponse\"\x1a\xa0\xb5\x18\x01\xaa\xb5\x18\x12\n\x10\xc0\x8d\xb7\x01\xc1\x8d\xb7\x01\xc2\x8d\xb7\x01\xc3\x8d\xb7\x01\x12|\n\x0f\x41\x63tivateApiUser\x12\x31.meshtrade.iam.api_user.v1.ActivateApiUserRequest\x1a\".meshtrade.iam.api_user.v1.APIUser\"\x12\xa0\xb5\x18\x02\xaa\xb5\x18\n\n\x08\xc0\x8d\xb7\x01\xc2\x8d\xb7\x01\x12\x80\x01\n\x11\x44\x65\x61\x63tivateApiUser\x12\x33.meshtrade.iam.api_user.v1.DeactivateApiUserRequest\x1a\".meshtrade.iam.api_user.v1.APIUser\"\x12\xa0\xb5\x18\x02\xaa\xb5\x18\n\n\x08\xc0\x8d\xb7\x01\xc2\x8d\xb7\x01\x12\x8c\x01\n\x13GetApiUserByKeyHash\x12\x35.meshtrade.iam.api_user.v1.GetApiUserByKeyHashRequest\x1a\".meshtrade.iam.api_user.v1.APIUser\"\x1a\xa0\xb5\x18\x01\xaa\xb5\x18\x12\n\x10\xc0\x8d\xb7\x01\xc1\x8d\xb7\x01\xc2\x8d\xb7\x01\xc3\x8d\xb7\x01\x42[\n co.meshtrade.api.iam.api_user.v1Z7github.com/meshtrade/api/go/iam/api_user/v1;api_user_v1b\x06proto3')
|
|
32
32
|
|
|
33
33
|
_globals = globals()
|
|
34
34
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
@@ -42,14 +42,14 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
|
42
42
|
_globals['_GETAPIUSERBYKEYHASHREQUEST'].fields_by_name['key_hash']._serialized_options = b'\272H\036r\0312\024^[A-Za-z0-9+/]{43}=$\230\001,\310\001\001'
|
|
43
43
|
_globals['_CREATEAPIUSERREQUEST'].fields_by_name['api_user']._loaded_options = None
|
|
44
44
|
_globals['_CREATEAPIUSERREQUEST'].fields_by_name['api_user']._serialized_options = b'\272H\003\310\001\001'
|
|
45
|
-
_globals['
|
|
46
|
-
_globals['
|
|
47
|
-
_globals['
|
|
48
|
-
_globals['
|
|
49
|
-
_globals['
|
|
50
|
-
_globals['
|
|
51
|
-
_globals['
|
|
52
|
-
_globals['
|
|
45
|
+
_globals['_ASSIGNROLESTOAPIUSERREQUEST'].fields_by_name['name']._loaded_options = None
|
|
46
|
+
_globals['_ASSIGNROLESTOAPIUSERREQUEST'].fields_by_name['name']._serialized_options = b'\272H<r722^api_users/[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}$\230\001$\310\001\001'
|
|
47
|
+
_globals['_ASSIGNROLESTOAPIUSERREQUEST'].fields_by_name['roles']._loaded_options = None
|
|
48
|
+
_globals['_ASSIGNROLESTOAPIUSERREQUEST'].fields_by_name['roles']._serialized_options = b'\272HU\222\001O\"MrK\020/\03002E^groups/[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}/roles/[1-9][0-9]{6,7}$\310\001\001'
|
|
49
|
+
_globals['_REVOKEROLESFROMAPIUSERREQUEST'].fields_by_name['name']._loaded_options = None
|
|
50
|
+
_globals['_REVOKEROLESFROMAPIUSERREQUEST'].fields_by_name['name']._serialized_options = b'\272H<r722^api_users/[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}$\230\001$\310\001\001'
|
|
51
|
+
_globals['_REVOKEROLESFROMAPIUSERREQUEST'].fields_by_name['roles']._loaded_options = None
|
|
52
|
+
_globals['_REVOKEROLESFROMAPIUSERREQUEST'].fields_by_name['roles']._serialized_options = b'\272HU\222\001O\"MrK\020/\03002E^groups/[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}/roles/[1-9][0-9]{6,7}$\310\001\001'
|
|
53
53
|
_globals['_ACTIVATEAPIUSERREQUEST'].fields_by_name['name']._loaded_options = None
|
|
54
54
|
_globals['_ACTIVATEAPIUSERREQUEST'].fields_by_name['name']._serialized_options = b'\272H<r722^api_users/[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}$\230\001$\310\001\001'
|
|
55
55
|
_globals['_DEACTIVATEAPIUSERREQUEST'].fields_by_name['name']._loaded_options = None
|
|
@@ -58,10 +58,10 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
|
58
58
|
_globals['_APIUSERSERVICE'].methods_by_name['GetApiUser']._serialized_options = b'\240\265\030\001\252\265\030\022\n\020\300\215\267\001\301\215\267\001\302\215\267\001\303\215\267\001'
|
|
59
59
|
_globals['_APIUSERSERVICE'].methods_by_name['CreateApiUser']._loaded_options = None
|
|
60
60
|
_globals['_APIUSERSERVICE'].methods_by_name['CreateApiUser']._serialized_options = b'\240\265\030\002\252\265\030\n\n\010\300\215\267\001\302\215\267\001'
|
|
61
|
-
_globals['_APIUSERSERVICE'].methods_by_name['
|
|
62
|
-
_globals['_APIUSERSERVICE'].methods_by_name['
|
|
63
|
-
_globals['_APIUSERSERVICE'].methods_by_name['
|
|
64
|
-
_globals['_APIUSERSERVICE'].methods_by_name['
|
|
61
|
+
_globals['_APIUSERSERVICE'].methods_by_name['AssignRolesToAPIUser']._loaded_options = None
|
|
62
|
+
_globals['_APIUSERSERVICE'].methods_by_name['AssignRolesToAPIUser']._serialized_options = b'\240\265\030\002\252\265\030\n\n\010\300\215\267\001\302\215\267\001'
|
|
63
|
+
_globals['_APIUSERSERVICE'].methods_by_name['RevokeRolesFromAPIUser']._loaded_options = None
|
|
64
|
+
_globals['_APIUSERSERVICE'].methods_by_name['RevokeRolesFromAPIUser']._serialized_options = b'\240\265\030\002\252\265\030\n\n\010\300\215\267\001\302\215\267\001'
|
|
65
65
|
_globals['_APIUSERSERVICE'].methods_by_name['ListApiUsers']._loaded_options = None
|
|
66
66
|
_globals['_APIUSERSERVICE'].methods_by_name['ListApiUsers']._serialized_options = b'\240\265\030\001\252\265\030\022\n\020\300\215\267\001\301\215\267\001\302\215\267\001\303\215\267\001'
|
|
67
67
|
_globals['_APIUSERSERVICE'].methods_by_name['SearchApiUsers']._loaded_options = None
|
|
@@ -78,22 +78,22 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
|
78
78
|
_globals['_GETAPIUSERBYKEYHASHREQUEST']._serialized_end=410
|
|
79
79
|
_globals['_CREATEAPIUSERREQUEST']._serialized_start=412
|
|
80
80
|
_globals['_CREATEAPIUSERREQUEST']._serialized_end=505
|
|
81
|
-
_globals['
|
|
82
|
-
_globals['
|
|
83
|
-
_globals['
|
|
84
|
-
_globals['
|
|
85
|
-
_globals['_LISTAPIUSERSREQUEST']._serialized_start=
|
|
86
|
-
_globals['_LISTAPIUSERSREQUEST']._serialized_end=
|
|
87
|
-
_globals['_LISTAPIUSERSRESPONSE']._serialized_start=
|
|
88
|
-
_globals['_LISTAPIUSERSRESPONSE']._serialized_end=
|
|
89
|
-
_globals['_SEARCHAPIUSERSREQUEST']._serialized_start=
|
|
90
|
-
_globals['_SEARCHAPIUSERSREQUEST']._serialized_end=
|
|
91
|
-
_globals['_SEARCHAPIUSERSRESPONSE']._serialized_start=
|
|
92
|
-
_globals['_SEARCHAPIUSERSRESPONSE']._serialized_end=
|
|
93
|
-
_globals['_ACTIVATEAPIUSERREQUEST']._serialized_start=
|
|
94
|
-
_globals['_ACTIVATEAPIUSERREQUEST']._serialized_end=
|
|
95
|
-
_globals['_DEACTIVATEAPIUSERREQUEST']._serialized_start=
|
|
96
|
-
_globals['_DEACTIVATEAPIUSERREQUEST']._serialized_end=
|
|
97
|
-
_globals['_APIUSERSERVICE']._serialized_start=
|
|
98
|
-
_globals['_APIUSERSERVICE']._serialized_end=
|
|
81
|
+
_globals['_ASSIGNROLESTOAPIUSERREQUEST']._serialized_start=508
|
|
82
|
+
_globals['_ASSIGNROLESTOAPIUSERREQUEST']._serialized_end=734
|
|
83
|
+
_globals['_REVOKEROLESFROMAPIUSERREQUEST']._serialized_start=737
|
|
84
|
+
_globals['_REVOKEROLESFROMAPIUSERREQUEST']._serialized_end=965
|
|
85
|
+
_globals['_LISTAPIUSERSREQUEST']._serialized_start=967
|
|
86
|
+
_globals['_LISTAPIUSERSREQUEST']._serialized_end=988
|
|
87
|
+
_globals['_LISTAPIUSERSRESPONSE']._serialized_start=990
|
|
88
|
+
_globals['_LISTAPIUSERSRESPONSE']._serialized_end=1077
|
|
89
|
+
_globals['_SEARCHAPIUSERSREQUEST']._serialized_start=1079
|
|
90
|
+
_globals['_SEARCHAPIUSERSREQUEST']._serialized_end=1137
|
|
91
|
+
_globals['_SEARCHAPIUSERSRESPONSE']._serialized_start=1139
|
|
92
|
+
_globals['_SEARCHAPIUSERSRESPONSE']._serialized_end=1228
|
|
93
|
+
_globals['_ACTIVATEAPIUSERREQUEST']._serialized_start=1230
|
|
94
|
+
_globals['_ACTIVATEAPIUSERREQUEST']._serialized_end=1339
|
|
95
|
+
_globals['_DEACTIVATEAPIUSERREQUEST']._serialized_start=1341
|
|
96
|
+
_globals['_DEACTIVATEAPIUSERREQUEST']._serialized_end=1452
|
|
97
|
+
_globals['_APIUSERSERVICE']._serialized_start=1455
|
|
98
|
+
_globals['_APIUSERSERVICE']._serialized_end=2685
|
|
99
99
|
# @@protoc_insertion_point(module_scope)
|
|
@@ -28,21 +28,21 @@ class CreateApiUserRequest(_message.Message):
|
|
|
28
28
|
api_user: _api_user_pb2.APIUser
|
|
29
29
|
def __init__(self, api_user: _Optional[_Union[_api_user_pb2.APIUser, _Mapping]] = ...) -> None: ...
|
|
30
30
|
|
|
31
|
-
class
|
|
32
|
-
__slots__ = ("name", "
|
|
31
|
+
class AssignRolesToAPIUserRequest(_message.Message):
|
|
32
|
+
__slots__ = ("name", "roles")
|
|
33
33
|
NAME_FIELD_NUMBER: _ClassVar[int]
|
|
34
|
-
|
|
34
|
+
ROLES_FIELD_NUMBER: _ClassVar[int]
|
|
35
35
|
name: str
|
|
36
|
-
|
|
37
|
-
def __init__(self, name: _Optional[str] = ...,
|
|
36
|
+
roles: _containers.RepeatedScalarFieldContainer[str]
|
|
37
|
+
def __init__(self, name: _Optional[str] = ..., roles: _Optional[_Iterable[str]] = ...) -> None: ...
|
|
38
38
|
|
|
39
|
-
class
|
|
40
|
-
__slots__ = ("name", "
|
|
39
|
+
class RevokeRolesFromAPIUserRequest(_message.Message):
|
|
40
|
+
__slots__ = ("name", "roles")
|
|
41
41
|
NAME_FIELD_NUMBER: _ClassVar[int]
|
|
42
|
-
|
|
42
|
+
ROLES_FIELD_NUMBER: _ClassVar[int]
|
|
43
43
|
name: str
|
|
44
|
-
|
|
45
|
-
def __init__(self, name: _Optional[str] = ...,
|
|
44
|
+
roles: _containers.RepeatedScalarFieldContainer[str]
|
|
45
|
+
def __init__(self, name: _Optional[str] = ..., roles: _Optional[_Iterable[str]] = ...) -> None: ...
|
|
46
46
|
|
|
47
47
|
class ListApiUsersRequest(_message.Message):
|
|
48
48
|
__slots__ = ()
|
|
@@ -37,14 +37,14 @@ class ApiUserServiceStub(object):
|
|
|
37
37
|
request_serializer=meshtrade_dot_iam_dot_api__user_dot_v1_dot_service__pb2.CreateApiUserRequest.SerializeToString,
|
|
38
38
|
response_deserializer=meshtrade_dot_iam_dot_api__user_dot_v1_dot_api__user__pb2.APIUser.FromString,
|
|
39
39
|
_registered_method=True)
|
|
40
|
-
self.
|
|
41
|
-
'/meshtrade.iam.api_user.v1.ApiUserService/
|
|
42
|
-
request_serializer=meshtrade_dot_iam_dot_api__user_dot_v1_dot_service__pb2.
|
|
40
|
+
self.AssignRolesToAPIUser = channel.unary_unary(
|
|
41
|
+
'/meshtrade.iam.api_user.v1.ApiUserService/AssignRolesToAPIUser',
|
|
42
|
+
request_serializer=meshtrade_dot_iam_dot_api__user_dot_v1_dot_service__pb2.AssignRolesToAPIUserRequest.SerializeToString,
|
|
43
43
|
response_deserializer=meshtrade_dot_iam_dot_api__user_dot_v1_dot_api__user__pb2.APIUser.FromString,
|
|
44
44
|
_registered_method=True)
|
|
45
|
-
self.
|
|
46
|
-
'/meshtrade.iam.api_user.v1.ApiUserService/
|
|
47
|
-
request_serializer=meshtrade_dot_iam_dot_api__user_dot_v1_dot_service__pb2.
|
|
45
|
+
self.RevokeRolesFromAPIUser = channel.unary_unary(
|
|
46
|
+
'/meshtrade.iam.api_user.v1.ApiUserService/RevokeRolesFromAPIUser',
|
|
47
|
+
request_serializer=meshtrade_dot_iam_dot_api__user_dot_v1_dot_service__pb2.RevokeRolesFromAPIUserRequest.SerializeToString,
|
|
48
48
|
response_deserializer=meshtrade_dot_iam_dot_api__user_dot_v1_dot_api__user__pb2.APIUser.FromString,
|
|
49
49
|
_registered_method=True)
|
|
50
50
|
self.ListApiUsers = channel.unary_unary(
|
|
@@ -109,9 +109,9 @@ class ApiUserServiceServicer(object):
|
|
|
109
109
|
context.set_details('Method not implemented!')
|
|
110
110
|
raise NotImplementedError('Method not implemented!')
|
|
111
111
|
|
|
112
|
-
def
|
|
112
|
+
def AssignRolesToAPIUser(self, request, context):
|
|
113
113
|
"""
|
|
114
|
-
|
|
114
|
+
Assign roles to an existing api user within the authenticated group context.
|
|
115
115
|
|
|
116
116
|
The role assignment enables the api user to perform operations according
|
|
117
117
|
to the permissions associated with that role within the group hierarchy.
|
|
@@ -120,9 +120,9 @@ class ApiUserServiceServicer(object):
|
|
|
120
120
|
context.set_details('Method not implemented!')
|
|
121
121
|
raise NotImplementedError('Method not implemented!')
|
|
122
122
|
|
|
123
|
-
def
|
|
123
|
+
def RevokeRolesFromAPIUser(self, request, context):
|
|
124
124
|
"""
|
|
125
|
-
|
|
125
|
+
Revoke roles from an existing API user within the authenticated group context.
|
|
126
126
|
|
|
127
127
|
The role revocation removes the permissions associated with that role from
|
|
128
128
|
the API user within the group hierarchy. The API user will no longer be able
|
|
@@ -200,14 +200,14 @@ def add_ApiUserServiceServicer_to_server(servicer, server):
|
|
|
200
200
|
request_deserializer=meshtrade_dot_iam_dot_api__user_dot_v1_dot_service__pb2.CreateApiUserRequest.FromString,
|
|
201
201
|
response_serializer=meshtrade_dot_iam_dot_api__user_dot_v1_dot_api__user__pb2.APIUser.SerializeToString,
|
|
202
202
|
),
|
|
203
|
-
'
|
|
204
|
-
servicer.
|
|
205
|
-
request_deserializer=meshtrade_dot_iam_dot_api__user_dot_v1_dot_service__pb2.
|
|
203
|
+
'AssignRolesToAPIUser': grpc.unary_unary_rpc_method_handler(
|
|
204
|
+
servicer.AssignRolesToAPIUser,
|
|
205
|
+
request_deserializer=meshtrade_dot_iam_dot_api__user_dot_v1_dot_service__pb2.AssignRolesToAPIUserRequest.FromString,
|
|
206
206
|
response_serializer=meshtrade_dot_iam_dot_api__user_dot_v1_dot_api__user__pb2.APIUser.SerializeToString,
|
|
207
207
|
),
|
|
208
|
-
'
|
|
209
|
-
servicer.
|
|
210
|
-
request_deserializer=meshtrade_dot_iam_dot_api__user_dot_v1_dot_service__pb2.
|
|
208
|
+
'RevokeRolesFromAPIUser': grpc.unary_unary_rpc_method_handler(
|
|
209
|
+
servicer.RevokeRolesFromAPIUser,
|
|
210
|
+
request_deserializer=meshtrade_dot_iam_dot_api__user_dot_v1_dot_service__pb2.RevokeRolesFromAPIUserRequest.FromString,
|
|
211
211
|
response_serializer=meshtrade_dot_iam_dot_api__user_dot_v1_dot_api__user__pb2.APIUser.SerializeToString,
|
|
212
212
|
),
|
|
213
213
|
'ListApiUsers': grpc.unary_unary_rpc_method_handler(
|
|
@@ -313,7 +313,7 @@ class ApiUserService(object):
|
|
|
313
313
|
_registered_method=True)
|
|
314
314
|
|
|
315
315
|
@staticmethod
|
|
316
|
-
def
|
|
316
|
+
def AssignRolesToAPIUser(request,
|
|
317
317
|
target,
|
|
318
318
|
options=(),
|
|
319
319
|
channel_credentials=None,
|
|
@@ -326,8 +326,8 @@ class ApiUserService(object):
|
|
|
326
326
|
return grpc.experimental.unary_unary(
|
|
327
327
|
request,
|
|
328
328
|
target,
|
|
329
|
-
'/meshtrade.iam.api_user.v1.ApiUserService/
|
|
330
|
-
meshtrade_dot_iam_dot_api__user_dot_v1_dot_service__pb2.
|
|
329
|
+
'/meshtrade.iam.api_user.v1.ApiUserService/AssignRolesToAPIUser',
|
|
330
|
+
meshtrade_dot_iam_dot_api__user_dot_v1_dot_service__pb2.AssignRolesToAPIUserRequest.SerializeToString,
|
|
331
331
|
meshtrade_dot_iam_dot_api__user_dot_v1_dot_api__user__pb2.APIUser.FromString,
|
|
332
332
|
options,
|
|
333
333
|
channel_credentials,
|
|
@@ -340,7 +340,7 @@ class ApiUserService(object):
|
|
|
340
340
|
_registered_method=True)
|
|
341
341
|
|
|
342
342
|
@staticmethod
|
|
343
|
-
def
|
|
343
|
+
def RevokeRolesFromAPIUser(request,
|
|
344
344
|
target,
|
|
345
345
|
options=(),
|
|
346
346
|
channel_credentials=None,
|
|
@@ -353,8 +353,8 @@ class ApiUserService(object):
|
|
|
353
353
|
return grpc.experimental.unary_unary(
|
|
354
354
|
request,
|
|
355
355
|
target,
|
|
356
|
-
'/meshtrade.iam.api_user.v1.ApiUserService/
|
|
357
|
-
meshtrade_dot_iam_dot_api__user_dot_v1_dot_service__pb2.
|
|
356
|
+
'/meshtrade.iam.api_user.v1.ApiUserService/RevokeRolesFromAPIUser',
|
|
357
|
+
meshtrade_dot_iam_dot_api__user_dot_v1_dot_service__pb2.RevokeRolesFromAPIUserRequest.SerializeToString,
|
|
358
358
|
meshtrade_dot_iam_dot_api__user_dot_v1_dot_api__user__pb2.APIUser.FromString,
|
|
359
359
|
options,
|
|
360
360
|
channel_credentials,
|
|
@@ -29,7 +29,15 @@ from .role_pb2 import Role, RoleList
|
|
|
29
29
|
#
|
|
30
30
|
# ===================================================================
|
|
31
31
|
|
|
32
|
-
from .role import
|
|
32
|
+
from .role import (
|
|
33
|
+
must_parse_role_parts,
|
|
34
|
+
parse_role_parts,
|
|
35
|
+
role_from_full_resource_name,
|
|
36
|
+
role_full_resource_name_from_group,
|
|
37
|
+
role_full_resource_name_from_group_id,
|
|
38
|
+
role_is_valid,
|
|
39
|
+
role_is_valid_and_specified,
|
|
40
|
+
)
|
|
33
41
|
|
|
34
42
|
# ===================================================================
|
|
35
43
|
# MODULE EXPORTS
|
|
@@ -40,5 +48,11 @@ __all__ = [
|
|
|
40
48
|
"Role",
|
|
41
49
|
"RoleList",
|
|
42
50
|
# Manual exports
|
|
51
|
+
"must_parse_role_parts",
|
|
52
|
+
"parse_role_parts",
|
|
53
|
+
"role_from_full_resource_name",
|
|
43
54
|
"role_full_resource_name_from_group",
|
|
55
|
+
"role_full_resource_name_from_group_id",
|
|
56
|
+
"role_is_valid",
|
|
57
|
+
"role_is_valid_and_specified",
|
|
44
58
|
]
|
meshtrade/iam/role/v1/role.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""Role utility functions for Mesh API.
|
|
2
2
|
|
|
3
3
|
This module provides helper functions for working with Role enums and their resource names.
|
|
4
|
-
All functions use the
|
|
4
|
+
All functions use the 4-part integer format: groups/{groupID}/roles/{roleNumber}
|
|
5
5
|
for cross-language compatibility.
|
|
6
6
|
"""
|
|
7
7
|
|
|
@@ -47,7 +47,7 @@ def role_is_valid_and_specified(role: Role) -> bool:
|
|
|
47
47
|
def role_full_resource_name_from_group_id(role: Role, group_id: str) -> str:
|
|
48
48
|
"""Generate full resource name from role and group ID.
|
|
49
49
|
|
|
50
|
-
Format: groups/{group_id}/{role_int}
|
|
50
|
+
Format: groups/{group_id}/roles/{role_int}
|
|
51
51
|
|
|
52
52
|
Args:
|
|
53
53
|
role: Role enum value (integer)
|
|
@@ -58,9 +58,9 @@ def role_full_resource_name_from_group_id(role: Role, group_id: str) -> str:
|
|
|
58
58
|
|
|
59
59
|
Example:
|
|
60
60
|
>>> role_full_resource_name_from_group_id(Role.ROLE_IAM_ADMIN, "01DD32GZ7R0000000000000001")
|
|
61
|
-
'groups/01DD32GZ7R0000000000000001/3000000'
|
|
61
|
+
'groups/01DD32GZ7R0000000000000001/roles/3000000'
|
|
62
62
|
"""
|
|
63
|
-
return f"groups/{group_id}/{int(role)}"
|
|
63
|
+
return f"groups/{group_id}/roles/{int(role)}"
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
def role_full_resource_name_from_group(role: Role, group: str) -> str:
|
|
@@ -78,7 +78,7 @@ def role_full_resource_name_from_group(role: Role, group: str) -> str:
|
|
|
78
78
|
|
|
79
79
|
Example:
|
|
80
80
|
>>> role_full_resource_name_from_group(Role.ROLE_IAM_ADMIN, "groups/01DD32GZ7R0000000000000001")
|
|
81
|
-
'groups/01DD32GZ7R0000000000000001/3000000'
|
|
81
|
+
'groups/01DD32GZ7R0000000000000001/roles/3000000'
|
|
82
82
|
"""
|
|
83
83
|
if not group.startswith("groups/"):
|
|
84
84
|
raise ValueError(f"invalid group format, expected groups/{{groupID}}, got: {group}")
|
|
@@ -94,13 +94,13 @@ def role_from_full_resource_name(full_resource_name: str) -> Role:
|
|
|
94
94
|
"""Extract Role from full resource name.
|
|
95
95
|
|
|
96
96
|
Args:
|
|
97
|
-
full_resource_name: Full resource name (e.g., "groups/{id}/{role_int}")
|
|
97
|
+
full_resource_name: Full resource name (e.g., "groups/{id}/roles/{role_int}")
|
|
98
98
|
|
|
99
99
|
Returns:
|
|
100
100
|
Role enum value (integer), or ROLE_UNSPECIFIED if parsing fails
|
|
101
101
|
|
|
102
102
|
Example:
|
|
103
|
-
>>> role_from_full_resource_name("groups/01DD32GZ7R0000000000000001/3000000")
|
|
103
|
+
>>> role_from_full_resource_name("groups/01DD32GZ7R0000000000000001/roles/3000000")
|
|
104
104
|
3000000
|
|
105
105
|
>>> role_from_full_resource_name("invalid/format")
|
|
106
106
|
0
|
|
@@ -118,7 +118,7 @@ def role_from_full_resource_name(full_resource_name: str) -> Role:
|
|
|
118
118
|
def parse_role_parts(role_full_resource_name: str) -> tuple[str, int]:
|
|
119
119
|
"""Parse full resource name into group ID and Role.
|
|
120
120
|
|
|
121
|
-
Expected format: groups/{group_id}/{role_int}
|
|
121
|
+
Expected format: groups/{group_id}/roles/{role_int}
|
|
122
122
|
|
|
123
123
|
Args:
|
|
124
124
|
role_full_resource_name: Full resource name
|
|
@@ -130,21 +130,21 @@ def parse_role_parts(role_full_resource_name: str) -> tuple[str, int]:
|
|
|
130
130
|
ValueError: If format is invalid or role number cannot be parsed
|
|
131
131
|
|
|
132
132
|
Example:
|
|
133
|
-
>>> parse_role_parts("groups/01DD32GZ7R0000000000000001/3000000")
|
|
133
|
+
>>> parse_role_parts("groups/01DD32GZ7R0000000000000001/roles/3000000")
|
|
134
134
|
('01DD32GZ7R0000000000000001', 3000000)
|
|
135
135
|
"""
|
|
136
136
|
parts = role_full_resource_name.split("/")
|
|
137
|
-
if len(parts) !=
|
|
138
|
-
raise ValueError(f"invalid role format, expected groups/{{groupID}}/{{role}}, got {role_full_resource_name}")
|
|
137
|
+
if len(parts) != 4 or parts[0] != "groups" or parts[2] != "roles":
|
|
138
|
+
raise ValueError(f"invalid role format, expected groups/{{groupID}}/roles/{{role}}, got {role_full_resource_name}")
|
|
139
139
|
|
|
140
140
|
group_id = parts[1]
|
|
141
141
|
if not group_id:
|
|
142
142
|
raise ValueError("group ID cannot be empty")
|
|
143
143
|
|
|
144
144
|
try:
|
|
145
|
-
role_int = int(parts[
|
|
145
|
+
role_int = int(parts[3])
|
|
146
146
|
except ValueError as e:
|
|
147
|
-
raise ValueError(f"error parsing role enum value '{parts[
|
|
147
|
+
raise ValueError(f"error parsing role enum value '{parts[3]}'") from e
|
|
148
148
|
|
|
149
149
|
if role_int < 0:
|
|
150
150
|
raise ValueError(f"invalid role number in full resource name: {role_full_resource_name}")
|
|
@@ -168,7 +168,7 @@ def must_parse_role_parts(role_full_resource_name: str) -> tuple[str, int]:
|
|
|
168
168
|
ValueError: If format is invalid
|
|
169
169
|
|
|
170
170
|
Example:
|
|
171
|
-
>>> must_parse_role_parts("groups/01DD32GZ7R0000000000000001/3000000")
|
|
171
|
+
>>> must_parse_role_parts("groups/01DD32GZ7R0000000000000001/roles/3000000")
|
|
172
172
|
('01DD32GZ7R0000000000000001', 3000000)
|
|
173
173
|
"""
|
|
174
174
|
return parse_role_parts(role_full_resource_name)
|
|
@@ -15,11 +15,12 @@
|
|
|
15
15
|
# Generated protobuf imports
|
|
16
16
|
from .user_pb2 import User
|
|
17
17
|
from .service_pb2 import (
|
|
18
|
-
|
|
18
|
+
AssignRolesToUserRequest,
|
|
19
19
|
CreateUserRequest,
|
|
20
20
|
GetUserRequest,
|
|
21
21
|
ListUsersRequest,
|
|
22
22
|
ListUsersResponse,
|
|
23
|
+
RevokeRolesFromUserRequest,
|
|
23
24
|
SearchUsersRequest,
|
|
24
25
|
SearchUsersResponse,
|
|
25
26
|
UpdateUserRequest,
|
|
@@ -52,11 +53,12 @@ from .service_meshpy import (
|
|
|
52
53
|
# Combined auto-generated and manual exports
|
|
53
54
|
__all__ = [
|
|
54
55
|
# Generated exports
|
|
55
|
-
"
|
|
56
|
+
"AssignRolesToUserRequest",
|
|
56
57
|
"CreateUserRequest",
|
|
57
58
|
"GetUserRequest",
|
|
58
59
|
"ListUsersRequest",
|
|
59
60
|
"ListUsersResponse",
|
|
61
|
+
"RevokeRolesFromUserRequest",
|
|
60
62
|
"SearchUsersRequest",
|
|
61
63
|
"SearchUsersResponse",
|
|
62
64
|
"UpdateUserRequest",
|