kyamls

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAPIVersion added in v0.0.5

func GetAPIVersion(node *yaml.RNode, path string) string

GetAPIVersion finds the API Version of the node at the given path

func GetKind added in v0.0.4

func GetKind(node *yaml.RNode, path string) string

GetKind finds the Kind of the node at the given path

func GetStringField added in v0.0.5

func GetStringField(node *yaml.RNode, path string, fields ...string) string

/ GetStringField returns the given field from the node or returns a blank string if the field cannot be found

func IsClusterKind added in v0.0.4

func IsClusterKind(kind string) bool

IsClusterKind returns true if the kind is a cluster kind

func JSONPath added in v0.0.10

func JSONPath(fields ...string) string

JSONPath returns the fields separated by dots

func ModifyFiles

func ModifyFiles(dir string, modifyFn func(node *yaml.RNode, path string) (bool, error), filter Filter) error

ModifyFiles recursively walks the given directory and modifies any suitable file

func SetStringValue added in v0.0.10

func SetStringValue(node *yaml.RNode, path string, value string, fields ...string) error

SetStringValue sets the string value at the given path

Types

type APIVersionKindsFilter added in v0.0.5

type APIVersionKindsFilter struct {
	Kinds       []KindFilter
	KindsIgnore []KindFilter
}

APIVersionKindsFilter a filter of kinds and/or API versions

type Filter added in v0.0.4

type Filter struct {
	Kinds       []string
	KindsIgnore []string
}

Filter for filtering

func (*Filter) AddFlags added in v0.0.4

func (f *Filter) AddFlags(cmd *cobra.Command)

AddFlags add CLI flags for specifying a filter

func (*Filter) Parse added in v0.0.5

func (f *Filter) Parse() APIVersionKindsFilter

Parse parses the filter strings

func (*Filter) ToFilterFn added in v0.0.4

func (f *Filter) ToFilterFn() (func(node *yaml.RNode, path string) (bool, error), error)

ToFilterFn creates a filter function

type KindFilter added in v0.0.5

type KindFilter struct {
	APIVersion *string
	Kind       *string
}

KindFilter a filter on a kind and an optional APIVersion

func ParseKindFilter added in v0.0.5

func ParseKindFilter(text string) KindFilter

ParseKindFilter parses a kind filter

func (*KindFilter) Matches added in v0.0.5

func (f *KindFilter) Matches(node *yaml.RNode, path string) bool

Matches returns true if this node matches the filter

Jump to

Keyboard shortcuts

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