variables

package
v0.40.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Overview

Package variables contains functions for interacting with variables

Package variables contains functions for interacting with variables

Package variables contains functions for interacting with variables

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SetVariableMap

type SetVariableMap map[string]*v1alpha1.SetVariable

SetVariableMap represents a map of variable names to their set values

type TextTemplate

type TextTemplate struct {
	Sensitive  bool
	AutoIndent bool
	Type       v1alpha1.VariableType
	Value      string
}

TextTemplate represents a value to be templated into a text file.

type VariableConfig

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

VariableConfig represents a value to be templated into a text file.

func New

func New(templatePrefix string, prompt func(variable v1alpha1.InteractiveVariable) (value string, err error), logger *slog.Logger) *VariableConfig

New creates a new VariableConfig

func (*VariableConfig) CheckVariablePattern

func (vc *VariableConfig) CheckVariablePattern(name, pattern string) error

CheckVariablePattern checks to see if a current variable is set to a value that matches its pattern

func (*VariableConfig) GetAllTemplates

func (vc *VariableConfig) GetAllTemplates() map[string]*TextTemplate

GetAllTemplates gets all of the current templates stored in the VariableConfig

func (*VariableConfig) GetSetVariable

func (vc *VariableConfig) GetSetVariable(name string) (*v1alpha1.SetVariable, bool)

GetSetVariable gets a variable set within a VariableConfig by its name

func (*VariableConfig) PopulateVariables

func (vc *VariableConfig) PopulateVariables(variables []v1alpha1.InteractiveVariable, presetVariables map[string]string) error

PopulateVariables handles setting the active variables within a VariableConfig's SetVariableMap

func (*VariableConfig) ReplaceTextTemplate

func (vc *VariableConfig) ReplaceTextTemplate(path string) error

ReplaceTextTemplate loads a file from a given path, replaces text in it and writes it back in place.

func (*VariableConfig) SetApplicationTemplates

func (vc *VariableConfig) SetApplicationTemplates(applicationTemplates map[string]*TextTemplate)

SetApplicationTemplates sets the application-specific templates for the variable config (i.e. ZARF_REGISTRY for Zarf)

func (*VariableConfig) SetConstants

func (vc *VariableConfig) SetConstants(constants []v1alpha1.Constant)

SetConstants sets the constants for a variable config (templated as PREFIX_CONST_NAME)

func (*VariableConfig) SetVariable

func (vc *VariableConfig) SetVariable(name, value string, sensitive bool, autoIndent bool, varType v1alpha1.VariableType)

SetVariable sets a variable in a VariableConfig's SetVariableMap

Jump to

Keyboard shortcuts

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