@@ -51,7 +51,7 @@ type WorkflowService interface {
5151 GetWorkflowStatus (executorType cdWorkflow.WorkflowExecutorType , name string , namespace string , restConfig * rest.Config ) (* types.WorkflowStatus , error )
5252 // ListAllWorkflows(namespace string) (*v1alpha1.WorkflowList, error)
5353 // UpdateWorkflow(wf *v1alpha1.Workflow) (*v1alpha1.Workflow, error)
54- TerminateWorkflow (executorType cdWorkflow. WorkflowExecutorType , name string , namespace string , restConfig * rest. Config , isExt bool , environment * repository. Environment ) error
54+ TerminateWorkflow (cancelWfDtoRequest * types. CancelWfRequestDto ) error
5555}
5656
5757type WorkflowServiceImpl struct {
@@ -352,24 +352,24 @@ func (impl *WorkflowServiceImpl) GetWorkflowStatus(executorType cdWorkflow.Workf
352352 return wfStatus , err
353353}
354354
355- func (impl * WorkflowServiceImpl ) TerminateWorkflow (executorType cdWorkflow. WorkflowExecutorType , name string , namespace string , restConfig * rest. Config , isExt bool , environment * repository. Environment ) error {
356- impl .Logger .Debugw ("terminating wf" , "name" , name )
355+ func (impl * WorkflowServiceImpl ) TerminateWorkflow (cancelWfDtoRequest * types. CancelWfRequestDto ) error {
356+ impl .Logger .Debugw ("terminating wf" , "name" , cancelWfDtoRequest . Name )
357357 var err error
358- if executorType != "" {
359- workflowExecutor := impl .getWorkflowExecutor (executorType )
358+ if cancelWfDtoRequest . ExecutorType != "" {
359+ workflowExecutor := impl .getWorkflowExecutor (cancelWfDtoRequest . ExecutorType )
360360 if workflowExecutor == nil {
361361 return errors .New ("workflow executor not found" )
362362 }
363- if restConfig == nil {
364- restConfig = impl .config
363+ if cancelWfDtoRequest . RestConfig == nil {
364+ cancelWfDtoRequest . RestConfig = impl .config
365365 }
366- err = workflowExecutor .TerminateWorkflow (name , namespace , restConfig )
366+ err = workflowExecutor .TerminateWorkflow (cancelWfDtoRequest . Name , cancelWfDtoRequest . Namespace , cancelWfDtoRequest . RestConfig )
367367 } else {
368- wfClient , err := impl .getWfClient (environment , namespace , isExt )
368+ wfClient , err := impl .getWfClient (cancelWfDtoRequest . Environment , cancelWfDtoRequest . Namespace , cancelWfDtoRequest . IsExt )
369369 if err != nil {
370370 return err
371371 }
372- err = util .TerminateWorkflow (context .Background (), wfClient , name )
372+ err = util .TerminateWorkflow (context .Background (), wfClient , cancelWfDtoRequest . Name )
373373 }
374374 return err
375375}
0 commit comments