Documentation ¶
Index ¶
- Constants
- Variables
- func CalculateChecksumOfDirectory(dir string) (string, error)
- func CalculateChecksumOfFile(path string) (string, error)
- func CalculateChecksumOfPaths(pathes ...string) (string, error)
- func CalculateStringsChecksum(stringArr ...string) string
- func Dump(values Values, dumper ValuesDumper) error
- func DumpValuesJson(values Values) ([]byte, error)
- func DumpValuesYaml(values Values) ([]byte, error)
- func FilesFromRoot(root string, filterFn func(dir string, name string, info os.FileInfo) bool) (files map[string]map[string]string, err error)
- func FindExecutableFilesInPath(dir string) (executables []string, nonExecutables []string, err error)
- func ListFullyIn(arr []string, ref []string) bool
- func ListIntersection(arrs ...[]string) (result []string)
- func ListSubtract(src []string, ignored ...[]string) (result []string)
- func ModuleNameFromValuesKey(moduleValuesKey string) string
- func ModuleNameToValuesKey(moduleName string) string
- func MustDump(data []byte, err error) []byte
- func SortByReference(in []string, ref []string) []string
- func SortReverse(in []string) []string
- func SortReverseByReference(in []string, ref []string) []string
- func SymlinkInfo(path string, info os.FileInfo) (target string, isDir bool, err error)
- func ValuesToString(values Values) string
- func WalkSymlinks(target string, linkName string, files map[string]map[string]string, ...) (symlinkedDirectories map[string]string, err error)
- type ModuleConfig
- func (mc *ModuleConfig) Checksum() string
- func (mc *ModuleConfig) FromKeyYamls(configData map[string]string) (*ModuleConfig, error)
- func (mc *ModuleConfig) FromYaml(yamlString []byte) (*ModuleConfig, error)
- func (mc *ModuleConfig) LoadValues(values map[interface{}]interface{}) (*ModuleConfig, error)
- func (mc ModuleConfig) String() string
- func (mc *ModuleConfig) WithEnabled(v bool) *ModuleConfig
- func (mc *ModuleConfig) WithUpdated(v bool) *ModuleConfig
- func (mc *ModuleConfig) WithValues(values Values) *ModuleConfig
- type Values
- func ApplyJsonPatchToValues(values Values, patch jsonpatch.Patch) (Values, error)
- func ApplyValuesPatch(values Values, valuesPatch ValuesPatch) (Values, bool, error)
- func FormatValues(someValues map[interface{}]interface{}) (Values, error)
- func Load(key string, loader ValuesLoader) (Values, error)
- func LoadAll(loader ValuesLoader) (Values, error)
- func MergeValues(values ...Values) Values
- func NewValues(data map[interface{}]interface{}) (Values, error)
- func NewValuesFromBytes(data []byte) (Values, error)
- type ValuesDumper
- type ValuesDumperToJsonFile
- type ValuesLoader
- type ValuesLoaderFromJsonFile
- type ValuesPatch
- func AppendValuesPatch(valuesPatches []ValuesPatch, newValuesPatch ValuesPatch) []ValuesPatch
- func CompactValuesPatches(valuesPatches []ValuesPatch, newValuesPatch ValuesPatch) []ValuesPatch
- func MustValuesPatch(res *ValuesPatch, err error) *ValuesPatch
- func ValuesPatchFromBytes(data []byte) (*ValuesPatch, error)
- func ValuesPatchFromFile(filePath string) (*ValuesPatch, error)
- type ValuesPatchOperation
- type ValuesPatchType
Constants ¶
const (
GlobalValuesKey = "global"
)
Variables ¶
var ModuleDisabled = false
var ModuleEnabled = true
Functions ¶
func CalculateChecksumOfFile ¶
func Dump ¶
func Dump(values Values, dumper ValuesDumper) error
func DumpValuesJson ¶
func DumpValuesYaml ¶
func FilesFromRoot ¶
func FilesFromRoot(root string, filterFn func(dir string, name string, info os.FileInfo) bool) (files map[string]map[string]string, err error)
FilesFromRoot returns a map with path and array of files under it
func FindExecutableFilesInPath ¶
func FindExecutableFilesInPath(dir string) (executables []string, nonExecutables []string, err error)
FindExecutableFilesInPath returns a list of executable and a list of non-executable files in path
func ListFullyIn ¶
ListFullyIn returns whether all 'arr' items contains in `ref` array.
func ListIntersection ¶
ListIntersection returns an array with items that are present in all 'arrs' arrays.
func ListSubtract ¶
ListSubtract creates a new array from 'src' array with items that are not present in 'ignored' arrays.
func ModuleNameFromValuesKey ¶
ModuleNameFromValuesKey returns kebab-cased name from camelCased (verySimpleModule become ver-simple-module)
func ModuleNameToValuesKey ¶
ModuleNameToValuesKey returns camelCased name from kebab-cased (very-simple-module become verySimpleModule)
func SortByReference ¶
SortByReference returns a new array with items sorted by the order of 'ref' array.
func SortReverse ¶
SortReverse creates a copy of 'in' array and sort it in a reverse order.
func SortReverseByReference ¶
SortReverseByReference returns a new array with items, reverse sorted by the order of 'ref' array.
func SymlinkInfo ¶
func ValuesToString ¶
func WalkSymlinks ¶
func WalkSymlinks(target string, linkName string, files map[string]map[string]string, filterFn func(dir string, name string, info os.FileInfo) bool) (symlinkedDirectories map[string]string, err error)
WalkSymlinks walks a directory, updates files map and returns symlinked directories
Types ¶
type ModuleConfig ¶
type ModuleConfig struct { ModuleName string IsEnabled *bool Values Values IsUpdated bool ModuleConfigKey string ModuleEnabledKey string RawConfig []string }
func NewModuleConfig ¶
func NewModuleConfig(moduleName string) *ModuleConfig
func (*ModuleConfig) Checksum ¶
func (mc *ModuleConfig) Checksum() string
func (*ModuleConfig) FromKeyYamls ¶
func (mc *ModuleConfig) FromKeyYamls(configData map[string]string) (*ModuleConfig, error)
FromKeyYamls loads module config from a structure with string keys and yaml string values (ConfigMap)
Example:
simpleModule: |
param1: 10 param2: 120
simpleModuleEnabled: "true"
func (*ModuleConfig) FromYaml ¶
func (mc *ModuleConfig) FromYaml(yamlString []byte) (*ModuleConfig, error)
FromYaml loads module config from a yaml string.
Example:
simpleModule:
param1: 10 param2: 120
simpleModuleEnabled: true
func (*ModuleConfig) LoadValues ¶
func (mc *ModuleConfig) LoadValues(values map[interface{}]interface{}) (*ModuleConfig, error)
LoadValues loads module config from a map.
Values for module in `values` map are addressed by a key. This key should be produced with ModuleNameToValuesKey.
func (ModuleConfig) String ¶
func (mc ModuleConfig) String() string
func (*ModuleConfig) WithEnabled ¶
func (mc *ModuleConfig) WithEnabled(v bool) *ModuleConfig
func (*ModuleConfig) WithUpdated ¶
func (mc *ModuleConfig) WithUpdated(v bool) *ModuleConfig
func (*ModuleConfig) WithValues ¶
func (mc *ModuleConfig) WithValues(values Values) *ModuleConfig
type Values ¶
type Values map[string]interface{}
Values stores values for modules or hooks by name.
func ApplyJsonPatchToValues ¶
func ApplyValuesPatch ¶
func ApplyValuesPatch(values Values, valuesPatch ValuesPatch) (Values, bool, error)
func FormatValues ¶
func Load ¶
func Load(key string, loader ValuesLoader) (Values, error)
Load values by specific key from loader
func LoadAll ¶
func LoadAll(loader ValuesLoader) (Values, error)
LoadAll loads values from all keys from loader
func MergeValues ¶
func NewValuesFromBytes ¶
type ValuesDumper ¶
func NewDumperToJsonFile ¶
func NewDumperToJsonFile(path string) ValuesDumper
type ValuesDumperToJsonFile ¶
type ValuesDumperToJsonFile struct {
FileName string
}
func (*ValuesDumperToJsonFile) Write ¶
func (*ValuesDumperToJsonFile) Write(values Values) error
type ValuesLoader ¶
func NewLoaderFromJsonFile ¶
func NewLoaderFromJsonFile(path string) ValuesLoader
type ValuesLoaderFromJsonFile ¶
type ValuesLoaderFromJsonFile struct {
FileName string
}
func (*ValuesLoaderFromJsonFile) Read ¶
func (*ValuesLoaderFromJsonFile) Read() (Values, error)
type ValuesPatch ¶
type ValuesPatch struct {
Operations []*ValuesPatchOperation
}
func AppendValuesPatch ¶
func AppendValuesPatch(valuesPatches []ValuesPatch, newValuesPatch ValuesPatch) []ValuesPatch
func CompactValuesPatches ¶
func CompactValuesPatches(valuesPatches []ValuesPatch, newValuesPatch ValuesPatch) []ValuesPatch
func MustValuesPatch ¶
func MustValuesPatch(res *ValuesPatch, err error) *ValuesPatch
func ValuesPatchFromBytes ¶
func ValuesPatchFromBytes(data []byte) (*ValuesPatch, error)
func ValuesPatchFromFile ¶
func ValuesPatchFromFile(filePath string) (*ValuesPatch, error)
func (*ValuesPatch) JsonPatch ¶
func (p *ValuesPatch) JsonPatch() jsonpatch.Patch
type ValuesPatchOperation ¶
type ValuesPatchOperation struct { Op string `json:"op"` Path string `json:"path"` Value interface{} `json:"value"` }
func CompactValuesPatchOperations ¶
func CompactValuesPatchOperations(operations []*ValuesPatchOperation, newOperations []*ValuesPatchOperation) []*ValuesPatchOperation
func (*ValuesPatchOperation) ToString ¶
func (op *ValuesPatchOperation) ToString() string
type ValuesPatchType ¶
type ValuesPatchType string
const ConfigMapPatch ValuesPatchType = "CONFIG_MAP_PATCH"
const MemoryValuesPatch ValuesPatchType = "MEMORY_VALUES_PATCH"