kubeplug

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func App

func App(app Application)

App is a helper to run an Application with Do by components

func Do

func Do(description command.Describer, plugger Plugger, moreFlags ...command.CmdFlagger)

Do sets up everything for a Describer, Plugger and Flaggers, and parses the cobra command The plugger is then run with the setup Plug Use this method when you want separate components for part or want more than one flagger If your struct implements all interfaces in one place, use App()

Types

type Application

type Application interface {
	Plugger
	command.Describer
	command.CmdFlagger
}

Application collects all the interface components needed to start an application as a kubectl plugin

type Plug

type Plug struct {
	Client client.Client

	// Common flagsets
	ConfigFlags   *genericclioptions.ConfigFlags
	PrintFlags    *genericclioptions.PrintFlags
	ResourceFlags *genericclioptions.ResourceBuilderFlags

	// Current Printer and IO options
	Printer printers.ResourcePrinter
	IO      genericclioptions.IOStreams

	// Color typesetter for the cli output
	CLI aurora.Aurora

	// Commonly used flags values
	Namespace string

	// Arguments remaining passed to the cli
	Args []string
}

Plug is a wrapper around a k8s client, corbra, cli-runtime, and cli based IO that help make fully featured kubectl plugins a Plug will be setup and passed to a Plugger interface to use for application based logic

func (*Plug) Decorate

func (p *Plug) Decorate(arg interface{})

Decorate runs Message only if attached to a CLI and adds the faint modifier

func (*Plug) DecorateLn

func (p *Plug) DecorateLn(arg interface{})

DecorateLn runs MessageLn only if attached to a CLI and adds the faint modifier

func (*Plug) Message

func (p *Plug) Message(arg interface{})

Message to outputs stderr. Used for cli output that could also be thought of as logs

func (*Plug) MessageFail

func (p *Plug) MessageFail(arg interface{})

MessageFail outputs MessageLn to stderr and then os.Exit(1)

func (*Plug) MessageGreen

func (p *Plug) MessageGreen(arg interface{})

MessageGreen outputs a green colored message

func (*Plug) MessageGreenLn

func (p *Plug) MessageGreenLn(arg interface{})

MessageGreenLn outputs a green colored message with a new line appended

func (*Plug) MessageLn

func (p *Plug) MessageLn(arg interface{})

MessageLn outputs to stderr with a new line appended. Used for cli output that could also be thought of as logs

func (*Plug) MessageRed

func (p *Plug) MessageRed(arg interface{})

MessageRed outputs a red colored message

func (*Plug) MessageRedLn

func (p *Plug) MessageRedLn(arg interface{})

MessageRedLn outputs a red colored message with a new line appended

func (*Plug) Output

func (p *Plug) Output(arg interface{})

Output to stdout. Used for non message log lines (outputting yaml etc)

func (*Plug) PrintList

func (p *Plug) PrintList(list runtime.Object, w io.Writer)

PrintList wraps printing List type resource objects in various formats based on the output type given

func (*Plug) ResourceVisitor

func (p *Plug) ResourceVisitor(resources ...string) resource.Visitor

ResourceVisitor returns a cli-runtime Visitor for listing resources in a functional way

type Plugger

type Plugger interface {
	Run(plug *Plug)
}

Plugger defines an interface that accepts a setup Plug

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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