printer

package
v0.11.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 22 Imported by: 1

Documentation

Overview

Copyright 2019 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

ref: k8s.io/kubernetes/pkg/printers/tablegenerator.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCollaSetHandlers added in v0.9.0

func AddCollaSetHandlers(h PrintHandler)

func AddK8sHandlers

func AddK8sHandlers(h PrintHandler)

AddHandlers adds print handlers for default Kubernetes types dealing with internal versions. TODO: handle errors from Handler

func AddOAMHandlers

func AddOAMHandlers(h PrintHandler)

func ValidateRowPrintHandlerFunc

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) (string, bool)

where ObjectType is the type of the object that will be printed, and the first return value is a string of key parameters of object, and second is a bool flag which indicates object is ready or not

Types

type HumanReadableGenerator

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

func NewTableGenerator() *HumanReadableGenerator

NewTableGenerator creates a HumanReadableGenerator suitable for calling GenerateTable().

func (*HumanReadableGenerator) GenerateTable

func (h *HumanReadableGenerator) GenerateTable(obj runtime.Object) (string, bool)

GenerateTable returns a table for the provided object, using the printer registered for that type. It returns a table that includes all 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

func (h *HumanReadableGenerator) TableHandler(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

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

type PrintHandler

type PrintHandler interface {
	TableHandler(printFunc interface{}) error
}

PrintHandler - interface to handle printing provided a runtime.Object

type TableGenerator

type TableGenerator interface {
	GenerateTable(obj runtime.Object) (string, bool)
}

TableGenerator - an interface for generating a message and ready flag provided a runtime.Object

Jump to

Keyboard shortcuts

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