cmd

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2016 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create added in v1.3.0

func Create(info *resource.Info, namespace string, obj runtime.Object) (runtime.Object, error)

Create is the default create operation for a generic resource.

func CreateMessage added in v1.3.0

func CreateMessage(labels map[string]string) string

func NewPrintErrorAfter added in v1.0.7

func NewPrintErrorAfter(mapper meta.RESTMapper, errs io.Writer) func(*resource.Info, error) bool

func NoOp added in v1.3.0

func NoOp(info *resource.Info, namespace string, obj runtime.Object) (runtime.Object, error)

Types

type AfterFunc added in v1.0.8

type AfterFunc func(*resource.Info, error) bool

AfterFunc takes an info and an error, and returns true if processing should stop.

func HaltOnError added in v1.0.8

func HaltOnError(fn AfterFunc) AfterFunc

func NewPrintNameOrErrorAfter

func NewPrintNameOrErrorAfter(mapper meta.RESTMapper, short bool, operation string, out, errs io.Writer) AfterFunc

func NewPrintNameOrErrorAfterIndent added in v1.0.7

func NewPrintNameOrErrorAfterIndent(mapper meta.RESTMapper, short bool, operation string, out, errs io.Writer, indent string) AfterFunc

type Bulk

type Bulk struct {
	Mapper Mapper

	Op    OpFunc
	After AfterFunc
	Retry RetryFunc
}

Bulk provides helpers for iterating over a list of items

func (*Bulk) Run added in v1.3.0

func (b *Bulk) Run(list *kapi.List, namespace string) []error

Create attempts to create each item generically, gathering all errors in the event a failure occurs. The contents of list will be updated to include the version from the server.

type BulkAction added in v1.3.0

type BulkAction struct {
	// required setup
	Bulk        Bulk
	Out, ErrOut io.Writer

	// flags
	Output      string
	DryRun      bool
	StopOnError bool

	// output modifiers
	Action string
}

func (*BulkAction) BindForAction added in v1.3.0

func (b *BulkAction) BindForAction(flags *pflag.FlagSet)

BindForAction sets flags on this action for when setting -o should only change how the operation results are displayed. Passing -o is changing the default output format.

func (*BulkAction) BindForOutput added in v1.3.0

func (b *BulkAction) BindForOutput(flags *pflag.FlagSet)

BindForOutput sets flags on this action for when setting -o will not execute the action (the point of the action is primarily to generate the output). Passing -o is asking for output, not execution.

func (*BulkAction) Compact added in v1.3.0

func (b *BulkAction) Compact()

Compact sets the output to a minimal set

func (*BulkAction) DefaultIndent added in v1.3.0

func (b *BulkAction) DefaultIndent() string

func (*BulkAction) Run added in v1.3.0

func (b *BulkAction) Run(list *kapi.List, namespace string) []error

func (*BulkAction) ShouldPrint added in v1.3.0

func (b *BulkAction) ShouldPrint() bool

ShouldPrint returns true if an external printer should handle this action instead of execution.

func (*BulkAction) Verbose added in v1.3.0

func (b *BulkAction) Verbose() bool

func (BulkAction) WithMessage added in v1.3.0

func (b BulkAction) WithMessage(action, individual string) Runner

type Mapper added in v1.3.0

type Mapper interface {
	meta.RESTMapper
	InfoForObject(obj runtime.Object, preferredGVKs []unversioned.GroupVersionKind) (*resource.Info, error)
}

Mapper is an interface testability that is equivalent to resource.Mapper

type OpFunc added in v1.3.0

type OpFunc func(info *resource.Info, namespace string, obj runtime.Object) (runtime.Object, error)

OpFunc takes the provided info and attempts to perform the operation

type RetryFunc added in v1.3.0

type RetryFunc func(info *resource.Info, err error) runtime.Object

RetryFunc can retry the operation a single time by returning a non-nil object. TODO: make this a more general retry "loop" function rather than one time.

type Runner added in v1.3.0

type Runner interface {
	Run(list *kapi.List, namespace string) []error
}

Jump to

Keyboard shortcuts

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