printers

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InternalObjectPreventer = &illegalPackageSourceChecker{disallowedPackagePrefixes}
View Source
var (
	InternalObjectPrinterErr = "a versioned object must be passed to a printer"
)

Functions

func GetObjectGroupKind

func GetObjectGroupKind(obj runtime.Object) schema.GroupKind

func IsInternalObjectError

func IsInternalObjectError(err error) bool

Types

type GoTemplatePrinter added in v1.11.1

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

GoTemplatePrinter is an implementation of ResourcePrinter which formats data with a Go Template.

func NewGoTemplatePrinter added in v1.11.1

func NewGoTemplatePrinter(tmpl []byte) (*GoTemplatePrinter, error)

func (*GoTemplatePrinter) AllowMissingKeys added in v1.11.1

func (p *GoTemplatePrinter) AllowMissingKeys(allow bool)

AllowMissingKeys tells the template engine if missing keys are allowed.

func (*GoTemplatePrinter) PrintObj added in v1.11.1

func (p *GoTemplatePrinter) PrintObj(obj runtime.Object, w io.Writer) error

PrintObj formats the obj with the Go Template.

type JSONPathPrinter added in v1.11.1

type JSONPathPrinter struct {
	*jsonpath.JSONPath
	// contains filtered or unexported fields
}

JSONPathPrinter is an implementation of ResourcePrinter which formats data with jsonpath expression.

func NewJSONPathPrinter added in v1.11.1

func NewJSONPathPrinter(tmpl string) (*JSONPathPrinter, error)

func (*JSONPathPrinter) PrintObj added in v1.11.1

func (j *JSONPathPrinter) PrintObj(obj runtime.Object, w io.Writer) error

PrintObj formats the obj with the JSONPath Template.

type JSONPrinter

type JSONPrinter struct{}

JSONPrinter is an implementation of ResourcePrinter which outputs an object as JSON.

func (*JSONPrinter) PrintObj

func (p *JSONPrinter) PrintObj(obj runtime.Object, w io.Writer) error

PrintObj is an implementation of ResourcePrinter.PrintObj which simply writes the object to the Writer.

type NamePrinter

type NamePrinter struct {
	// ShortOutput indicates whether an operation should be
	// printed along side the "resource/name" pair for an object.
	ShortOutput bool
	// Operation describes the name of the action that
	// took place on an object, to be included in the
	// finalized "successful" message.
	Operation string
}

NamePrinter is an implementation of ResourcePrinter which outputs "resource/name" pair of an object.

func (*NamePrinter) PrintObj

func (p *NamePrinter) PrintObj(obj runtime.Object, w io.Writer) error

PrintObj is an implementation of ResourcePrinter.PrintObj which decodes the object and print "resource/name" pair. If the object is a List, print all items in it.

type ResourcePrinter

type ResourcePrinter interface {
	// Print receives a runtime object, formats it and prints it to a writer.
	PrintObj(runtime.Object, io.Writer) error
}

ResourcePrinter is an interface that knows how to print runtime objects.

type ResourcePrinterFunc

type ResourcePrinterFunc func(runtime.Object, io.Writer) error

ResourcePrinterFunc is a function that can print objects

func NewDiscardingPrinter

func NewDiscardingPrinter() ResourcePrinterFunc

NewDiscardingPrinter is a printer that discards all objects

func (ResourcePrinterFunc) PrintObj

func (fn ResourcePrinterFunc) PrintObj(obj runtime.Object, w io.Writer) error

PrintObj implements ResourcePrinter

type TypeSetterPrinter

type TypeSetterPrinter struct {
	Delegate ResourcePrinter

	Typer runtime.ObjectTyper
}

TypeSetterPrinter is an implementation of ResourcePrinter wraps another printer with types set on the objects

func NewTypeSetter

func NewTypeSetter(typer runtime.ObjectTyper) *TypeSetterPrinter

NewTypeSetter constructs a wrapping printer with required params

func (*TypeSetterPrinter) PrintObj

func (p *TypeSetterPrinter) PrintObj(obj runtime.Object, w io.Writer) error

PrintObj is an implementation of ResourcePrinter.PrintObj which sets type information on the obj for the duration of printing. It is NOT threadsafe.

func (*TypeSetterPrinter) ToPrinter

func (p *TypeSetterPrinter) ToPrinter(delegate ResourcePrinter) ResourcePrinter

ToPrinter returns a printer (not threadsafe!) that has been wrapped

func (*TypeSetterPrinter) WrapToPrinter

func (p *TypeSetterPrinter) WrapToPrinter(delegate ResourcePrinter, err error) (ResourcePrinter, error)

WrapToPrinter wraps the common ToPrinter method

type YAMLPrinter

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

YAMLPrinter is an implementation of ResourcePrinter which outputs an object as YAML. The input object is assumed to be in the internal version of an API and is converted to the given version first.

func (*YAMLPrinter) PrintObj

func (p *YAMLPrinter) PrintObj(obj runtime.Object, w io.Writer) error

PrintObj prints the data as YAML.

Jump to

Keyboard shortcuts

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