github.com/kubeshop/testkube@v1.17.23/cmd/kubectl-testkube/commands/testworkflowtemplates/renderer/testworkflow_obj.go (about)

     1  package renderer
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/kubeshop/testkube/pkg/api/v1/client"
     7  	"github.com/kubeshop/testkube/pkg/api/v1/testkube"
     8  	"github.com/kubeshop/testkube/pkg/ui"
     9  )
    10  
    11  func TestWorkflowTemplateRenderer(client client.Client, ui *ui.UI, obj interface{}) error {
    12  	template, ok := obj.(testkube.TestWorkflowTemplate)
    13  	if !ok {
    14  		return fmt.Errorf("can't use '%T' as testkube.TestWorkflowTemplate in RenderObj for test workflow template", obj)
    15  	}
    16  
    17  	ui.Info("Test Workflow Template:")
    18  	ui.Warn("Name:     ", template.Name)
    19  	ui.Warn("Namespace:", template.Namespace)
    20  	ui.Warn("Created:  ", template.Created.String())
    21  	if template.Description != "" {
    22  		ui.NL()
    23  		ui.Warn("Description: ", template.Description)
    24  	}
    25  	if len(template.Labels) > 0 {
    26  		ui.NL()
    27  		ui.Warn("Labels:   ", testkube.MapToString(template.Labels))
    28  	}
    29  
    30  	return nil
    31  
    32  }