github.com/kubeshop/testkube@v1.17.23/pkg/tcl/cloudtcl/data/testworkflow/commands.go (about)

     1  // Copyright 2024 Testkube.
     2  //
     3  // Licensed as a Testkube Pro file under the Testkube Community
     4  // License (the "License"); you may not use this file except in compliance with
     5  // the License. You may obtain a copy of the License at
     6  //
     7  //	https://github.com/kubeshop/testkube/blob/main/licenses/TCL.txt
     8  
     9  package testworkflow
    10  
    11  import "github.com/kubeshop/testkube/pkg/cloud/data/executor"
    12  
    13  const (
    14  	CmdTestWorkflowExecutionGet                  executor.Command = "workflow_execution_get"
    15  	CmdTestWorkflowExecutionGetByNameAndWorkflow executor.Command = "workflow_execution_get_by_name_and_workflow"
    16  	CmdTestWorkflowExecutionGetLatestByWorkflow  executor.Command = "workflow_execution_get_latest_by_workflow"
    17  	CmdTestWorkflowExecutionGetRunning           executor.Command = "workflow_execution_get_running"
    18  	CmdTestWorkflowExecutionGetLatestByWorkflows executor.Command = "workflow_execution_get_latest_by_workflows"
    19  	CmdTestWorkflowExecutionGetExecutionTotals   executor.Command = "workflow_execution_get_execution_totals"
    20  	CmdTestWorkflowExecutionGetExecutions        executor.Command = "workflow_execution_get_executions"
    21  	CmdTestWorkflowExecutionGetExecutionsSummary executor.Command = "workflow_execution_get_executions_summary"
    22  	CmdTestWorkflowExecutionInsert               executor.Command = "workflow_execution_insert"
    23  	CmdTestWorkflowExecutionUpdate               executor.Command = "workflow_execution_update"
    24  	CmdTestWorkflowExecutionUpdateResult         executor.Command = "workflow_execution_update_result"
    25  	CmdTestWorkflowExecutionUpdateOutput         executor.Command = "workflow_execution_update_output"
    26  	CmdTestWorkflowExecutionDeleteByWorkflow     executor.Command = "workflow_execution_delete_by_workflow"
    27  	CmdTestWorkflowExecutionDeleteAll            executor.Command = "workflow_execution_delete_all"
    28  	CmdTestWorkflowExecutionDeleteByWorkflows    executor.Command = "workflow_execution_delete_by_workflows"
    29  	CmdTestWorkflowExecutionGetWorkflowMetrics   executor.Command = "workflow_execution_get_workflow_metrics"
    30  
    31  	CmdTestWorkflowOutputPresignSaveLog executor.Command = "workflow_output_presign_save_log"
    32  	CmdTestWorkflowOutputPresignReadLog executor.Command = "workflow_output_presign_read_log"
    33  	CmdTestWorkflowOutputHasLog         executor.Command = "workflow_output_has_log"
    34  )
    35  
    36  func command(v interface{}) executor.Command {
    37  	switch v.(type) {
    38  	case ExecutionGetRequest:
    39  		return CmdTestWorkflowExecutionGet
    40  	case ExecutionGetByNameAndWorkflowRequest:
    41  		return CmdTestWorkflowExecutionGetByNameAndWorkflow
    42  	case ExecutionGetLatestByWorkflowRequest:
    43  		return CmdTestWorkflowExecutionGetLatestByWorkflow
    44  	case ExecutionGetRunningRequest:
    45  		return CmdTestWorkflowExecutionGetRunning
    46  	case ExecutionGetLatestByWorkflowsRequest:
    47  		return CmdTestWorkflowExecutionGetLatestByWorkflows
    48  	case ExecutionGetExecutionTotalsRequest:
    49  		return CmdTestWorkflowExecutionGetExecutionTotals
    50  	case ExecutionGetExecutionsRequest:
    51  		return CmdTestWorkflowExecutionGetExecutions
    52  	case ExecutionGetExecutionsSummaryRequest:
    53  		return CmdTestWorkflowExecutionGetExecutionsSummary
    54  	case ExecutionInsertRequest:
    55  		return CmdTestWorkflowExecutionInsert
    56  	case ExecutionUpdateRequest:
    57  		return CmdTestWorkflowExecutionUpdate
    58  	case ExecutionUpdateResultRequest:
    59  		return CmdTestWorkflowExecutionUpdateResult
    60  	case ExecutionUpdateOutputRequest:
    61  		return CmdTestWorkflowExecutionUpdateOutput
    62  	case ExecutionDeleteByWorkflowRequest:
    63  		return CmdTestWorkflowExecutionDeleteByWorkflow
    64  	case ExecutionDeleteAllRequest:
    65  		return CmdTestWorkflowExecutionDeleteAll
    66  	case ExecutionDeleteByWorkflowsRequest:
    67  		return CmdTestWorkflowExecutionDeleteByWorkflows
    68  	case ExecutionGetWorkflowMetricsRequest:
    69  		return CmdTestWorkflowExecutionGetWorkflowMetrics
    70  
    71  	case OutputPresignSaveLogRequest:
    72  		return CmdTestWorkflowOutputPresignSaveLog
    73  	case OutputPresignReadLogRequest:
    74  		return CmdTestWorkflowOutputPresignReadLog
    75  	case OutputHasLogRequest:
    76  		return CmdTestWorkflowOutputHasLog
    77  	}
    78  	panic("unknown test workflows Cloud request")
    79  }