add terminate workflow service

This commit is contained in:
rushtehrani
2020-02-06 14:29:21 -08:00
parent 3c0122582c
commit c66a7f6c50
7 changed files with 355 additions and 66 deletions

View File

@@ -5,6 +5,7 @@ import (
"errors"
"time"
"github.com/golang/protobuf/ptypes/empty"
"github.com/onepanelio/core/api"
"github.com/onepanelio/core/manager"
"github.com/onepanelio/core/model"
@@ -155,6 +156,15 @@ func (s *WorkflowServer) ListWorkflows(ctx context.Context, req *api.ListWorkflo
}, nil
}
func (s *WorkflowServer) TerminateWorkflow(ctx context.Context, req *api.TerminateWorkflowRequest) (*empty.Empty, error) {
err := s.resourceManager.TerminateWorkflow(req.Namespace, req.Name)
if errors.As(err, &userError) {
return nil, userError.GRPCError()
}
return &empty.Empty{}, nil
}
func (s *WorkflowServer) CreateWorkflowTemplate(ctx context.Context, req *api.CreateWorkflowTemplateRequest) (*api.WorkflowTemplate, error) {
workflowTemplate := &model.WorkflowTemplate{
Name: req.WorkflowTemplate.Name,