schema

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrEmptyYAML is an empty body error.
	ErrEmptyYAML = errors.New("body is empty")
)

Functions

func ImportYaml

func ImportYaml(r io.Reader) (*TypeSpec, Properties, error)

ImportYaml converts a reader containing YAML to a TypeSpec and Properties.

Types

type GVK

type GVK struct {
	GroupPath []string
	Version   string
	Kind      string
}

GVK is a group, version, kind descriptor.

func (*GVK) Group

func (gvk *GVK) Group() []string

Group returns the group this GVK represents.

func (*GVK) Path

func (gvk *GVK) Path() []string

Path returns the path of the current descriptor as a slice of strings.

type Properties

type Properties map[interface{}]interface{}

Properties are document properties

func (Properties) Name

func (p Properties) Name() (string, error)

Name extract name or generateName from metadata. If either are not found, it returns an error.

func (Properties) Paths

func (p Properties) Paths(gvk GVK) []PropertyPath

Paths returns a list of paths in properties.

func (Properties) Value

func (p Properties) Value(path []string) (interface{}, error)

Value returns the value at a path.

type PropertyPath

type PropertyPath struct {
	Path  []string
	Value interface{}
}

PropertyPath contains a property path.

type TypeSpec

type TypeSpec struct {
	// APIVersion is the api version of the object.
	APIVersion string
	// RawKind is the unformatted kind for the object.
	RawKind string
}

TypeSpec describes an object's type.

func NewTypeSpec

func NewTypeSpec(apiVersion, kind string) (*TypeSpec, error)

NewTypeSpec creates an instance of TypeSpec.

func (*TypeSpec) GVK

func (ts *TypeSpec) GVK() GVK

GVK returns the GVK descriptor for the TypeSpec.

func (*TypeSpec) Group

func (ts *TypeSpec) Group() []string

Group is the group as defined by the TypeSpec.

func (*TypeSpec) Kind

func (ts *TypeSpec) Kind() string

Kind is the kind for the object.

func (*TypeSpec) Version

func (ts *TypeSpec) Version() string

Version is the version as defined by the TypeSpec.

type ValueExtractor

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

ValueExtractor extracts Values from a manifest.

func NewValueExtractor

func NewValueExtractor(root *astext.Object) *ValueExtractor

NewValueExtractor creates an instance of ValueExtractor.

func ValueExtractorFactory

func ValueExtractorFactory() (*ValueExtractor, error)

ValueExtractorFactory returns a value extractor.

func (*ValueExtractor) Extract

func (ve *ValueExtractor) Extract(gvk GVK, props Properties) (map[string]Values, error)

Extract extracts values from an object.

type Values

type Values struct {
	Lookup []string
	Setter string
	Value  interface{}
}

Values are values extracted from a manifest.

Jump to

Keyboard shortcuts

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