Documentation ¶
Index ¶
- func AppendAllLabels(showLabels bool, itemLabels map[string]string) string
- func AppendLabels(itemLabels map[string]string, columnLabels []string) string
- func DecorateTable(table *metav1beta1.Table, options PrintOptions) error
- func FormatResourceName(kind schema.GroupKind, name string, withKind bool) string
- func GetNewTabWriter(output io.Writer) *tabwriter.Writer
- func GetObjectGroupKind(obj runtime.Object, typer runtime.ObjectTyper) schema.GroupKind
- func IsNoCompatiblePrinterError(err error) bool
- func PrintTable(table *metav1beta1.Table, output io.Writer, options PrintOptions) error
- func RelaxedJSONPathExpression(pathExpression string) (string, error)
- func ValidatePrintHandlerFunc(printFunc reflect.Value) error
- func ValidateRowPrintHandlerFunc(printFunc reflect.Value) error
- type Column
- type CustomColumnsPrintFlags
- type CustomColumnsPrinter
- type Describer
- type DescriberSettings
- type ErrNoDescriber
- type GoTemplatePrintFlags
- type GoTemplatePrinter
- func (p *GoTemplatePrinter) AfterPrint(w io.Writer, res string) error
- func (p *GoTemplatePrinter) AllowMissingKeys(allow bool)
- func (p *GoTemplatePrinter) HandledResources() []string
- func (p *GoTemplatePrinter) IsGeneric() bool
- func (p *GoTemplatePrinter) PrintObj(obj runtime.Object, w io.Writer) error
- type HumanPrintFlags
- type HumanReadablePrinter
- func (a *HumanReadablePrinter) AddTabWriter(t bool) *HumanReadablePrinter
- func (h *HumanReadablePrinter) AfterPrint(output io.Writer, res string) error
- func (h *HumanReadablePrinter) DefaultTableHandler(columnDefinitions []metav1beta1.TableColumnDefinition, printFunc interface{}) error
- func (h *HumanReadablePrinter) EnsurePrintHeaders()
- func (h *HumanReadablePrinter) HandledResources() []string
- func (h *HumanReadablePrinter) Handler(columns, columnsWithWide []string, printFunc interface{}) error
- func (h *HumanReadablePrinter) IsGeneric() bool
- func (h *HumanReadablePrinter) PrintObj(obj runtime.Object, output io.Writer) error
- func (h *HumanReadablePrinter) PrintTable(obj runtime.Object, options PrintOptions) (*metav1beta1.Table, error)
- func (h *HumanReadablePrinter) TableHandler(columnDefinitions []metav1beta1.TableColumnDefinition, printFunc interface{}) error
- func (a *HumanReadablePrinter) With(fns ...func(PrintHandler)) *HumanReadablePrinter
- type JSONPathPrintFlags
- type JSONPathPrinter
- type JSONPrinter
- type JSONYamlPrintFlags
- type KubeTemplatePrintFlags
- type NamePrintFlags
- type NamePrinter
- type NoCompatiblePrinterError
- type ObjectDescriber
- type PrintFlags
- type PrintHandler
- type PrintOptions
- type ResourcePrinter
- type ResourcePrinterFunc
- type TablePrinter
- type VersionedPrinter
- type YAMLPrinter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendAllLabels ¶ added in v1.7.0
Append all labels to a single column. We need this even when show-labels flag* is false, since this adds newline delimiter to the end of each row.
func AppendLabels ¶ added in v1.7.0
func DecorateTable ¶ added in v1.7.0
func DecorateTable(table *metav1beta1.Table, options PrintOptions) error
DecorateTable takes a table and attempts to add label columns and the namespace column. It will fill empty columns with nil (if the object does not expose metadata). It returns an error if the table cannot be decorated.
func FormatResourceName ¶ added in v1.7.0
FormatResourceName receives a resource kind, name, and boolean specifying whether or not to update the current name to "kind/name"
func GetNewTabWriter ¶
GetNewTabWriter returns a tabwriter that translates tabbed columns in input into properly aligned text.
func GetObjectGroupKind ¶ added in v1.10.0
func PrintTable ¶ added in v1.7.0
func PrintTable(table *metav1beta1.Table, output io.Writer, options PrintOptions) error
PrintTable prints a table to the provided output respecting the filtering rules for options for wide columns and filtered rows. It filters out rows that are Completed. You should call DecorateTable if you receive a table from a remote server before calling PrintTable.
func RelaxedJSONPathExpression ¶
RelaxedJSONPathExpression attempts to be flexible with JSONPath expressions, it accepts:
- metadata.name (no leading '.' or curly brances '{...}'
- {metadata.name} (no leading '.')
- .metadata.name (no curly braces '{...}')
- {.metadata.name} (complete expression)
And transforms them all into a valid jsonpath expression:
{.metadata.name}
func ValidatePrintHandlerFunc ¶ added in v1.7.0
ValidatePrintHandlerFunc 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, w io.Writer, options PrintOptions) error
where ObjectType is the type of the object that will be printed. DEPRECATED: will be replaced with ValidateRowPrintHandlerFunc
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 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.
Types ¶
type Column ¶
type Column struct { // The header to print above the column, general style is ALL_CAPS Header string // The pointer to the field in the object to print in JSONPath form // e.g. {.ObjectMeta.Name}, see pkg/util/jsonpath for more details. FieldSpec string }
Column represents a user specified column
type CustomColumnsPrintFlags ¶ added in v1.11.0
CustomColumnsPrintFlags provides default flags necessary for printing custom resource columns from an inline-template or file.
func NewCustomColumnsPrintFlags ¶ added in v1.11.0
func NewCustomColumnsPrintFlags(noHeaders bool, templateValue string) *CustomColumnsPrintFlags
NewCustomColumnsPrintFlags returns flags associated with custom-column printing, with default values set. NoHeaders and TemplateArgument should be set by callers.
func (*CustomColumnsPrintFlags) AddFlags ¶ added in v1.11.0
func (f *CustomColumnsPrintFlags) AddFlags(c *cobra.Command)
AddFlags receives a *cobra.Command reference and binds flags related to custom-columns printing
func (*CustomColumnsPrintFlags) ToPrinter ¶ added in v1.11.0
func (f *CustomColumnsPrintFlags) ToPrinter(templateFormat string) (ResourcePrinter, bool, error)
ToPrinter receives an templateFormat and returns a printer capable of handling custom-column printing. Returns false if the specified templateFormat does not match a supported format. Supported format types can be found in pkg/printers/printers.go
type CustomColumnsPrinter ¶
type CustomColumnsPrinter struct { Columns []Column Decoder runtime.Decoder NoHeaders bool // contains filtered or unexported fields }
CustomColumnPrinter is a printer that knows how to print arbitrary columns of data from templates specified in the `Columns` array
func NewCustomColumnsPrinterFromSpec ¶
func NewCustomColumnsPrinterFromSpec(spec string, decoder runtime.Decoder, noHeaders bool) (*CustomColumnsPrinter, error)
NewCustomColumnsPrinterFromSpec creates a custom columns printer from a comma separated list of <header>:<jsonpath-field-spec> pairs. e.g. NAME:metadata.name,API_VERSION:apiVersion creates a printer that prints:
NAME API_VERSION foo bar
func NewCustomColumnsPrinterFromTemplate ¶
func NewCustomColumnsPrinterFromTemplate(templateReader io.Reader, decoder runtime.Decoder) (*CustomColumnsPrinter, error)
NewCustomColumnsPrinterFromTemplate creates a custom columns printer from a template stream. The template is expected to consist of two lines, whitespace separated. The first line is the header line, the second line is the jsonpath field spec For example, the template below: NAME API_VERSION {metadata.name} {apiVersion}
func (*CustomColumnsPrinter) AfterPrint ¶
func (s *CustomColumnsPrinter) AfterPrint(w io.Writer, res string) error
func (*CustomColumnsPrinter) HandledResources ¶
func (s *CustomColumnsPrinter) HandledResources() []string
func (*CustomColumnsPrinter) IsGeneric ¶ added in v1.7.0
func (s *CustomColumnsPrinter) IsGeneric() bool
type Describer ¶
type Describer interface {
Describe(namespace, name string, describerSettings DescriberSettings) (output string, err error)
}
Describer generates output for the named resource or an error if the output could not be generated. Implementers typically abstract the retrieval of the named object from a remote server.
type DescriberSettings ¶
type DescriberSettings struct {
ShowEvents bool
}
DescriberSettings holds display configuration for each object describer to control what is printed.
type ErrNoDescriber ¶
type ErrNoDescriber struct {
Types []string
}
ErrNoDescriber is a structured error indicating the provided object or objects cannot be described.
func (ErrNoDescriber) Error ¶
func (e ErrNoDescriber) Error() string
Error implements the error interface.
type GoTemplatePrintFlags ¶ added in v1.11.0
type GoTemplatePrintFlags struct { // indicates if it is OK to ignore missing keys for rendering // an output template. AllowMissingKeys *bool TemplateArgument *string }
GoTemplatePrintFlags provides default flags necessary for template printing. Given the following flag values, a printer can be requested that knows how to handle printing based on these values.
func NewGoTemplatePrintFlags ¶ added in v1.11.0
func NewGoTemplatePrintFlags() *GoTemplatePrintFlags
NewGoTemplatePrintFlags returns flags associated with --template printing, with default values set.
func (*GoTemplatePrintFlags) AddFlags ¶ added in v1.11.0
func (f *GoTemplatePrintFlags) AddFlags(c *cobra.Command)
AddFlags receives a *cobra.Command reference and binds flags related to template printing to it
func (*GoTemplatePrintFlags) ToPrinter ¶ added in v1.11.0
func (f *GoTemplatePrintFlags) ToPrinter(templateFormat string) (ResourcePrinter, error)
ToPrinter receives an templateFormat and returns a printer capable of handling --template format printing. Returns false if the specified templateFormat does not match a template format.
type GoTemplatePrinter ¶ added in v1.11.0
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.0
func NewGoTemplatePrinter(tmpl []byte) (*GoTemplatePrinter, error)
func (*GoTemplatePrinter) AfterPrint ¶
func (p *GoTemplatePrinter) AfterPrint(w io.Writer, res string) error
func (*GoTemplatePrinter) AllowMissingKeys ¶ added in v1.11.0
func (p *GoTemplatePrinter) AllowMissingKeys(allow bool)
AllowMissingKeys tells the template engine if missing keys are allowed.
func (*GoTemplatePrinter) HandledResources ¶
func (p *GoTemplatePrinter) HandledResources() []string
TODO: implement HandledResources()
func (*GoTemplatePrinter) IsGeneric ¶
func (p *GoTemplatePrinter) IsGeneric() bool
type HumanPrintFlags ¶
type HumanPrintFlags struct { ShowKind *bool ShowLabels *bool SortBy *string ColumnLabels *[]string // get.go-specific values NoHeaders bool Kind schema.GroupKind AbsoluteTimestamps bool WithNamespace bool }
HumanPrintFlags provides default flags necessary for printing. Given the following flag values, a printer can be requested that knows how to handle printing based on these values.
func NewHumanPrintFlags ¶
func NewHumanPrintFlags(kind schema.GroupKind, noHeaders, withNamespace, absoluteTimestamps bool) *HumanPrintFlags
NewHumanPrintFlags returns flags associated with human-readable printing, with default values set.
func (*HumanPrintFlags) AddFlags ¶
func (f *HumanPrintFlags) AddFlags(c *cobra.Command)
AddFlags receives a *cobra.Command reference and binds flags related to human-readable printing to it
func (*HumanPrintFlags) ToPrinter ¶
func (f *HumanPrintFlags) ToPrinter(outputFormat string) (ResourcePrinter, bool, error)
ToPrinter receives an outputFormat and returns a printer capable of handling human-readable output.
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.
func NewHumanReadablePrinter ¶
func NewHumanReadablePrinter(encoder runtime.Encoder, decoder runtime.Decoder, options PrintOptions) *HumanReadablePrinter
NewHumanReadablePrinter creates a HumanReadablePrinter. If encoder and decoder are provided, an attempt to convert unstructured types to internal types is made.
func NewTablePrinter ¶ added in v1.7.0
func NewTablePrinter() *HumanReadablePrinter
NewTablePrinter creates a HumanReadablePrinter suitable for calling PrintTable().
func (*HumanReadablePrinter) AddTabWriter ¶ added in v1.7.0
func (a *HumanReadablePrinter) AddTabWriter(t bool) *HumanReadablePrinter
AddTabWriter sets whether the PrintObj function will format with tabwriter (true by default).
func (*HumanReadablePrinter) AfterPrint ¶
func (h *HumanReadablePrinter) AfterPrint(output io.Writer, res string) error
func (*HumanReadablePrinter) DefaultTableHandler ¶ added in v1.8.0
func (h *HumanReadablePrinter) DefaultTableHandler(columnDefinitions []metav1beta1.TableColumnDefinition, printFunc interface{}) error
DefaultTableHandler registers a set of columns and a print func that is given a chance to process any object without an explicit handler. Only the most recently set print handler is used. See ValidateRowPrintHandlerFunc for required method signature.
func (*HumanReadablePrinter) EnsurePrintHeaders ¶
func (h *HumanReadablePrinter) EnsurePrintHeaders()
EnsurePrintHeaders sets the HumanReadablePrinter option "NoHeaders" to false and removes the .lastType that was printed, which forces headers to be printed in cases where multiple lists of the same resource are printed consecutively, but are separated by non-printer related information.
func (*HumanReadablePrinter) HandledResources ¶
func (h *HumanReadablePrinter) HandledResources() []string
func (*HumanReadablePrinter) Handler ¶
func (h *HumanReadablePrinter) Handler(columns, columnsWithWide []string, printFunc interface{}) error
Handler adds a print handler with a given set of columns to HumanReadablePrinter instance. See ValidatePrintHandlerFunc for required method signature.
func (*HumanReadablePrinter) IsGeneric ¶ added in v1.7.0
func (h *HumanReadablePrinter) IsGeneric() bool
func (*HumanReadablePrinter) PrintObj ¶
PrintObj prints the obj in a human-friendly format according to the type of the obj.
func (*HumanReadablePrinter) PrintTable ¶ added in v1.7.0
func (h *HumanReadablePrinter) PrintTable(obj runtime.Object, options PrintOptions) (*metav1beta1.Table, error)
PrintTable 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) TableHandler ¶ added in v1.7.0
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 ¶ added in v1.7.0
func (a *HumanReadablePrinter) With(fns ...func(PrintHandler)) *HumanReadablePrinter
type JSONPathPrintFlags ¶ added in v1.11.0
type JSONPathPrintFlags struct { // indicates if it is OK to ignore missing keys for rendering // an output template. AllowMissingKeys *bool TemplateArgument *string }
JSONPathPrintFlags provides default flags necessary for template printing. Given the following flag values, a printer can be requested that knows how to handle printing based on these values.
func NewJSONPathPrintFlags ¶ added in v1.11.0
func NewJSONPathPrintFlags(templateValue string, allowMissingKeys bool) *JSONPathPrintFlags
NewJSONPathPrintFlags returns flags associated with --template printing, with default values set.
func (*JSONPathPrintFlags) AddFlags ¶ added in v1.11.0
func (f *JSONPathPrintFlags) AddFlags(c *cobra.Command)
AddFlags receives a *cobra.Command reference and binds flags related to template printing to it
func (*JSONPathPrintFlags) ToPrinter ¶ added in v1.11.0
func (f *JSONPathPrintFlags) ToPrinter(templateFormat string) (ResourcePrinter, error)
ToPrinter receives an templateFormat and returns a printer capable of handling --template format printing. Returns false if the specified templateFormat does not match a template format.
type JSONPathPrinter ¶
JSONPathPrinter is an implementation of ResourcePrinter which formats data with jsonpath expression.
func NewJSONPathPrinter ¶
func NewJSONPathPrinter(tmpl string) (*JSONPathPrinter, error)
func (*JSONPathPrinter) AfterPrint ¶
func (j *JSONPathPrinter) AfterPrint(w io.Writer, res string) error
func (*JSONPathPrinter) HandledResources ¶
func (p *JSONPathPrinter) HandledResources() []string
TODO: implement HandledResources()
func (*JSONPathPrinter) IsGeneric ¶ added in v1.7.0
func (p *JSONPathPrinter) IsGeneric() bool
type JSONPrinter ¶
type JSONPrinter struct { }
JSONPrinter is an implementation of ResourcePrinter which outputs an object as JSON.
func (*JSONPrinter) AfterPrint ¶
func (p *JSONPrinter) AfterPrint(w io.Writer, res string) error
func (*JSONPrinter) HandledResources ¶
func (p *JSONPrinter) HandledResources() []string
TODO: implement HandledResources()
func (*JSONPrinter) IsGeneric ¶ added in v1.7.0
func (p *JSONPrinter) IsGeneric() bool
type JSONYamlPrintFlags ¶
type JSONYamlPrintFlags struct{}
JSONYamlPrintFlags provides default flags necessary for json/yaml printing. Given the following flag values, a printer can be requested that knows how to handle printing based on these values.
func NewJSONYamlPrintFlags ¶
func NewJSONYamlPrintFlags() *JSONYamlPrintFlags
NewJSONYamlPrintFlags returns flags associated with yaml or json printing, with default values set.
func (*JSONYamlPrintFlags) AddFlags ¶
func (f *JSONYamlPrintFlags) AddFlags(c *cobra.Command)
AddFlags receives a *cobra.Command reference and binds flags related to JSON or Yaml printing to it
func (*JSONYamlPrintFlags) ToPrinter ¶
func (f *JSONYamlPrintFlags) ToPrinter(outputFormat string) (ResourcePrinter, error)
ToPrinter receives an outputFormat and returns a printer capable of handling --output=(yaml|json) printing. Returns false if the specified outputFormat does not match a supported format. Supported Format types can be found in pkg/printers/printers.go
type KubeTemplatePrintFlags ¶ added in v1.11.0
type KubeTemplatePrintFlags struct { *GoTemplatePrintFlags *JSONPathPrintFlags AllowMissingKeys *bool TemplateArgument *string }
KubeTemplatePrintFlags composes print flags that provide both a JSONPath and a go-template printer. This is necessary if dealing with cases that require support both both printers, since both sets of flags require overlapping flags.
func NewKubeTemplatePrintFlags ¶ added in v1.11.0
func NewKubeTemplatePrintFlags() *KubeTemplatePrintFlags
NewKubeTemplatePrintFlags returns flags associated with --template printing, with default values set.
func (*KubeTemplatePrintFlags) AddFlags ¶ added in v1.11.0
func (f *KubeTemplatePrintFlags) AddFlags(c *cobra.Command)
AddFlags receives a *cobra.Command reference and binds flags related to template printing to it
func (*KubeTemplatePrintFlags) ToPrinter ¶ added in v1.11.0
func (f *KubeTemplatePrintFlags) ToPrinter(outputFormat string) (ResourcePrinter, error)
type NamePrintFlags ¶
type NamePrintFlags struct { // Operation describes the name of the action that // took place on an object, to be included in the // finalized "successful" message. Operation string }
NamePrintFlags provides default flags necessary for printing a resource's fully-qualified Kind.group/name, or a successful message about that resource if an Operation is provided.
func NewNamePrintFlags ¶
func NewNamePrintFlags(operation string) *NamePrintFlags
NewNamePrintFlags returns flags associated with --name printing, with default values set.
func (*NamePrintFlags) AddFlags ¶
func (f *NamePrintFlags) AddFlags(c *cobra.Command)
AddFlags receives a *cobra.Command reference and binds flags related to name printing to it
func (*NamePrintFlags) Complete ¶
func (f *NamePrintFlags) Complete(successTemplate string) error
func (*NamePrintFlags) ToPrinter ¶
func (f *NamePrintFlags) ToPrinter(outputFormat string) (ResourcePrinter, error)
ToPrinter receives an outputFormat and returns a printer capable of handling --output=name printing. Returns false if the specified outputFormat does not match a supported format. Supported format types can be found in pkg/printers/printers.go
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 Decoders []runtime.Decoder Typer runtime.ObjectTyper }
NamePrinter is an implementation of ResourcePrinter which outputs "resource/name" pair of an object.
func (*NamePrinter) AfterPrint ¶
func (p *NamePrinter) AfterPrint(w io.Writer, res string) error
func (*NamePrinter) HandledResources ¶
func (p *NamePrinter) HandledResources() []string
TODO: implement HandledResources()
func (*NamePrinter) IsGeneric ¶ added in v1.7.0
func (p *NamePrinter) IsGeneric() bool
type NoCompatiblePrinterError ¶
type NoCompatiblePrinterError struct {
Options interface{}
}
func (NoCompatiblePrinterError) Error ¶
func (e NoCompatiblePrinterError) Error() string
type ObjectDescriber ¶
type ObjectDescriber interface {
DescribeObject(object interface{}, extra ...interface{}) (output string, err error)
}
ObjectDescriber is an interface for displaying arbitrary objects with extra information. Use when an object is in hand (on disk, or already retrieved). Implementers may ignore the additional information passed on extra, or use it by default. ObjectDescribers may return ErrNoDescriber if no suitable describer is found.
type PrintFlags ¶
type PrintFlags struct { JSONYamlPrintFlags *JSONYamlPrintFlags NamePrintFlags *NamePrintFlags OutputFormat *string }
PrintFlags composes common printer flag structs used across all commands, and provides a method of retrieving a known printer based on flag values provided.
func NewPrintFlags ¶
func NewPrintFlags(operation string) *PrintFlags
func (*PrintFlags) AddFlags ¶
func (f *PrintFlags) AddFlags(cmd *cobra.Command)
func (*PrintFlags) Complete ¶
func (f *PrintFlags) Complete(successTemplate string) error
func (*PrintFlags) ToPrinter ¶
func (f *PrintFlags) ToPrinter() (ResourcePrinter, error)
type PrintHandler ¶ added in v1.7.0
type PrintHandler interface { Handler(columns, columnsWithWide []string, printFunc interface{}) error TableHandler(columns []metav1beta1.TableColumnDefinition, printFunc interface{}) error DefaultTableHandler(columns []metav1beta1.TableColumnDefinition, printFunc interface{}) error }
type PrintOptions ¶
type PrintOptions struct { // supported Format types can be found in pkg/printers/printers.go OutputFormatType string OutputFormatArgument string NoHeaders bool WithNamespace bool WithKind bool Wide bool ShowAll 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 }
type ResourcePrinter ¶
type ResourcePrinter interface { // Print receives a runtime object, formats it and prints it to a writer. PrintObj(runtime.Object, io.Writer) error HandledResources() []string //Can be used to print out warning/clarifications if needed //after all objects were printed AfterPrint(io.Writer, string) error // Identify if it is a generic printer IsGeneric() bool }
ResourcePrinter is an interface that knows how to print runtime objects.
func GetStandardPrinter ¶
func GetStandardPrinter(typer runtime.ObjectTyper, encoder runtime.Encoder, decoders []runtime.Decoder, options PrintOptions) (ResourcePrinter, error)
GetStandardPrinter takes a format type, an optional format argument. It will return a printer or an error. The printer is agnostic to schema versions, so you must send arguments to PrintObj in the version you wish them to be shown using a VersionedPrinter (typically when generic is true).
func NewVersionedPrinter ¶
func NewVersionedPrinter(printer ResourcePrinter, converter runtime.ObjectConvertor, typer runtime.ObjectTyper, versions ...schema.GroupVersion) ResourcePrinter
NewVersionedPrinter wraps a printer to convert objects to a known API version prior to printing.
type ResourcePrinterFunc ¶
ResourcePrinterFunc is a function that can print objects
func (ResourcePrinterFunc) AfterPrint ¶
func (fn ResourcePrinterFunc) AfterPrint(io.Writer, string) error
func (ResourcePrinterFunc) HandledResources ¶
func (fn ResourcePrinterFunc) HandledResources() []string
TODO: implement HandledResources()
func (ResourcePrinterFunc) IsGeneric ¶ added in v1.7.0
func (fn ResourcePrinterFunc) IsGeneric() bool
type TablePrinter ¶ added in v1.7.0
type TablePrinter interface {
PrintTable(obj runtime.Object, options PrintOptions) (*metav1beta1.Table, error)
}
type VersionedPrinter ¶
type VersionedPrinter struct {
// contains filtered or unexported fields
}
VersionedPrinter takes runtime objects and ensures they are converted to a given API version prior to being passed to a nested printer.
func (*VersionedPrinter) AfterPrint ¶
func (p *VersionedPrinter) AfterPrint(w io.Writer, res string) error
func (*VersionedPrinter) HandledResources ¶
func (p *VersionedPrinter) HandledResources() []string
TODO: implement HandledResources()
func (*VersionedPrinter) IsGeneric ¶ added in v1.7.0
func (p *VersionedPrinter) IsGeneric() bool
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) AfterPrint ¶
func (p *YAMLPrinter) AfterPrint(w io.Writer, res string) error
func (*YAMLPrinter) HandledResources ¶
func (p *YAMLPrinter) HandledResources() []string
TODO: implement HandledResources()
func (*YAMLPrinter) IsGeneric ¶ added in v1.7.0
func (p *YAMLPrinter) IsGeneric() bool