apis

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TerminatingMessage = &MonitoringMessage{
	Box:     "terminating",
	Message: "terminating",
}

The terminating message. If this message will be send, the run command will shutdown all other start stop plugins and ends.

Functions

func IsLocalPlugin

func IsLocalPlugin(plugin InstallablePlugin) bool

IsLocalPlugin checks if the given plugin is a plugin that will be installed on the local system or configures the local system. In this case it returns true. Otherwise false.

Types

type InstallablePlugin

type InstallablePlugin interface {
	// Must return the name of the plugin. This name will also be used for single commands.
	fmt.Stringer

	// Installs the tools.
	// Should print information about the process.
	Install()

	// Updates the tools.
	// Should print information about the process.
	Update()

	// Uninstall the tools.
	// Should print information about the process.
	Uninstall(purge bool)

	Phase() Phase
}

InstallablePlugin is a plugin that can install/update/uninstall tools local or within minikube or both.

type InstallablePluginList

type InstallablePluginList []InstallablePlugin

InstallablePluginList is a simple slice which can be sorted by the install Phase.

func (InstallablePluginList) Len

func (l InstallablePluginList) Len() int

func (InstallablePluginList) Less

func (l InstallablePluginList) Less(i, j int) bool

func (InstallablePluginList) Swap

func (l InstallablePluginList) Swap(i, j int)

type InstallablePluginRegistry

type InstallablePluginRegistry interface {
	// AddPlugin adds a single plugin to the registry.
	AddPlugin(plugin InstallablePlugin)
	// AddPlugins adds the given list of plugins to the registry.
	AddPlugins(plugins ...InstallablePlugin)
	// ListPlugins returns a list of all currently registered plugins in the registry.
	ListPlugins() InstallablePluginList
	// FindPlugin tries to find and return a plugin with the given name. Otherwise it would return an error.
	FindPlugin(name string) (InstallablePlugin, error)
}

InstallablePluginRegistry is the registry which collects all InstallablePlugins and provides easy access to them.

type MonitoringMessage

type MonitoringMessage struct {
	Box     string
	Message string
}

The message type for notifying the run cli command about new status and monitoring messages from the plugin.

func CloneMonitoringMessage

func CloneMonitoringMessage(message *MonitoringMessage) MonitoringMessage

CloneMonitoringMessage creates a copy of the given MonitoringMessage.

type Phase

type Phase int
const (
	LOCAL_TOOLS_INSTALL   Phase = 0
	LOCAL_TOOLS_CONFIG    Phase = 5
	CLUSTER_INIT          Phase = 10
	CLUSTER_CONFIG        Phase = 15
	CLUSTER_TOOLS_INSTALL Phase = 20
	CLUSTER_TOOLS_CONFIG  Phase = 25
)

type StartStopPlugin

type StartStopPlugin interface {
	// Must return the name of the plugin. This name will also be used for single commands.
	fmt.Stringer

	// Start the command and sets the channel used to show status and monitoring messages.
	// Returns a string that indicates the box name which is also present in the monitoring messages.
	Start(chan *MonitoringMessage) (boxName string, err error)

	// Stops the plugin for graceful shutdown.
	Stop() error

	// IsSingleRunnable determs if this plugin can be started using the "run <plugin>" command.
	IsSingleRunnable() bool
}

The StartStopPlugin interface defines the interface for all plugins of the "run" command. They uses a channel to send new status updates which are shown by the "run" command.

type StartStopPluginRegistry

type StartStopPluginRegistry interface {
	// AddPlugin adds a single plugin to the registry.
	AddPlugin(plugin StartStopPlugin)
	// AddPlugins adds the given list of plugins to the registry.
	AddPlugins(plugins ...StartStopPlugin)
	// ListPlugins returns a list of all currently registered plugins in the registry.
	ListPlugins() []StartStopPlugin
	// FindPlugin tries to find and return a plugin with the given name. Otherwise it would return an error.
	FindPlugin(name string) (StartStopPlugin, error)
}

StartStopPluginRegistry is the registry which collects all StartStopPlugins and provides easy access to them.

Jump to

Keyboard shortcuts

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