decoder

package
v1.8.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package decoder provides a YAML decoder for machine configuration documents.

Index

Constants

View Source
const (
	// ManifestAPIVersionKey is the string indicating a manifest's version.
	ManifestAPIVersionKey = "apiVersion"
	// ManifestKindKey is the string indicating a manifest's kind.
	ManifestKindKey = "kind"
	// ManifestDeprecatedKeyMachine represents the deprecated v1alpha1 manifest.
	ManifestDeprecatedKeyMachine = "machine"
	// ManifestDeprecatedKeyCluster represents the deprecated v1alpha1 manifest.
	ManifestDeprecatedKeyCluster = "cluster"
	// ManifestDeprecatedKeyDebug represents the deprecated v1alpha1 manifest.
	ManifestDeprecatedKeyDebug = "debug"
	// ManifestDeprecatedKeyPersist represents the deprecated v1alpha1 manifest.
	ManifestDeprecatedKeyPersist = "persist"
)

Variables

View Source
var ErrLookupFailed = errors.New("lookup failed")

ErrLookupFailed is returned when the lookup failed.

View Source
var ErrMissingKind = errors.New("missing kind")

ErrMissingKind indicates that the manifest is missing a kind.

View Source
var ErrZeroedDocument = errors.New("document is empty now")

ErrZeroedDocument is returned when the document is empty after applying the delete selector.

Functions

func AppendDeletesTo added in v1.8.0

func AppendDeletesTo(n *yaml.Node, dest []config.Document, idx int) (_ []config.Document, err error)

AppendDeletesTo appends all delete selectors found in the given YAML node to the given destination slice.

Types

type Decoder

type Decoder struct{}

Decoder represents a multi-doc YAML decoder.

func NewDecoder

func NewDecoder() *Decoder

NewDecoder initializes and returns a `Decoder`.

func (*Decoder) Decode

func (d *Decoder) Decode(r io.Reader, allowPatchDelete bool) ([]config.Document, error)

Decode decodes all known manifests.

type Selector added in v1.8.0

type Selector interface {
	config.Document
	DocIdx() int
	ApplyTo(config.Document) error
}

Selector represents a delete selector for a document.

Jump to

Keyboard shortcuts

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