kyamlutils

package
v0.0.0-...-b8e83fa Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DocumentSelector

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

DocumentSelector RNode objects

func (DocumentSelector) ByAPIVersion

func (f DocumentSelector) ByAPIVersion(apiver string) DocumentSelector

ByAPIVersion adds filter by 'apiVersion' field value

func (DocumentSelector) ByGVK

func (f DocumentSelector) ByGVK(group, version, kind string) DocumentSelector

ByGVK adds filters by 'apiVersion' and 'kind; field values

func (DocumentSelector) ByKey

func (f DocumentSelector) ByKey(key, val string) DocumentSelector

ByKey adds filter by specific yaml manifest key and value

func (DocumentSelector) ByLabel

func (f DocumentSelector) ByLabel(labelSelector string) DocumentSelector

ByLabel adds filter to filter by labelSelector. For more details about syntax for labelSelector refer to Parse() function description from https://github.com/kubernetes/apimachinery/blob/master/pkg/labels/selector.go

func (DocumentSelector) ByName

func (f DocumentSelector) ByName(name string) DocumentSelector

ByName adds filter by 'metadata.name' field value

func (DocumentSelector) ByNamespace

func (f DocumentSelector) ByNamespace(ns string) DocumentSelector

ByNamespace adds filter by 'metadata.namespace' field value

func (DocumentSelector) Filter

func (f DocumentSelector) Filter(items []*yaml.RNode) (result []*yaml.RNode, err error)

Filter RNode objects

func (DocumentSelector) Filters

func (f DocumentSelector) Filters() []kio.Filter

Filters return list of defined filters for the selector

type ErrBadQueryFormat

type ErrBadQueryFormat struct {
	Msg string
}

ErrBadQueryFormat raised for JSON query errors

func (ErrBadQueryFormat) Error

func (e ErrBadQueryFormat) Error() string

type ErrIndexOutOfBound

type ErrIndexOutOfBound struct {
	Index  int
	Length int
}

ErrIndexOutOfBound returned if JSON path points to a wrong index of a list

func (ErrIndexOutOfBound) Error

func (e ErrIndexOutOfBound) Error() string

type ErrLookup

type ErrLookup struct {
	Msg string
}

ErrLookup raised if error occurs during walk through yaml resource

func (ErrLookup) Error

func (e ErrLookup) Error() string

type ErrNotScalar

type ErrNotScalar struct {
	Node *yaml.Node
}

ErrNotScalar returned if value defined by key in JSON path is not scalar Error can be returned for filter queries

func (ErrNotScalar) Error

func (e ErrNotScalar) Error() string

type ErrQueryConversion

type ErrQueryConversion struct {
	Msg   string
	Query string
}

ErrQueryConversion returned by query conversion function

func (ErrQueryConversion) Error

func (e ErrQueryConversion) Error() string

type JSONPathFilter

type JSONPathFilter struct {
	Kind string `yaml:"kind,omitempty"`
	// Path is jsonpath query. See http://goessner.net/articles/JsonPath/ for
	// details.
	Path string `yaml:"path,omitempty"`
	// Mutator is a function which changes filtered node
	Mutator func([]*yaml.RNode) error
	// Create empty struct if path element does not exist
	Create bool
}

JSONPathFilter returns RNode under JSON path

func (JSONPathFilter) Filter

func (l JSONPathFilter) Filter(rn *yaml.RNode) (*yaml.RNode, error)

Filter returns RNode identified by JSON path

type LabelFilter

type LabelFilter struct {
	MatchExpression string
}

LabelFilter allows to filter labels based on label Selectors Uses kubernetes label selector library from apimachinery package undreneath For syntax for MatchExpression, please refer to description of Parse() function at https://github.com/kubernetes/apimachinery/blob/master/pkg/labels/selector.go

func (*LabelFilter) Filter

func (lf *LabelFilter) Filter(input []*yaml.RNode) ([]*yaml.RNode, error)

Filter implements RNode filter interface

Jump to

Keyboard shortcuts

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