config

package
v0.17.9 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveWhenConstraint added in v0.17.0

type ActiveWhenConstraint struct {
	VariableName string            `yaml:"variableName"`
	Value        string            `yaml:"value"`
	Condition    VariableCondition `yaml:"condition"`
}

ActiveWhenConstraints holds information on when a variable is actively used by a template based off other variable values

func (ActiveWhenConstraint) DeepCopy added in v0.17.0

type BuilderVar

type BuilderVar struct {
	Name                  string                 `yaml:"name"`
	ActiveWhenConstraints []ActiveWhenConstraint `yaml:"activeWhen"`
	Default               BuilderVarDefault      `yaml:"default"`
	Description           string                 `yaml:"description"`
	ExampleValues         []string               `yaml:"exampleValues"`
	AllowedValues         []string               `yaml:"allowedValues"`
	Type                  string                 `yaml:"type"`
	Kind                  string                 `yaml:"kind"`
	Value                 string                 `yaml:"value"`
	Versions              string                 `yaml:"versions"`
}

func (*BuilderVar) DeepCopy added in v0.0.39

func (bv *BuilderVar) DeepCopy() *BuilderVar

type BuilderVarDefault added in v0.0.23

type BuilderVarDefault struct {
	IsPromptDisabled bool   `yaml:"disablePrompt"`
	ReferenceVar     string `yaml:"referenceVar"`
	Value            string `yaml:"value"`
}

BuilderVarDefault holds info on the default value of a variable

type DraftConfig

type DraftConfig struct {
	TemplateName        string                         `yaml:"templateName"`
	DisplayName         string                         `yaml:"displayName"`
	Description         string                         `yaml:"description"`
	Type                string                         `yaml:"type"`
	Versions            []string                       `yaml:"versions"`
	DefaultVersion      string                         `yaml:"defaultVersion"`
	Variables           []*BuilderVar                  `yaml:"variables"`
	FileNameOverrideMap map[string]string              `yaml:"filenameOverrideMap"`
	Validators          map[string]VariableValidator   `yaml:"validators"`
	Transformers        map[string]VariableTransformer `yaml:"transformers"`
}

func NewConfigFromFS added in v0.0.39

func NewConfigFromFS(fileSys fs.FS, path string) (*DraftConfig, error)

func (*DraftConfig) ApplyDefaultVariables added in v0.0.34

func (d *DraftConfig) ApplyDefaultVariables() error

ApplyDefaultVariables will apply the defaults to variables that are not already set

func (*DraftConfig) ApplyDefaultVariablesForVersion added in v0.0.39

func (d *DraftConfig) ApplyDefaultVariablesForVersion(version string) error

ApplyDefaultVariablesForVersion will apply the defaults to variables that are not already set for a specific template version

func (*DraftConfig) CheckActiveWhenConstraint added in v0.17.0

func (d *DraftConfig) CheckActiveWhenConstraint(variable *BuilderVar) (bool, error)

func (*DraftConfig) DeepCopy added in v0.0.39

func (d *DraftConfig) DeepCopy() *DraftConfig

func (*DraftConfig) GetVariable added in v0.0.36

func (d *DraftConfig) GetVariable(name string) (*BuilderVar, error)

func (*DraftConfig) GetVariableExampleValues added in v0.0.27

func (d *DraftConfig) GetVariableExampleValues() map[string][]string

func (*DraftConfig) GetVariableMap added in v0.0.37

func (d *DraftConfig) GetVariableMap() map[string]string

Returns a map of variable names to values used in Gotemplate

func (*DraftConfig) GetVariableTransformer added in v0.17.0

func (d *DraftConfig) GetVariableTransformer(kind string) VariableTransformer

GetVariableTransformer returns the transformer for a specific variable kind

func (*DraftConfig) GetVariableValidator added in v0.17.0

func (d *DraftConfig) GetVariableValidator(kind string) VariableValidator

GetVariableValidator returns the validator for a specific variable kind

func (*DraftConfig) GetVariableValue added in v0.0.39

func (d *DraftConfig) GetVariableValue(name string) (any, error)

func (*DraftConfig) SetFileNameOverride added in v0.0.39

func (d *DraftConfig) SetFileNameOverride(input, override string)

SetFileNameOverride sets the filename override for a specific file

func (*DraftConfig) SetVariable added in v0.0.36

func (d *DraftConfig) SetVariable(name, value string)

func (*DraftConfig) SetVariableTransformer added in v0.17.0

func (d *DraftConfig) SetVariableTransformer(kind string, transformer VariableTransformer)

SetVariableTransformer sets the transformer for a specific variable kind

func (*DraftConfig) SetVariableValidator added in v0.17.0

func (d *DraftConfig) SetVariableValidator(kind string, validator VariableValidator)

SetVariableValidator sets the validator for a specific variable kind

func (*DraftConfig) VariableMapToDraftConfig added in v0.0.36

func (d *DraftConfig) VariableMapToDraftConfig(flagVariablesMap map[string]string)

handles flags that are meant to represent template variables

type TemplateVariableRecorder added in v0.0.27

type TemplateVariableRecorder interface {
	Record(key, value string)
}

TemplateVariableRecorder is an interface for recording variables that are read using draft configs

type VariableCondition added in v0.17.0

type VariableCondition string
const (
	EqualTo    VariableCondition = "equals"
	NotEqualTo VariableCondition = "notequals"
)

func (VariableCondition) String added in v0.17.0

func (v VariableCondition) String() string

type VariableTransformer added in v0.17.0

type VariableTransformer func(string) (any, error)

type VariableValidator added in v0.17.0

type VariableValidator func(string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳