Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 1 | # |
| 2 | # See the pRPC spec here: https://godoc.org/github.com/luci/luci-go/grpc/prpc |
| 3 | # |
| 4 | # Each Servicer corresponds to a service defined in a .proto file in this |
| 5 | # directory. Each method on that Servicer corresponds to one of the rpcs |
| 6 | # defined on the service. |
| 7 | # |
| 8 | # All APIs are served under the /prpc/* path space. Each service gets its own |
| 9 | # namespace under that, and each method is an individual endpoints. For example, |
| 10 | # POST https://bugs.chromium.org/prpc/monorail.v3.Issues/GetIssue |
| 11 | # would be a call to the api.v3.issues_servicer.IssuesServicer.GetIssue method. |
| 12 | # |
| 13 | # Note that this is not a RESTful API, although it is CRUDy. All requests are |
| 14 | # POSTs, all methods take exactly one input, and all methods return exactly |
| 15 | # one output. |
| 16 | # |
| 17 | # TODO(http://crbug.com/monorail/1703): Actually integrate the rpcexplorer. |
| 18 | # You can use the API Explorer here: https://bugs.chromium.org/rpcexplorer |
| 19 | |
| 20 | from __future__ import print_function |
| 21 | from __future__ import division |
| 22 | from __future__ import absolute_import |
| 23 | |
| 24 | from api.v3 import issues_servicer |
| 25 | from api.v3 import hotlists_servicer |
| 26 | from api.v3 import frontend_servicer |
| 27 | from api.v3 import projects_servicer |
| 28 | from api.v3 import permissions_servicer |
| 29 | from api.v3 import users_servicer |
| 30 | |
| 31 | |
| 32 | def RegisterApiHandlers(prpc_server, services): |
| 33 | """Registers pRPC API services. And makes their routes |
| 34 | available in prpc_server.get_routes(). |
| 35 | """ |
| 36 | |
| 37 | prpc_server.add_service(issues_servicer.IssuesServicer(services)) |
| 38 | prpc_server.add_service(hotlists_servicer.HotlistsServicer(services)) |
| 39 | prpc_server.add_service(projects_servicer.ProjectsServicer(services)) |
| 40 | prpc_server.add_service(permissions_servicer.PermissionsServicer(services)) |
| 41 | prpc_server.add_service(users_servicer.UsersServicer(services)) |
| 42 | prpc_server.add_service(frontend_servicer.FrontendServicer(services)) |