pluginaction

package
v6.28.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2017 License: Apache-2.0 Imports: 14 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)

DownloadBinaryFromURL 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) IsPluginInstalled

func (actor Actor) IsPluginInstalled(pluginName string) bool

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 AddPluginRepositoryError

type AddPluginRepositoryError struct {
	Name    string
	URL     string
	Message string
}

func (AddPluginRepositoryError) Error

func (e AddPluginRepositoryError) Error() string

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 FetchingPluginInfoFromRepositoryError

type FetchingPluginInfoFromRepositoryError struct {
	RepositoryName string
	Err            error
}

FetchingPluginInfoFromRepositoryError is returned an error is encountered getting plugin info from a repository

func (FetchingPluginInfoFromRepositoryError) Error

type GettingPluginRepositoryError

type GettingPluginRepositoryError struct {
	Name    string
	Message string
}

GettingPluginRepositoryError is returned when there's an error accessing the plugin repository

func (GettingPluginRepositoryError) Error

type NoCompatibleBinaryError

type NoCompatibleBinaryError struct {
}

NoCompatibleBinaryError is returned when a repository contains a specified plugin but not for the specified platform

func (NoCompatibleBinaryError) Error

func (e NoCompatibleBinaryError) Error() string

type OutdatedPlugin

type OutdatedPlugin struct {
	Name           string
	CurrentVersion string
	LatestVersion  string
}

type PluginBinaryRemoveFailedError

type PluginBinaryRemoveFailedError struct {
	Err error
}

PluginBinaryRemoveFailedError is returned when running the plugin binary fails.

func (PluginBinaryRemoveFailedError) Error

type PluginClient

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

type PluginCommandsConflictError

type PluginCommandsConflictError struct {
	PluginName     string
	PluginVersion  string
	CommandAliases []string
	CommandNames   []string
}

PluginCommandConflictError is returned when a plugin command name conflicts with a core or existing plugin command name.

func (PluginCommandsConflictError) Error

type PluginExecuteError

type PluginExecuteError struct {
	Err error
}

PluginExecuteError is returned when running the plugin binary fails.

func (PluginExecuteError) Error

func (p PluginExecuteError) Error() string

type PluginInfo

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

type PluginInvalidError

type PluginInvalidError struct {
	Err error
}

PluginInvalidError is returned with a plugin is invalid because it is missing a name or has 0 commands.

func (PluginInvalidError) Error

func (_ PluginInvalidError) Error() string

type PluginMetadata

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

type PluginNotFoundError

type PluginNotFoundError struct {
	PluginName string
}

PluginNotFoundError is an error returned when a plugin is not found.

func (PluginNotFoundError) Error

func (e PluginNotFoundError) Error() string

Error outputs a plugin not found error message.

type PluginNotFoundInAnyRepositoryError

type PluginNotFoundInAnyRepositoryError struct {
	PluginName string
}

PluginNotFoundInAnyRepositoryError is an error returned when a plugin cannot be found in any repositories.

func (PluginNotFoundInAnyRepositoryError) Error

Error outputs that the plugin cannot be found in any repositories.

type PluginNotFoundInRepositoryError

type PluginNotFoundInRepositoryError struct {
	PluginName     string
	RepositoryName string
}

PluginNotFoundInRepositoryError is an error returned when a plugin is not found.

func (PluginNotFoundInRepositoryError) Error

Error outputs the plugin not found in repository error message.

type PluginUninstaller

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

type RepositoryAlreadyExistsError

type RepositoryAlreadyExistsError struct {
	Name string
	URL  string
}

func (RepositoryAlreadyExistsError) Error

type RepositoryNameTakenError

type RepositoryNameTakenError struct {
	Name string
}

func (RepositoryNameTakenError) Error

func (e RepositoryNameTakenError) Error() string

type RepositoryNotRegisteredError

type RepositoryNotRegisteredError struct {
	Name string
}

func (RepositoryNotRegisteredError) 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