Documentation
¶
Overview ¶
Copyright © 2022 david amick git@davidamick.com
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- func GetReferencePath(node *Node, scalarIndex int, path string) string
- func GetValidationErrorStrings(errs ValidationErrors) string
- func WalkAndValidateConfig(node *Node) error
- func WalkConvertYamlNodeToMainNode(node *Node)
- func WalkParseLoadConfigComments(node *Node)
- type ConfigNodes
- type FileConfigs
- type KeyValuePair
- type Node
- type SortConfigs
- type ValidationErrors
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetReferencePath ¶ added in v0.1.7
GetReferencePath takes a node and returns a path string like '.spec.template.spec.containers'
func GetValidationErrorStrings ¶
func GetValidationErrorStrings(errs ValidationErrors) string
GetValidationErrorStrings combines the error's strings
func WalkAndValidateConfig ¶ added in v0.1.11
WalkAndValidateConfig validates that the config file is correctly structured
func WalkConvertYamlNodeToMainNode ¶
func WalkConvertYamlNodeToMainNode(node *Node)
WalkConvertYamlNodeToMainNode converts every *yaml.Node to a *main.Node with our customizations
func WalkParseLoadConfigComments ¶
func WalkParseLoadConfigComments(node *Node)
WalkParseLoadConfigComments loads the configs from the comments in a config file
Types ¶
type ConfigNodes ¶ added in v0.1.8
ConfigNodes is a map of names to Config Nodes
type FileConfigs ¶ added in v0.0.2
type FileConfigs struct {
Kind string // config and target files
Ignore bool // target files only
IgnoreRequireds bool // target files only
}
FileConfigs supports kind and overrides
func GetFileConfigs ¶ added in v0.0.2
func GetFileConfigs(node *Node) FileConfigs
GetFileConfigs parses comments for config info
type KeyValuePair ¶ added in v0.1.0
KeyValuePair represent a scalar key node, and it's related value node
func GetKeyValuePairs ¶ added in v0.1.7
func GetKeyValuePairs(nodeContent []*Node) []KeyValuePair
GetKeyValuePairs builds a list of KeyValuePairs
type Node ¶
type Node struct {
*yaml.Node
NodeContent []*Node
ParentNode *Node
Index int
MustBeFirst bool
Required bool
Preferred bool
Ditto string
}
Node is a custom yaml.Node
type SortConfigs ¶ added in v0.1.0
type SortConfigs struct {
ConfigNodes ConfigNodes
FileConfigs FileConfigs
UnmatchedToBeginning bool
AddPreferreds bool
AddedFields *[]string
}
SortConfigs represent various configs for a sorting operation
type ValidationErrors ¶
type ValidationErrors []error
ValidationErrors allows us to return multiple validation errors
func WalkAndCompare ¶
func WalkAndCompare(configNode, fileNode *Node, sortConfs SortConfigs, errs ValidationErrors) ValidationErrors
WalkAndCompare walks the tree and does the validation
func WalkAndSort ¶ added in v0.1.0
func WalkAndSort(configNode, fileNode *Node, sortConfs SortConfigs, errs ValidationErrors) ValidationErrors
WalkAndSort walks the tree and sorts the .Content and .NodeContent