Documentation ¶
Overview ¶
Package pluginaction handles all operations related to plugin commands
Index ¶
- type Actor
- func (actor Actor) AddPluginRepository(repoName string, repoURL string) error
- func (actor Actor) CreateExecutableCopy(path string, tempPluginDir string) (string, error)
- func (actor Actor) DownloadExecutableBinaryFromURL(pluginURL string, tempPluginDir string, proxyReader plugin.ProxyReader) (string, error)
- func (actor Actor) FileExists(path string) bool
- func (actor Actor) GetAndValidatePlugin(pluginMetadata PluginMetadata, commandList CommandList, path string) (configv3.Plugin, error)
- func (actor Actor) GetOutdatedPlugins() ([]OutdatedPlugin, error)
- func (actor Actor) GetPlatformString(runtimeGOOS string, runtimeGOARCH string) string
- func (actor Actor) GetPluginInfoFromRepositoriesForPlatform(pluginName string, pluginRepos []configv3.PluginRepository, platform string) (PluginInfo, []string, error)
- func (actor Actor) GetPluginRepository(repositoryName string) (configv3.PluginRepository, error)
- func (actor Actor) InstallPluginFromPath(path string, plugin configv3.Plugin) error
- func (actor Actor) IsPluginInstalled(pluginName string) bool
- func (actor Actor) IsPluginRepositoryRegistered(repositoryName string) bool
- func (actor Actor) UninstallPlugin(uninstaller PluginUninstaller, name string) error
- func (actor Actor) ValidateFileChecksum(path string, checksum string) bool
- type AddPluginRepositoryError
- type CommandList
- type Config
- type FetchingPluginInfoFromRepositoryError
- type GettingPluginRepositoryError
- type NoCompatibleBinaryError
- type OutdatedPlugin
- type PluginBinaryRemoveFailedError
- type PluginClient
- type PluginCommandsConflictError
- type PluginExecuteError
- type PluginInfo
- type PluginInvalidError
- type PluginMetadata
- type PluginNotFoundError
- type PluginNotFoundInAnyRepositoryError
- type PluginNotFoundInRepositoryError
- type PluginUninstaller
- type RepositoryAlreadyExistsError
- type RepositoryNameTakenError
- type RepositoryNotRegisteredError
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) CreateExecutableCopy ¶
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 ¶
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 ¶
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) IsPluginInstalled ¶
func (Actor) IsPluginRepositoryRegistered ¶
func (Actor) UninstallPlugin ¶
func (actor Actor) UninstallPlugin(uninstaller PluginUninstaller, name string) error
type AddPluginRepositoryError ¶
func (AddPluginRepositoryError) Error ¶
func (e AddPluginRepositoryError) Error() string
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 ¶
FetchingPluginInfoFromRepositoryError is returned an error is encountered getting plugin info from a repository
func (FetchingPluginInfoFromRepositoryError) Error ¶
func (e FetchingPluginInfoFromRepositoryError) Error() string
type GettingPluginRepositoryError ¶
GettingPluginRepositoryError is returned when there's an error accessing the plugin repository
func (GettingPluginRepositoryError) Error ¶
func (e GettingPluginRepositoryError) Error() string
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 PluginBinaryRemoveFailedError ¶
type PluginBinaryRemoveFailedError struct {
Err error
}
PluginBinaryRemoveFailedError is returned when running the plugin binary fails.
func (PluginBinaryRemoveFailedError) Error ¶
func (p PluginBinaryRemoveFailedError) Error() string
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 ¶
func (_ PluginCommandsConflictError) Error() string
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 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 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 ¶
func (e PluginNotFoundInAnyRepositoryError) Error() string
Error outputs that the plugin cannot be found in any repositories.
type PluginNotFoundInRepositoryError ¶
PluginNotFoundInRepositoryError is an error returned when a plugin is not found.
func (PluginNotFoundInRepositoryError) Error ¶
func (e PluginNotFoundInRepositoryError) Error() string
Error outputs the plugin not found in repository error message.
type PluginUninstaller ¶
type RepositoryAlreadyExistsError ¶
func (RepositoryAlreadyExistsError) Error ¶
func (e RepositoryAlreadyExistsError) Error() string
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 ¶
func (e RepositoryNotRegisteredError) Error() string