kubernetes: k8s.io/kubernetes/pkg/kubectl/cmd/get Index | Files

package get

import "k8s.io/kubernetes/pkg/kubectl/cmd/get"

Index

Package Files

customcolumn.go customcolumn_flags.go get.go get_flags.go humanreadable_flags.go skip_printer.go sorter.go table_printer.go

func NewCmdGet Uses

func NewCmdGet(parent string, f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command

NewCmdGet creates a command object for the generic "get" action, which retrieves one or more resources from a server.

func RelaxedJSONPathExpression Uses

func RelaxedJSONPathExpression(pathExpression string) (string, error)

RelaxedJSONPathExpression attempts to be flexible with JSONPath expressions, it accepts:

* metadata.name (no leading '.' or curly braces '{...}'
* {metadata.name} (no leading '.')
* .metadata.name (no curly braces '{...}')
* {.metadata.name} (complete expression)

And transforms them all into a valid jsonpath expression:

{.metadata.name}

type Column Uses

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 Uses

type CustomColumnsPrintFlags struct {
    NoHeaders        bool
    TemplateArgument string
}

CustomColumnsPrintFlags provides default flags necessary for printing custom resource columns from an inline-template or file.

func NewCustomColumnsPrintFlags Uses

func NewCustomColumnsPrintFlags() *CustomColumnsPrintFlags

NewCustomColumnsPrintFlags returns flags associated with custom-column printing, with default values set. NoHeaders and TemplateArgument should be set by callers.

func (*CustomColumnsPrintFlags) AddFlags Uses

func (f *CustomColumnsPrintFlags) AddFlags(c *cobra.Command)

AddFlags receives a *cobra.Command reference and binds flags related to custom-columns printing

func (*CustomColumnsPrintFlags) AllowedFormats Uses

func (f *CustomColumnsPrintFlags) AllowedFormats() []string

func (*CustomColumnsPrintFlags) ToPrinter Uses

func (f *CustomColumnsPrintFlags) ToPrinter(templateFormat string) (printers.ResourcePrinter, 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 Uses

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 Uses

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 Uses

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) PrintObj Uses

func (s *CustomColumnsPrinter) PrintObj(obj runtime.Object, out io.Writer) error

type GetOptions Uses

type GetOptions struct {
    PrintFlags             *PrintFlags
    ToPrinter              func(*meta.RESTMapping, *bool, bool, bool) (printers.ResourcePrinterFunc, error)
    IsHumanReadablePrinter bool
    PrintWithOpenAPICols   bool

    CmdParent string

    resource.FilenameOptions

    Raw       string
    Watch     bool
    WatchOnly bool
    ChunkSize int64

    OutputWatchEvents bool

    LabelSelector     string
    FieldSelector     string
    AllNamespaces     bool
    Namespace         string
    ExplicitNamespace bool

    ServerPrint bool

    NoHeaders      bool
    Sort           bool
    IgnoreNotFound bool
    Export         bool

    genericclioptions.IOStreams
}

GetOptions contains the input to the get command.

func NewGetOptions Uses

func NewGetOptions(parent string, streams genericclioptions.IOStreams) *GetOptions

NewGetOptions returns a GetOptions with default chunk size 500.

func (*GetOptions) Complete Uses

func (o *GetOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error

Complete takes the command arguments and factory and infers any remaining options.

func (*GetOptions) Run Uses

func (o *GetOptions) Run(f cmdutil.Factory, cmd *cobra.Command, args []string) error

Run performs the get operation. TODO: remove the need to pass these arguments, like other commands.

func (*GetOptions) Validate Uses

func (o *GetOptions) Validate(cmd *cobra.Command) error

Validate checks the set of flags provided by the user.

type HumanPrintFlags Uses

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 Uses

func NewHumanPrintFlags() *HumanPrintFlags

NewHumanPrintFlags returns flags associated with human-readable printing, with default values set.

func (*HumanPrintFlags) AddFlags Uses

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) AllowedFormats Uses

func (f *HumanPrintFlags) AllowedFormats() []string

AllowedFormats returns more customized formating options

func (*HumanPrintFlags) EnsureWithKind Uses

func (f *HumanPrintFlags) EnsureWithKind() error

EnsureWithKind sets the "Showkind" humanreadable option to true.

func (*HumanPrintFlags) EnsureWithNamespace Uses

func (f *HumanPrintFlags) EnsureWithNamespace() error

EnsureWithNamespace sets the "WithNamespace" humanreadable option to true.

func (*HumanPrintFlags) SetKind Uses

func (f *HumanPrintFlags) SetKind(kind schema.GroupKind)

SetKind sets the Kind option

func (*HumanPrintFlags) ToPrinter Uses

func (f *HumanPrintFlags) ToPrinter(outputFormat string) (printers.ResourcePrinter, error)

ToPrinter receives an outputFormat and returns a printer capable of handling human-readable output.

type NopPositioner Uses

type NopPositioner struct{}

NopPositioner and OriginalPositioner is required for swap/sort operations of data in table format

func (*NopPositioner) OriginalPosition Uses

func (t *NopPositioner) OriginalPosition(ix int) int

OriginalPosition returns the original position from NopPositioner object

type OriginalPositioner Uses

type OriginalPositioner interface {
    OriginalPosition(int) int
}

OriginalPositioner and NopPositioner is required for swap/sort operations of data in table format

type PrintFlags Uses

type PrintFlags struct {
    JSONYamlPrintFlags *genericclioptions.JSONYamlPrintFlags
    NamePrintFlags     *genericclioptions.NamePrintFlags
    CustomColumnsFlags *CustomColumnsPrintFlags
    HumanReadableFlags *HumanPrintFlags
    TemplateFlags      *genericclioptions.KubeTemplatePrintFlags

    NoHeaders    *bool
    OutputFormat *string
}

PrintFlags composes common printer flag structs used in the Get command.

func NewGetPrintFlags Uses

func NewGetPrintFlags() *PrintFlags

NewGetPrintFlags returns flags associated with humanreadable, template, and "name" printing, with default values set.

func (*PrintFlags) AddFlags Uses

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

AddFlags receives a *cobra.Command reference and binds flags related to humanreadable and template printing.

func (*PrintFlags) AllowedFormats Uses

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

AllowedFormats is the list of formats in which data can be displayed

func (*PrintFlags) Copy Uses

func (f *PrintFlags) Copy() PrintFlags

Copy returns a copy of PrintFlags for mutation

func (*PrintFlags) EnsureWithKind Uses

func (f *PrintFlags) EnsureWithKind() error

EnsureWithKind ensures that humanreadable flags return a printer capable of including resource kinds.

func (*PrintFlags) EnsureWithNamespace Uses

func (f *PrintFlags) EnsureWithNamespace() error

EnsureWithNamespace ensures that humanreadable flags return a printer capable of printing with a "namespace" column.

func (*PrintFlags) SetKind Uses

func (f *PrintFlags) SetKind(kind schema.GroupKind)

SetKind sets the Kind option of humanreadable flags

func (*PrintFlags) ToPrinter Uses

func (f *PrintFlags) ToPrinter() (printers.ResourcePrinter, error)

ToPrinter attempts to find a composed set of PrintFlags suitable for returning a printer based on current flag values.

func (*PrintFlags) UseOpenAPIColumns Uses

func (f *PrintFlags) UseOpenAPIColumns(api openapi.Resources, mapping *meta.RESTMapping) error

UseOpenAPIColumns modifies the output format, as well as the "allowMissingKeys" option for template printers, to values defined in the OpenAPI schema of a resource.

type RuntimeSort Uses

type RuntimeSort struct {
    // contains filtered or unexported fields
}

RuntimeSort is an implementation of the golang sort interface that knows how to sort lists of runtime.Object

func NewRuntimeSort Uses

func NewRuntimeSort(field string, objs []runtime.Object) *RuntimeSort

func SortObjects Uses

func SortObjects(decoder runtime.Decoder, objs []runtime.Object, fieldInput string) (*RuntimeSort, error)

func (*RuntimeSort) Len Uses

func (r *RuntimeSort) Len() int

func (*RuntimeSort) Less Uses

func (r *RuntimeSort) Less(i, j int) bool

func (*RuntimeSort) OriginalPosition Uses

func (r *RuntimeSort) OriginalPosition(ix int) int

OriginalPosition returns the starting (original) position of a particular index. e.g. If OriginalPosition(0) returns 5 than the the item currently at position 0 was at position 5 in the original unsorted array.

func (*RuntimeSort) Swap Uses

func (r *RuntimeSort) Swap(i, j int)

type RuntimeSorter Uses

type RuntimeSorter struct {
    // contains filtered or unexported fields
}

RuntimeSorter holds the required objects to perform sorting of runtime objects

func NewRuntimeSorter Uses

func NewRuntimeSorter(objects []runtime.Object, sortBy string) *RuntimeSorter

NewRuntimeSorter returns a new instance of RuntimeSorter

func (*RuntimeSorter) OriginalPosition Uses

func (r *RuntimeSorter) OriginalPosition(ix int) int

OriginalPosition returns the original position of a runtime object

func (*RuntimeSorter) Sort Uses

func (r *RuntimeSorter) Sort() error

Sort performs the sorting of runtime objects

func (*RuntimeSorter) WithDecoder Uses

func (r *RuntimeSorter) WithDecoder(decoder runtime.Decoder) *RuntimeSorter

WithDecoder allows custom decoder to be set for testing

type SortingPrinter Uses

type SortingPrinter struct {
    SortField string
    Delegate  printers.ResourcePrinter
    Decoder   runtime.Decoder
}

SortingPrinter sorts list types before delegating to another printer. Non-list types are simply passed through

func (*SortingPrinter) PrintObj Uses

func (s *SortingPrinter) PrintObj(obj runtime.Object, out io.Writer) error

type TablePrinter Uses

type TablePrinter struct {
    Delegate printers.ResourcePrinter
}

TablePrinter decodes table objects into typed objects before delegating to another printer. Non-table types are simply passed through

func (*TablePrinter) PrintObj Uses

func (t *TablePrinter) PrintObj(obj runtime.Object, writer io.Writer) error

type TableSorter Uses

type TableSorter struct {
    // contains filtered or unexported fields
}

func NewTableSorter Uses

func NewTableSorter(table *metav1beta1.Table, field string) (*TableSorter, error)

func (*TableSorter) Len Uses

func (t *TableSorter) Len() int

func (*TableSorter) Less Uses

func (t *TableSorter) Less(i, j int) bool

func (*TableSorter) Sort Uses

func (t *TableSorter) Sort() error

func (*TableSorter) Swap Uses

func (t *TableSorter) Swap(i, j int)

Package get imports 45 packages (graph) and is imported by 12 packages. Updated 2019-07-19. Refresh now. Tools for package owners.