forked from feast-dev/feast
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpermissions.py
More file actions
34 lines (28 loc) · 977 Bytes
/
Copy pathpermissions.py
File metadata and controls
34 lines (28 loc) · 977 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from fastapi import APIRouter, Query
from feast.api.registry.rest.rest_utils import grpc_call
from feast.registry_server import RegistryServer_pb2
def get_permission_router(grpc_handler) -> APIRouter:
router = APIRouter()
@router.get("/permissions/{name}")
def get_permission(
name: str,
project: str = Query(...),
allow_cache: bool = Query(True),
):
req = RegistryServer_pb2.GetPermissionRequest(
name=name,
project=project,
allow_cache=allow_cache,
)
return {"permission": grpc_call(grpc_handler.GetPermission, req)}
@router.get("/permissions")
def list_permissions(
project: str = Query(...),
allow_cache: bool = Query(True),
):
req = RegistryServer_pb2.ListPermissionsRequest(
project=project,
allow_cache=allow_cache,
)
return grpc_call(grpc_handler.ListPermissions, req)
return router