Documentation ¶
Index ¶
- func GetNewTabWriter(output io.Writer) *tabwriter.Writer
- func ValidateRowPrintHandlerFunc(printFunc reflect.Value) error
- type GenerateOptions
- type HumanReadableGenerator
- func (h *HumanReadableGenerator) GenerateTable(obj runtime.Object, options GenerateOptions) (*metav1beta1.Table, error)
- func (h *HumanReadableGenerator) TableHandler(columnDefinitions []metav1beta1.TableColumnDefinition, printFunc interface{}) error
- func (h *HumanReadableGenerator) With(fns ...func(PrintHandler)) *HumanReadableGenerator
- type HumanReadablePrinter
- type PrintHandler
- type PrintOptions
- type ResourcePrinter
- type ResourcePrinterFunc
- type TableGenerator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetNewTabWriter ¶
GetNewTabWriter returns a tabwriter that translates tabbed columns in input into properly aligned text.
func ValidateRowPrintHandlerFunc ¶ added in v1.7.0
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.
Types ¶
type GenerateOptions ¶ added in v1.16.0
GenerateOptions encapsulates attributes for table generation.
type HumanReadableGenerator ¶ added in v1.16.0
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 ¶ added in v1.15.0
func NewTableGenerator() *HumanReadableGenerator
NewTableGenerator creates a HumanReadableGenerator suitable for calling GenerateTable().
func (*HumanReadableGenerator) GenerateTable ¶ added in v1.16.0
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 ¶ added in v1.16.0
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 ¶ added in v1.16.0
func (h *HumanReadableGenerator) With(fns ...func(PrintHandler)) *HumanReadableGenerator
With method - accepts a list of builder functions that modify HumanReadableGenerator
type HumanReadablePrinter ¶
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.
type PrintHandler ¶ added in v1.7.0
type PrintHandler interface {
TableHandler(columns []metav1beta1.TableColumnDefinition, printFunc interface{}) error
}
PrintHandler - interface to handle printing provided an array of metav1beta1.TableColumnDefinition
type PrintOptions ¶
type PrintOptions struct { NoHeaders bool WithNamespace bool WithKind bool Wide bool ShowLabels 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 ¶
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.
func NewTablePrinter ¶ added in v1.7.0
func NewTablePrinter(options PrintOptions) ResourcePrinter
NewTablePrinter creates a printer suitable for calling PrintObj().
type ResourcePrinterFunc ¶
ResourcePrinterFunc is a function that can print objects
type TableGenerator ¶ added in v1.15.0
type TableGenerator interface {
GenerateTable(obj runtime.Object, options GenerateOptions) (*metav1beta1.Table, error)
}
TableGenerator - an interface for generating metav1beta1.Table provided a runtime.Object