pluginaction

package
v6.43.1-1+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package pluginaction handles all operations related to plugin commands

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Actor

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

Actor handles all plugin actions

func NewActor

func NewActor(config Config, client PluginClient) *Actor

NewActor returns a pluginaction Actor

func (Actor) AddPluginRepository

func (actor Actor) AddPluginRepository(repoName string, repoURL string) error

func (Actor) CreateExecutableCopy

func (actor Actor) CreateExecutableCopy(path string, tempPluginDir string) (string, error)

CreateExecutableCopy makes a temporary copy of a plugin binary and makes it executable.

config.PluginHome() + /temp is used as the temp dir instead of the system temp for security reasons.

func (Actor) DownloadExecutableBinaryFromURL

func (actor Actor) DownloadExecutableBinaryFromURL(pluginURL string, tempPluginDir string, proxyReader plugin.ProxyReader) (string, error)

DownloadExecutableBinaryFromURL fetches a plugin binary from the specified URL, if it exists.

func (Actor) FileExists

func (actor Actor) FileExists(path string) bool

FileExists returns true if the file exists. It returns false if the file doesn't exist or there is an error checking.

func (Actor) GetAndValidatePlugin

func (actor Actor) GetAndValidatePlugin(pluginMetadata PluginMetadata, commandList CommandList, path string) (configv3.Plugin, error)

func (Actor) GetOutdatedPlugins

func (actor Actor) GetOutdatedPlugins() ([]OutdatedPlugin, error)

func (Actor) GetPlatformString

func (actor Actor) GetPlatformString(runtimeGOOS string, runtimeGOARCH string) string

GetPlatformString exists solely for the purposes of mocking it out for command-layers tests.

func (Actor) GetPluginInfoFromRepositoriesForPlatform

func (actor Actor) GetPluginInfoFromRepositoriesForPlatform(pluginName string, pluginRepos []configv3.PluginRepository, platform string) (PluginInfo, []string, error)

GetPluginInfoFromRepositoriesForPlatform returns the newest version of the specified plugin and all the repositories that contain that version.

func (Actor) GetPluginRepository

func (actor Actor) GetPluginRepository(repositoryName string) (configv3.PluginRepository, error)

func (Actor) InstallPluginFromPath

func (actor Actor) InstallPluginFromPath(path string, plugin configv3.Plugin) error

func (Actor) IsPluginRepositoryRegistered

func (actor Actor) IsPluginRepositoryRegistered(repositoryName string) bool

func (Actor) UninstallPlugin

func (actor Actor) UninstallPlugin(uninstaller PluginUninstaller, name string) error

func (Actor) ValidateFileChecksum

func (actor Actor) ValidateFileChecksum(path string, checksum string) bool

type CommandList

type CommandList interface {
	HasCommand(string) bool
	HasAlias(string) bool
}

type Config

type Config interface {
	AddPlugin(configv3.Plugin)
	AddPluginRepository(repoName string, repoURL string)
	GetPlugin(pluginName string) (configv3.Plugin, bool)
	PluginHome() string
	PluginRepositories() []configv3.PluginRepository
	Plugins() []configv3.Plugin
	RemovePlugin(string)
	WritePluginConfig() error
}

Config is a way of getting basic CF configuration

type OutdatedPlugin

type OutdatedPlugin struct {
	Name           string
	CurrentVersion string
	LatestVersion  string
}

type PluginClient

type PluginClient interface {
	GetPluginRepository(repositoryURL string) (plugin.PluginRepository, error)
	DownloadPlugin(pluginURL string, path string, proxyReader plugin.ProxyReader) error
}

type PluginInfo

type PluginInfo struct {
	Name     string
	Version  string
	URL      string
	Checksum string
}

type PluginMetadata

type PluginMetadata interface {
	GetMetadata(pluginPath string) (configv3.Plugin, error)
}

type PluginUninstaller

type PluginUninstaller interface {
	Run(pluginPath string, command string) error
}

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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