kubernetes: k8s.io/kubernetes/cmd/kubeadm/app/util/output Index | Files

package output

import "k8s.io/kubernetes/cmd/kubeadm/app/util/output"

Index

Package Files

output.go

Constants

const TextOutput = "text"

TextOutput describes the plain text output

type PrintFlags Uses

type PrintFlags struct {
    // JSONYamlPrintFlags provides default flags necessary for json/yaml printing.
    JSONYamlPrintFlags *genericclioptions.JSONYamlPrintFlags
    // KubeTemplatePrintFlags composes print flags that provide both a JSONPath and a go-template printer.
    KubeTemplatePrintFlags *genericclioptions.KubeTemplatePrintFlags
    // JSONYamlPrintFlags provides default flags necessary for kubeadm text printing.
    TextPrintFlags TextPrintFlags
    // TypeSetterPrinter is an implementation of ResourcePrinter that wraps another printer with types set on the objects
    TypeSetterPrinter *printers.TypeSetterPrinter
    // OutputFormat contains currently set output format
    OutputFormat *string
}

PrintFlags composes common printer flag structs used across kubeadm commands, and provides a method of retrieving a known printer based on flag values provided.

func NewOutputFlags Uses

func NewOutputFlags(textPrintFlags TextPrintFlags) *PrintFlags

NewOutputFlags creates new KubeadmOutputFlags

func (*PrintFlags) AddFlags Uses

func (pf *PrintFlags) AddFlags(cmd *cobra.Command)

AddFlags receives a *cobra.Command reference and binds flags related to Kubeadm printing to it

func (*PrintFlags) AllowedFormats Uses

func (pf *PrintFlags) AllowedFormats() []string

AllowedFormats returns list of allowed output formats

func (*PrintFlags) ToPrinter Uses

func (pf *PrintFlags) ToPrinter() (Printer, error)

ToPrinter receives an outputFormat and returns a printer capable of handling format printing. Returns error if the specified outputFormat does not match supported formats.

func (*PrintFlags) WithDefaultOutput Uses

func (pf *PrintFlags) WithDefaultOutput(outputFormat string) *PrintFlags

WithDefaultOutput sets a default output format if one is not provided through a flag value

func (*PrintFlags) WithTypeSetter Uses

func (pf *PrintFlags) WithTypeSetter(scheme *runtime.Scheme) *PrintFlags

WithTypeSetter sets a wrapper than will surround the returned printer with a printer to type resources

type Printer Uses

type Printer interface {
    PrintObj(obj runtime.Object, writer io.Writer) error
    Fprintf(writer io.Writer, format string, args ...interface{}) (n int, err error)
    Printf(format string, args ...interface{}) (n int, err error)
}

Printer is a common printing interface in Kubeadm

func NewResourcePrinterWrapper Uses

func NewResourcePrinterWrapper(resourcePrinter printers.ResourcePrinter, err error) (Printer, error)

NewResourcePrinterWrapper creates new ResourcePrinter object

type ResourcePrinterWrapper Uses

type ResourcePrinterWrapper struct {
    Printer printers.ResourcePrinter
}

ResourcePrinterWrapper wraps ResourcePrinter and implements Printer interface

func (*ResourcePrinterWrapper) Fprintf Uses

func (rpw *ResourcePrinterWrapper) Fprintf(writer io.Writer, format string, args ...interface{}) (n int, err error)

Fprintf is an empty method to satisfy Printer interface and silent info printing for structured output This method is usually redefined for the text output

func (*ResourcePrinterWrapper) PrintObj Uses

func (rpw *ResourcePrinterWrapper) PrintObj(obj runtime.Object, writer io.Writer) error

PrintObj is an implementation of ResourcePrinter.PrintObj that calls underlying printer API

func (*ResourcePrinterWrapper) Printf Uses

func (rpw *ResourcePrinterWrapper) Printf(format string, args ...interface{}) (n int, err error)

Printf is an empty method to satisfy Printer interface and silent info printing for structured output This method is usually redefined for the text output

type TextPrintFlags Uses

type TextPrintFlags interface {
    ToPrinter(outputFormat string) (Printer, error)
}

TextPrintFlags is an iterface to handle custom text output

type TextPrinter Uses

type TextPrinter struct {
}

TextPrinter implements Printer interface for generic text output

func (*TextPrinter) Fprintf Uses

func (tp *TextPrinter) Fprintf(writer io.Writer, format string, args ...interface{}) (n int, err error)

Fprintf is a wrapper around fmt.Fprintf

func (*TextPrinter) PrintObj Uses

func (tp *TextPrinter) PrintObj(obj runtime.Object, writer io.Writer) error

PrintObj is an implementation of ResourcePrinter.PrintObj that prints object

func (*TextPrinter) Printf Uses

func (tp *TextPrinter) Printf(format string, args ...interface{}) (n int, err error)

Printf is a wrapper around fmt.Printf

Package output imports 7 packages (graph) and is imported by 3 packages. Updated 2019-10-21. Refresh now. Tools for package owners.