plugin

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2020 License: Apache-2.0 Imports: 23 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checksum

type Checksum struct {
	Hasher hash.Hash
	Value  string
}

Checksum contains the hash function and the checksum we expect from a plugin.

type Command

type Command struct {
	Name        string `toml:"name" json:"name"`
	Path        string `toml:"path" json:"path"`
	Description string `toml:"description" json:"description"`
}

Command represents each item defined in the `commands` key of the `plugin.toml` file. It also contains JSON tags for the `dcos plugin list --json` command.

type ExistError

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

ExistError indicates that a plugin installation failed because it's already installed.

type InstallOpts

type InstallOpts struct {
	// Name specify the name of the plugin.
	Name string

	// Update allows to potentially overwrite an already existing plugin of the same name.
	Update bool

	// Checksum represents a CLI plugin resource content hash.
	Checksum Checksum

	ProgressBar *mpb.Progress

	// PostInstall is a hook which can be invoked after plugin installation.
	// It is invoked right before the plugin is moved to its final location.
	PostInstall func(fs afero.Fs, pluginDir string) error
	// contains filtered or unexported fields
}

InstallOpts are installation options for plugin resources.

type Manager

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

Manager retrieves the plugins available for the current cluster by navigating into the filesystem.

func NewManager

func NewManager(fs afero.Fs, logger *logrus.Logger) *Manager

NewManager returns a new plugin manager.

func (*Manager) Install

func (m *Manager) Install(resource string, installOpts *InstallOpts) (plugin *Plugin, err error)

Install installs a plugin from a resource.

func (*Manager) Plugin

func (m *Manager) Plugin(name string) (*Plugin, error)

Plugin finds a plugin identified by a given name.

func (*Manager) Plugins

func (m *Manager) Plugins() (plugins []*Plugin)

Plugins returns the plugins associated with the current cluster.

func (*Manager) Remove

func (m *Manager) Remove(name string) error

Remove removes a plugin from the filesystem.

func (*Manager) SetCluster

func (m *Manager) SetCluster(cluster *config.Cluster)

SetCluster sets the plugin manager's target cluster.

type Plugin

type Plugin struct {
	Name     string    `toml:"name" json:"name"`
	Commands []Command `toml:"commands" json:"commands"`
	// contains filtered or unexported fields
}

Plugin is the structure representation of a `plugin.toml file. It also contains JSON tags for the `dcos plugin list --json` command.

func (*Plugin) CommandNames

func (p *Plugin) CommandNames() (commands []string)

CommandNames returns the commands available in the plugin as a sorted list of names.

func (*Plugin) CompletionDir

func (p *Plugin) CompletionDir() string

CompletionDir returns the absolute path to the directory holding the plugin's completion script files

func (*Plugin) Dir

func (p *Plugin) Dir() string

Dir gives the path to the plugin's env directory on the filesystem.

Jump to

Keyboard shortcuts

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