Merge branch 'main' into avm99963-monorail
GitOrigin-RevId: 1412a00daa7379d93b6872e9ef7da0a45118b180
diff --git a/api/v3/projects_servicer.py b/api/v3/projects_servicer.py
index 17d6f93..9267f1d 100644
--- a/api/v3/projects_servicer.py
+++ b/api/v3/projects_servicer.py
@@ -49,6 +49,29 @@
templates=self.converter.ConvertIssueTemplates(project_id, templates))
@monorail_servicer.PRPCMethod
+ def GetComponentDef(self, mc, request):
+ # type: (MonorailContext, GetComponentDefRequest) ->
+ # ComponentDef
+ """pRPC API method that implements GetComponentDef.
+
+ Raises:
+ InputException if the request.parent is invalid.
+ NoSuchProjectException if the parent project is not found.
+ """
+ project_id, component_id = rnc.IngestComponentDefNames(
+ mc.cnxn, [request.name], self.services)[0]
+
+ with work_env.WorkEnv(mc, self.services) as we:
+ # TODO(crbug/monorail/7614): Eliminate the need to do this lookup.
+ project = we.GetProject(project_id)
+ mc.LookupLoggedInUserPerms(project)
+
+ component_def = we.GetComponentDef(project_id, component_id)
+ api_component_def = self.converter.ConvertComponentDef(component_def)
+
+ return api_component_def
+
+ @monorail_servicer.PRPCMethod
def ListComponentDefs(self, mc, request):
# type: (MonorailContext, ListComponentDefsRequest) ->
# ListComponentDefsResponse