kubernetes: k8s.io/kubernetes/pkg/printers Index | Files | Directories

package printers

import "k8s.io/kubernetes/pkg/printers"

Index

Package Files

interface.go tablegenerator.go

func ValidateRowPrintHandlerFunc Uses

func ValidateRowPrintHandlerFunc(printFunc reflect.Value) error

ValidateRowPrintHandlerFunc validates print handler signature. printFunc is the function that will be called to print an object. It must be of the following type:

func printFunc(object ObjectType, options GenerateOptions) ([]metav1beta1.TableRow, error)

where ObjectType is the type of the object that will be printed, and the first return value is an array of rows, with each row containing a number of cells that match the number of columns defined for that printer function.

type GenerateOptions Uses

type GenerateOptions struct {
    NoHeaders bool
    Wide      bool
}

GenerateOptions encapsulates attributes for table generation.

type HumanReadableGenerator Uses

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

HumanReadableGenerator is an implementation of TableGenerator used to generate a table for a specific resource. The table is printed with a TablePrinter using PrintObj().

func NewTableGenerator Uses

func NewTableGenerator() *HumanReadableGenerator

NewTableGenerator creates a HumanReadableGenerator suitable for calling GenerateTable().

func (*HumanReadableGenerator) GenerateTable Uses

func (h *HumanReadableGenerator) GenerateTable(obj runtime.Object, options GenerateOptions) (*metav1beta1.Table, error)

GenerateTable returns a table for the provided object, using the printer registered for that type. It returns a table that includes all of the information requested by options, but will not remove rows or columns. The caller is responsible for applying rules related to filtering rows or columns.

func (*HumanReadableGenerator) TableHandler Uses

func (h *HumanReadableGenerator) TableHandler(columnDefinitions []metav1beta1.TableColumnDefinition, printFunc interface{}) error

TableHandler adds a print handler with a given set of columns to HumanReadableGenerator instance. See ValidateRowPrintHandlerFunc for required method signature.

func (*HumanReadableGenerator) With Uses

func (h *HumanReadableGenerator) With(fns ...func(PrintHandler)) *HumanReadableGenerator

With method - accepts a list of builder functions that modify HumanReadableGenerator

type PrintHandler Uses

type PrintHandler interface {
    TableHandler(columns []metav1beta1.TableColumnDefinition, printFunc interface{}) error
}

PrintHandler - interface to handle printing provided an array of metav1beta1.TableColumnDefinition

type ResourcePrinter Uses

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 Uses

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

ResourcePrinterFunc is a function that can print objects

func (ResourcePrinterFunc) PrintObj Uses

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

PrintObj implements ResourcePrinter

type TableGenerator Uses

type TableGenerator interface {
    GenerateTable(obj runtime.Object, options GenerateOptions) (*metav1beta1.Table, error)
}

TableGenerator - an interface for generating metav1beta1.Table provided a runtime.Object

Directories

PathSynopsis
internalversion
storage

Package printers imports 8 packages (graph) and is imported by 291 packages. Updated 2019-11-02. Refresh now. Tools for package owners.