versionedconfig

package
v2.20.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2019 License: Apache-2.0 Imports: 3 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigNotSupported

func ConfigNotSupported(name string, cfgBytes []byte) ([]byte, error)

ConfigNotSupported verifies that the provided bytes represent empty YAML. If the YAML is non-empty, return an error.

func ConfigVersion

func ConfigVersion(in []byte) (string, error)

ConfigVersion unmarshals the provided bytes as YAML and returns the value of the top-level "version" key. The value of this key must be a string. If the input is valid YAML but does not contain a "version" key, returns the empty string. Returns an error if the input is not valid YAML or cannot be unmarshaled as YAML as specified.

func IsLegacyConfig

func IsLegacyConfig(cfgBytes []byte) bool

func TrimLegacyPrefix

func TrimLegacyPrefix(in []byte) ([]byte, bool)

TrimLegacyPrefix trims the "legacy-config: true" YAML key/value if it is the first line in the provided bytes. If the provided bytes do not start with this line, the input is returned directly. Returns true if the prefix is trimmed, false otherwise.

Types

type ConfigWithLegacy

type ConfigWithLegacy struct {
	Legacy bool `yaml:"legacy-config"`
}

ConfigWithLegacy is a struct with a "legacy" YAML field that stores a boolean that indicates whether or not the configuration is "legacy" configuration.

type ConfigWithVersion

type ConfigWithVersion struct {
	Version string `yaml:"version,omitempty"`
}

ConfigWithVersion is a struct with a "version" YAML field that stores the version as a string.

Jump to

Keyboard shortcuts

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