filters

package
v0.54.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CustomRulesFilterName = "custom-rules"
	CustomTagName         = "custom"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Instance

type Instance struct {
	Template string                 `yaml:"template" validate:"required"`
	Params   map[string]interface{} `yaml:"params,omitempty"`
	TestMode bool                   `yaml:"test_mode,omitempty"`
}

func (*Instance) Render

func (i *Instance) Render(out io.Writer, repo repository) error

type List

type List struct {
	Title     string      `yaml:"title" validate:"required"`
	Instances []*Instance `yaml:"instances" validate:"dive,required"`
	TestMode  bool        `yaml:"test_mode,omitempty"`
}

func (*List) Render

func (l *List) Render(out io.Writer, logger logger, repo repository) error

func (*List) Validate

func (l *List) Validate() error

type ParamType

type ParamType string
const (
	BooleanParam    ParamType = "checkbox"
	StringParam     ParamType = "string"
	StringListParam ParamType = "list"
	MultiLineParam  ParamType = "multiline"
)

type Parameter added in v0.29.0

type Parameter struct {
	Name        string      `validate:"required"`
	Description string      `validate:"required"`
	Link        string      `validate:"omitempty,url" yaml:",omitempty"`
	Type        ParamType   `validate:"required,oneof=checkbox string list multiline"`
	OnlyIf      string      `validate:"omitempty,valid_only_if" yaml:",omitempty"`
	Default     interface{} `validate:"valid_default"`
	Rules       string      `validate:"omitempty,raw_rules_allowed" yaml:",omitempty"`
	Presets     []Preset    `validate:"omitempty,preset_allowed,dive" yaml:",omitempty"`
}

func (*Parameter) BuildPresetParamName added in v0.29.0

func (p *Parameter) BuildPresetParamName(preset string) string

type Preset

type Preset struct {
	Name        string   `validate:"required"`
	Description string   `validate:"required"`
	Source      string   `validate:"omitempty,url" yaml:",omitempty"`
	License     string   `validate:"required_with=Source" yaml:",omitempty"`
	Values      []string `validate:"required_without=Source"`
	Default     bool     `yaml:",omitempty"`
}

type Repository

type Repository struct {
	// contains filtered or unexported fields
}

Repository holds parsed Templates ready for use

func Load added in v0.29.0

func Load(templates, presets fs.FS) (*Repository, error)

Load parses template definitions from the given filesystem

func (*Repository) Get added in v0.29.0

func (r *Repository) Get(name string) (*Template, error)

func (*Repository) GetAll added in v0.29.0

func (r *Repository) GetAll() []*Template

func (*Repository) GetTags

func (r *Repository) GetTags() []string

func (*Repository) Has added in v0.31.0

func (r *Repository) Has(name string) bool

func (*Repository) Render

func (r *Repository) Render(w io.Writer, instance *Instance) error

type Template added in v0.29.0

type Template struct {
	Name         string      `validate:"required" yaml:"-"`
	Title        string      `validate:"required"`
	Params       []Parameter `validate:"dive" yaml:",omitempty"`
	Tags         []string    `validate:"dive,alphaunicode" yaml:",omitempty"`
	Template     string      `validate:"required_without=rawRules,excluded_with=rawRules"`
	Tests        []testCase
	Description  string `validate:"required" yaml:"-"`
	Contributors []string
	Sponsors     []string
	// contains filtered or unexported fields
}

func (*Template) HasTag added in v0.29.0

func (f *Template) HasTag(tag string) bool

type TestModeTransformer added in v0.21.0

type TestModeTransformer struct {
	// contains filtered or unexported fields
}

func NewTestModeTransformer added in v0.21.0

func NewTestModeTransformer(out io.Writer) *TestModeTransformer

func (*TestModeTransformer) Write added in v0.21.0

func (t *TestModeTransformer) Write(p []byte) (int, error)

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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