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

package printers

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


Package Files

interface.go tablegenerator.go tableprinter.go tabwriter.go

func GetNewTabWriter Uses

func GetNewTabWriter(output io.Writer) *tabwriter.Writer

GetNewTabWriter returns a tabwriter that translates tabbed columns in input into properly aligned text.

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 PrintOptions) ([]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 HumanReadablePrinter Uses

type HumanReadablePrinter struct {
    // contains filtered or unexported fields

HumanReadablePrinter is an implementation of ResourcePrinter which attempts to provide more elegant output. It is not threadsafe, but you may call PrintObj repeatedly; headers will only be printed if the object type changes. This makes it useful for printing items received from watches.

func NewTableGenerator Uses

func NewTableGenerator() *HumanReadablePrinter

NewTableGenerator creates a HumanReadablePrinter suitable for calling GenerateTable().

func NewTablePrinter Uses

func NewTablePrinter(options PrintOptions) *HumanReadablePrinter

NewTablePrinter creates a printer suitable for calling PrintObj(). TODO(seans3): Change return type to ResourcePrinter interface once we no longer need to constuct the "handlerMap".

func (*HumanReadablePrinter) GenerateTable Uses

func (h *HumanReadablePrinter) GenerateTable(obj runtime.Object, options PrintOptions) (*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 (*HumanReadablePrinter) PrintObj Uses

func (h *HumanReadablePrinter) PrintObj(obj runtime.Object, output io.Writer) error

PrintObj prints the obj in a human-friendly format according to the type of the obj.

func (*HumanReadablePrinter) TableHandler Uses

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

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

func (*HumanReadablePrinter) With Uses

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

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

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 PrintOptions Uses

type PrintOptions struct {
    NoHeaders          bool
    WithNamespace      bool
    WithKind           bool
    Wide               bool
    ShowLabels         bool
    AbsoluteTimestamps bool
    Kind               schema.GroupKind
    ColumnLabels       []string

    SortBy string

    // indicates if it is OK to ignore missing keys for rendering an output template.
    AllowMissingKeys bool

PrintOptions struct defines a struct for various print options

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 PrintOptions) (*metav1beta1.Table, error)

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



Package printers imports 15 packages (graph) and is imported by 288 packages. Updated 2019-07-11. Refresh now. Tools for package owners.