convert

package
v0.112.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 13 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(text string, data interface{}) (bool, error)

func Error

func Error(name string, err error) error

Error will wrap a template error in an ExecError causing template.Execute to recover.

func Execute

func Execute(text string, data interface{}) (string, error)

func IsFuncError

func IsFuncError(err error) bool

func Panic

func Panic(name string, err error) error

Panic will panic with a recoverable error.

func RegisterFunc

func RegisterFunc(key string, fn interface{})

func String

func String(text string, data interface{}) (string, error)

func ValidateOutputPath added in v0.29.0

func ValidateOutputPath(outputPath string) (string, error)

ValidateOutputPath takes an output file path and returns it as an absolute path. It returns an error if the absolute path cannot be determined or if the parent directory does not exist.

Types

type FuncError

type FuncError struct {
	Name string // Name of function.
	Err  error  // Pre-formatted error.
}

func (FuncError) Error

func (e FuncError) Error() string

type Insight

type Insight struct {
	Meta `json:",inline" yaml:",inline" hcl:",inline"`

	Primary  string   `json:"primary" yaml:"primary" hcl:"primary"`
	Detail   string   `json:"detail" yaml:"detail" hcl:"detail"`
	Severity Severity `json:"severity,omitempty" yaml:"severity,omitempty" hcl:"severity,omitempty"`
}

func (*Insight) Render

func (m *Insight) Render(data interface{}) (*Insight, error)

type Meta

type Meta struct {
	Name   string            `json:"name,omitempty" yaml:"name,omitempty" hcl:"name,omitempty"`
	Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty" hcl:"labels,omitempty"`
}

type Result

type Result struct {
	Meta `json:",inline" yaml:",inline" hcl:",inline"`

	Insight        *Insight                `json:"insight" yaml:"insight" hcl:"insight"`
	Severity       Severity                `json:"severity" yaml:"severity" hcl:"severity"`
	AnalyzerSpec   string                  `json:"analyzerSpec" yaml:"analyzerSpec" hcl:"analyzerSpec"`
	Variables      map[string]interface{}  `json:"variables,omitempty" yaml:"variables,omitempty" hcl:"variables,omitempty"`
	Error          string                  `json:"error,omitempty" yaml:"error,omitempty" hcl:"error,omitempty"`
	InvolvedObject *corev1.ObjectReference `json:"involvedObject,omitempty" yaml:"involvedObject,omitempty" hcl:"involvedObject,omitempty"`
}

func FromAnalyzerResult

func FromAnalyzerResult(input []*analyze.AnalyzeResult) []*Result

type Severity

type Severity string
const (
	SeverityError Severity = "error"
	SeverityWarn  Severity = "warn"
	SeverityInfo  Severity = "info"
	SeverityDebug Severity = "debug"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL