add ListWorkflowTemplateVersions

This commit is contained in:
rushtehrani
2019-12-12 17:54:45 -08:00
parent 87c9d20f4d
commit b0f150a49b
9 changed files with 409 additions and 41 deletions

View File

@@ -73,3 +73,25 @@ func (s *WorkflowServer) GetWorkflowTemplate(ctx context.Context, req *api.GetWo
Manifest: workflowTemplate.Manifest,
}, nil
}
func (s *WorkflowServer) ListWorkflowTemplateVersions(ctx context.Context, req *api.ListWorkflowTemplateVersionsRequest) (*api.ListWorkflowTemplateVersionsResponse, error) {
workflowTemplateVersions, err := s.resourceManager.ListWorkflowTemplateVersions(req.Namespace, req.Uid)
if errors.As(err, &userError) {
return nil, userError.GRPCError()
}
workflowTemplates := []*api.WorkflowTemplate{}
for _, wtv := range workflowTemplateVersions {
workflowTemplates = append(workflowTemplates, &api.WorkflowTemplate{
Uid: wtv.UID,
Name: wtv.Name,
Version: wtv.Version.String(),
Manifest: wtv.Manifest,
})
}
return &api.ListWorkflowTemplateVersionsResponse{
Count: int32(len(workflowTemplateVersions)),
WorkflowTemplates: workflowTemplates,
}, nil
}