mirror of
https://github.com/onepanelio/onepanel.git
synced 2025-10-06 22:22:45 +08:00
add terminate workflow service
This commit is contained in:
@@ -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,
|
||||
|
Reference in New Issue
Block a user