listsetters

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2021 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ArraySetterType         string = "array"
	ScalarSetterDefaultType string = "str"
)
View Source
const SetterCommentIdentifier = "# kpt-set: "

Variables

This section is empty.

Functions

func FindKptfile

func FindKptfile(nodes []*yaml.RNode) (*kptfilev1.KptFile, error)

FindKptfile discovers Kptfile of the root package from slice of nodes

func FindSettersFromKptfile

func FindSettersFromKptfile(nodes []*yaml.RNode) (map[string]string, error)

FindSettersFromKptfile discovers setters from kptfile if exists

func VisitElements

func VisitElements(rn *yaml.RNode, fn func(node *yaml.RNode, i int) error) error

VisitElements calls fn for each element in a SequenceNode. Returns an error for non-SequenceNodes

Types

type ArraySetter

type ArraySetter struct {
	// Name is the name of the setter
	Name string

	// Values are the values of the field parameterized by the setter
	Values []string

	// Count is the number of fields parameterized by the setter
	Count int
}

ArraySetter stores name, values and count of the array setter

type ListSetters

type ListSetters struct {
	// ScalarSetters holds the discovered scalar setters
	ScalarSetters map[string]*ScalarSetter

	// ArraySetters holds the discovered array setters
	ArraySetters map[string]*ArraySetter

	// Warnings holds recoverable error info that occurred during setter discovery
	Warnings []*WarnSetterDiscovery
	// contains filtered or unexported fields
}

ListSetters lists setters identified by the setter comments

func New

func New() ListSetters

func (*ListSetters) Filter

func (ls *ListSetters) Filter(nodes []*yaml.RNode) ([]*yaml.RNode, error)

Filter implements list as a yaml.Filter

func (*ListSetters) GetResults

func (ls *ListSetters) GetResults() []*Result

GetResults returns sorted slice of all listsetter results

type Result

type Result struct {
	Name  string
	Value string
	Type  string
	Count int
}

Result represents results of setter discovery

func (Result) String

func (r Result) String() string

type ScalarSetter

type ScalarSetter struct {
	// Name is the name of the setter
	Name string

	// Value is the value of the field parameterized by the setter
	Value string

	// Type is the data type for the value
	Type string

	// Count is the number of fields parameterized by the setter
	Count int
}

ScalarSetter stores name, value and count of the scalar setter

type WarnSetterDiscovery

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

WarnSetterDiscovery represents a recoverable error that occurred during setter discovery

func (*WarnSetterDiscovery) Error

func (e *WarnSetterDiscovery) Error() string

Jump to

Keyboard shortcuts

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