-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathprojects.py
More file actions
31 lines (25 loc) · 874 Bytes
/
projects.py
File metadata and controls
31 lines (25 loc) · 874 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
from fastapi import APIRouter, Query
from feast.api.registry.rest.rest_utils import grpc_call
from feast.protos.feast.registry import RegistryServer_pb2
def get_project_router(grpc_handler) -> APIRouter:
router = APIRouter()
@router.get("/projects/{name}")
def get_project(
name: str,
allow_cache: bool = Query(True),
):
req = RegistryServer_pb2.GetProjectRequest(
name=name,
allow_cache=allow_cache,
)
return grpc_call(grpc_handler.GetProject, req)
@router.get("/projects")
def list_projects(
allow_cache: bool = Query(True),
):
req = RegistryServer_pb2.ListProjectsRequest(
allow_cache=allow_cache,
)
response = grpc_call(grpc_handler.ListProjects, req)
return {"projects": response.get("projects", [])}
return router