Skip to content

Commit 2643149

Browse files
author
Toni Reina
authored
Add Permission message to iam/v1/iam.proto (#183)
- Add Permission message to represent a permission in the system, which has a value and a category. - Update methods to use this new message instead of using a simple string to represent the permission value.
1 parent 88c934c commit 2643149

7 files changed

Lines changed: 325 additions & 188 deletions

File tree

gen/go/qdrant/cloud/iam/v1/iam.pb.go

Lines changed: 156 additions & 93 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gen/openapiv2/qdrant/cloud/iam/v1/iam.swagger.json

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,8 @@
644644
"permissions": {
645645
"type": "array",
646646
"items": {
647-
"type": "string"
647+
"type": "object",
648+
"$ref": "#/definitions/v1Permission"
648649
},
649650
"description": "The permissions associated with this role."
650651
},
@@ -690,7 +691,8 @@
690691
"permissions": {
691692
"type": "array",
692693
"items": {
693-
"type": "string"
694+
"type": "object",
695+
"$ref": "#/definitions/v1Permission"
694696
},
695697
"description": "The permissions associated with this role."
696698
},
@@ -834,7 +836,8 @@
834836
"permissions": {
835837
"type": "array",
836838
"items": {
837-
"type": "string"
839+
"type": "object",
840+
"$ref": "#/definitions/v1Permission"
838841
},
839842
"description": "The effective permissions."
840843
}
@@ -847,9 +850,10 @@
847850
"permissions": {
848851
"type": "array",
849852
"items": {
850-
"type": "string"
853+
"type": "object",
854+
"$ref": "#/definitions/v1Permission"
851855
},
852-
"description": "The permissions know by the system."
856+
"description": "The permissions known by the system."
853857
}
854858
},
855859
"title": "ListPermissionsResponse is the response from the ListPermissions function"
@@ -915,6 +919,20 @@
915919
"description": "Empty",
916920
"title": "LogoutUserResponse is the response from the Logout function"
917921
},
922+
"v1Permission": {
923+
"type": "object",
924+
"properties": {
925+
"value": {
926+
"type": "string",
927+
"description": "The permission value (e.g., \"read:clusters\")."
928+
},
929+
"category": {
930+
"type": "string",
931+
"description": "The category of the permission (e.g., \"Cluster\", \"Account\")."
932+
}
933+
},
934+
"description": "A Permission represents a permission in the Qdrant cloud."
935+
},
918936
"v1RecordUserConsentRequest": {
919937
"type": "object",
920938
"properties": {
@@ -969,7 +987,8 @@
969987
"permissions": {
970988
"type": "array",
971989
"items": {
972-
"type": "string"
990+
"type": "object",
991+
"$ref": "#/definitions/v1Permission"
973992
},
974993
"description": "The permissions associated with this role."
975994
},

gen/python/qdrant/cloud/iam/v1/iam_pb2.py

Lines changed: 69 additions & 63 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gen/python/qdrant/cloud/iam/v1/iam_pb2.pyi

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ class ListPermissionsRequest(_message.Message):
134134
class ListPermissionsResponse(_message.Message):
135135
__slots__ = ("permissions",)
136136
PERMISSIONS_FIELD_NUMBER: _ClassVar[int]
137-
permissions: _containers.RepeatedScalarFieldContainer[str]
138-
def __init__(self, permissions: _Optional[_Iterable[str]] = ...) -> None: ...
137+
permissions: _containers.RepeatedCompositeFieldContainer[Permission]
138+
def __init__(self, permissions: _Optional[_Iterable[_Union[Permission, _Mapping]]] = ...) -> None: ...
139139

140140
class ListRolesRequest(_message.Message):
141141
__slots__ = ("account_id",)
@@ -208,8 +208,8 @@ class ListEffectivePermissionsRequest(_message.Message):
208208
class ListEffectivePermissionsResponse(_message.Message):
209209
__slots__ = ("permissions",)
210210
PERMISSIONS_FIELD_NUMBER: _ClassVar[int]
211-
permissions: _containers.RepeatedScalarFieldContainer[str]
212-
def __init__(self, permissions: _Optional[_Iterable[str]] = ...) -> None: ...
211+
permissions: _containers.RepeatedCompositeFieldContainer[Permission]
212+
def __init__(self, permissions: _Optional[_Iterable[_Union[Permission, _Mapping]]] = ...) -> None: ...
213213

214214
class ListUserRolesRequest(_message.Message):
215215
__slots__ = ("account_id", "user_id")
@@ -271,6 +271,14 @@ class User(_message.Message):
271271
default_account_id: str
272272
def __init__(self, id: _Optional[str] = ..., created_at: _Optional[_Union[datetime.datetime, _timestamp_pb2.Timestamp, _Mapping]] = ..., last_modified_at: _Optional[_Union[datetime.datetime, _timestamp_pb2.Timestamp, _Mapping]] = ..., email: _Optional[str] = ..., status: _Optional[_Union[UserStatus, str]] = ..., default_account_id: _Optional[str] = ...) -> None: ...
273273

274+
class Permission(_message.Message):
275+
__slots__ = ("value", "category")
276+
VALUE_FIELD_NUMBER: _ClassVar[int]
277+
CATEGORY_FIELD_NUMBER: _ClassVar[int]
278+
value: str
279+
category: str
280+
def __init__(self, value: _Optional[str] = ..., category: _Optional[str] = ...) -> None: ...
281+
274282
class Role(_message.Message):
275283
__slots__ = ("id", "created_at", "last_modified_at", "account_id", "name", "description", "role_type", "permissions", "sub_type")
276284
ID_FIELD_NUMBER: _ClassVar[int]
@@ -289,9 +297,9 @@ class Role(_message.Message):
289297
name: str
290298
description: str
291299
role_type: RoleType
292-
permissions: _containers.RepeatedScalarFieldContainer[str]
300+
permissions: _containers.RepeatedCompositeFieldContainer[Permission]
293301
sub_type: SystemRoleSubType
294-
def __init__(self, id: _Optional[str] = ..., created_at: _Optional[_Union[datetime.datetime, _timestamp_pb2.Timestamp, _Mapping]] = ..., last_modified_at: _Optional[_Union[datetime.datetime, _timestamp_pb2.Timestamp, _Mapping]] = ..., account_id: _Optional[str] = ..., name: _Optional[str] = ..., description: _Optional[str] = ..., role_type: _Optional[_Union[RoleType, str]] = ..., permissions: _Optional[_Iterable[str]] = ..., sub_type: _Optional[_Union[SystemRoleSubType, str]] = ...) -> None: ...
302+
def __init__(self, id: _Optional[str] = ..., created_at: _Optional[_Union[datetime.datetime, _timestamp_pb2.Timestamp, _Mapping]] = ..., last_modified_at: _Optional[_Union[datetime.datetime, _timestamp_pb2.Timestamp, _Mapping]] = ..., account_id: _Optional[str] = ..., name: _Optional[str] = ..., description: _Optional[str] = ..., role_type: _Optional[_Union[RoleType, str]] = ..., permissions: _Optional[_Iterable[_Union[Permission, _Mapping]]] = ..., sub_type: _Optional[_Union[SystemRoleSubType, str]] = ...) -> None: ...
295303

296304
class LogoutUserRequest(_message.Message):
297305
__slots__ = ()

gen/typescript/qdrant/cloud/iam/v1/iam_pb.d.ts

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -312,11 +312,11 @@ export declare const ListPermissionsRequestSchema: GenMessage<ListPermissionsReq
312312
*/
313313
export declare type ListPermissionsResponse = Message<"qdrant.cloud.iam.v1.ListPermissionsResponse"> & {
314314
/**
315-
* The permissions know by the system.
315+
* The permissions known by the system.
316316
*
317-
* @generated from field: repeated string permissions = 1;
317+
* @generated from field: repeated qdrant.cloud.iam.v1.Permission permissions = 1;
318318
*/
319-
permissions: string[];
319+
permissions: Permission[];
320320
};
321321

322322
export declare type ListPermissionsResponseValid = ListPermissionsResponse;
@@ -654,9 +654,9 @@ export declare type ListEffectivePermissionsResponse = Message<"qdrant.cloud.iam
654654
/**
655655
* The effective permissions.
656656
*
657-
* @generated from field: repeated string permissions = 1;
657+
* @generated from field: repeated qdrant.cloud.iam.v1.Permission permissions = 1;
658658
*/
659-
permissions: string[];
659+
permissions: Permission[];
660660
};
661661

662662
export declare type ListEffectivePermissionsResponseValid = ListEffectivePermissionsResponse;
@@ -905,6 +905,35 @@ export declare type UserValid = User;
905905
*/
906906
export declare const UserSchema: GenMessage<User, {validType: UserValid}>;
907907

908+
/**
909+
* A Permission represents a permission in the Qdrant cloud.
910+
*
911+
* @generated from message qdrant.cloud.iam.v1.Permission
912+
*/
913+
export declare type Permission = Message<"qdrant.cloud.iam.v1.Permission"> & {
914+
/**
915+
* The permission value (e.g., "read:clusters").
916+
*
917+
* @generated from field: string value = 1;
918+
*/
919+
value: string;
920+
921+
/**
922+
* The category of the permission (e.g., "Cluster", "Account").
923+
*
924+
* @generated from field: string category = 2;
925+
*/
926+
category: string;
927+
};
928+
929+
export declare type PermissionValid = Permission;
930+
931+
/**
932+
* Describes the message qdrant.cloud.iam.v1.Permission.
933+
* Use `create(PermissionSchema)` to create a new message.
934+
*/
935+
export declare const PermissionSchema: GenMessage<Permission, {validType: PermissionValid}>;
936+
908937
/**
909938
* A Role represents a role in the Qdrant cloud.
910939
*
@@ -968,9 +997,9 @@ export declare type Role = Message<"qdrant.cloud.iam.v1.Role"> & {
968997
/**
969998
* The permissions associated with this role.
970999
*
971-
* @generated from field: repeated string permissions = 8;
1000+
* @generated from field: repeated qdrant.cloud.iam.v1.Permission permissions = 8;
9721001
*/
973-
permissions: string[];
1002+
permissions: Permission[];
9741003

9751004
/**
9761005
* The sub-type of the system role.

0 commit comments

Comments
 (0)