manifest

package
v0.0.0-...-a4cc684 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(root map[string]interface{}, path util.Path) (bool, error)

Delete sets value at path of input untyped tree to nil

func Find

func Find(inputTree map[string]interface{}, path util.Path) (interface{}, bool, error)

Find returns the value at path from the given tree, or false if the path does not exist. It behaves differently from GetPathContext in that it never creates map entries at the leaf and does not provide a way to mutate the parent of the found node.

func GetValueFromSetFlags

func GetValueFromSetFlags(setFlags []string, key string) string

func MergeNode

func MergeNode(root interface{}, path util.Path, value interface{}) error

MergeNode merges value to the tree in root at the given path, creating any required missing internal nodes in path.

func OverlaySetFlags

func OverlaySetFlags(base string, setFlags []string) (string, error)

func ParseValue

func ParseValue(valueStr string) interface{}

ParseValue parses string into a value

func ReadAndOverlayYamls

func ReadAndOverlayYamls(filenames []string) (string, error)

func ReadOverlayProfileYaml

func ReadOverlayProfileYaml(profilePath string, profile string) (string, error)

func ReadProfileYaml

func ReadProfileYaml(profilePath string, profile string) (string, error)

ReadProfileYaml reads profile yaml specified by profilePath/profile.yaml and validates the content.

func ReadProfilesNames

func ReadProfilesNames(profilesPath string) ([]string, error)

ReadProfilesNames reads all profiles in directory specified by profilesPath. It does not traverse recursively. It may add some filters in the future.

func ReadYamlAndProfile

func ReadYamlAndProfile(filenames []string, setFlags []string) (string, string, error)

func SplitSetFlag

func SplitSetFlag(flag string) (string, string)

func StripPrefix

func StripPrefix(path, prefix string) string

StripPrefix removes the given prefix from prefix.

func WriteNode

func WriteNode(root interface{}, path util.Path, value interface{}) error

WriteNode writes value to the tree in root at the given path, creating any required missing internal nodes in path.

func WritePathContext

func WritePathContext(nc *PathContext, value interface{}, merge bool) error

WritePathContext writes the given value to the Node in the given PathContext.

Types

type PathContext

type PathContext struct {
	// Parent in the Parent of this PathContext.
	Parent *PathContext
	// KeyToChild is the key required to reach the child.
	KeyToChild interface{}
	// Node is the actual Node in the data tree.
	Node interface{}
}

PathContext provides a means for traversing a tree towards the root.

func GetPathContext

func GetPathContext(root interface{}, path util.Path, createMissing bool) (*PathContext, bool, error)

GetPathContext returns the PathContext for the Node which has the given path from root. It returns false and no error if the given path is not found, or an error code in other error situations, like a malformed path. It also creates a tree of PathContexts during the traversal so that Parent nodes can be updated if required. This is required when (say) appending to a list, where the parent list itself must be updated.

func (*PathContext) String

func (nc *PathContext) String() string

String implements the Stringer interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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