Documentation ¶
Index ¶
- Constants
- Variables
- func DoesBinaryExist(path string) bool
- func DownloadBinary(ctx context.Context, destPath string, url URL) error
- func GenerateKubeConfig(restCfg *rest.Config, clusterName string, pluginCtx config.PluginContext, ...) ([]byte, error)
- func IsNotFoundError(err error) bool
- func NewPluginLoggers(bkLogger logrus.FieldLogger, logConfig config.Logger, pluginKey string, ...) (hclog.Logger, io.Writer, io.Writer)
- type Collector
- type Dependencies
- type Dependency
- type Index
- type IndexBuilder
- type IndexEntry
- type IndexURL
- type IndexURLPlatform
- type JSONSchema
- type KubeConfigInput
- type Manager
- type NotFoundPluginError
- type TmpDir
- type Type
- type URL
Constants ¶
const (
// DependencyDirEnvName define environment variable where plugin dependency binaries are stored.
DependencyDirEnvName = "PLUGIN_DEPENDENCY_DIR"
)
Variables ¶
var ErrNotStartedPluginManager = errors.New("plugin manager is not started yet")
ErrNotStartedPluginManager is an error returned when Plugin Manager was not yet started and initialized successfully.
Functions ¶
func DoesBinaryExist ¶ added in v0.18.0
DoesBinaryExist returns true if a given file exists.
func DownloadBinary ¶ added in v0.18.0
DownloadBinary downloads binary into specific destination.
func GenerateKubeConfig ¶ added in v1.0.0
func GenerateKubeConfig(restCfg *rest.Config, clusterName string, pluginCtx config.PluginContext, input KubeConfigInput) ([]byte, error)
func IsNotFoundError ¶
IsNotFoundError returns true if one of the error in the chain is the not found error instance.
func NewPluginLoggers ¶
func NewPluginLoggers(bkLogger logrus.FieldLogger, logConfig config.Logger, pluginKey string, pluginType Type) (hclog.Logger, io.Writer, io.Writer)
NewPluginLoggers returns a copy of parent with a log settings dedicated for a given plugin. The log level is taken from the environment variable with a pattern: LOG_LEVEL_{pluginType}_{pluginRepo}_{pluginName}. If env variable is not set, default value is "info". Loggers: - hashicorp client logger always has the configured log level - binary standard output is logged only if debug level is set, otherwise it is discarded - binary standard error is logged always on error level
Types ¶
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector provides functionality to collect all enabled plugins based on the Botkube configuration.
func NewCollector ¶
func NewCollector(log logrus.FieldLogger) *Collector
NewCollector returns a new Collector instance.
type Dependencies ¶ added in v0.18.0
type Dependencies map[string]Dependency
Dependencies holds the dependencies for a given platform binary.
type Dependency ¶ added in v0.18.0
type Dependency struct {
URL string `yaml:"url"`
}
Dependency holds the dependency information.
type Index ¶
type Index struct {
Entries []IndexEntry `yaml:"entries"`
}
Index defines the plugin repository index.
type IndexBuilder ¶
type IndexBuilder struct {
// contains filtered or unexported fields
}
IndexBuilder provides functionality to generate plugin index.
func NewIndexBuilder ¶
func NewIndexBuilder(log logrus.FieldLogger) *IndexBuilder
NewIndexBuilder returns a new IndexBuilder instance.
type IndexEntry ¶
type IndexEntry struct { Name string `yaml:"name"` Type Type `yaml:"type"` Description string `yaml:"description"` Version string `yaml:"version"` URLs []IndexURL `yaml:"urls"` JSONSchema JSONSchema `yaml:"jsonSchema"` }
IndexEntry defines the plugin definition.
type IndexURL ¶
type IndexURL struct { URL string `yaml:"url"` Checksum string `yaml:"checksum"` Platform IndexURLPlatform `yaml:"platform"` Dependencies Dependencies `yaml:"dependencies,omitempty"` }
IndexURL holds the binary url details.
type IndexURLPlatform ¶
IndexURLPlatform holds platform information about a given binary URL.
type JSONSchema ¶ added in v0.18.0
type KubeConfigInput ¶ added in v1.0.0
type KubeConfigInput struct {
Channel string
}
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager provides functionality for managing executor and source plugins.
func NewManager ¶
func NewManager(logger logrus.FieldLogger, logCfg config.Logger, cfg config.PluginManagement, executors, sources []string) *Manager
NewManager returns a new Manager instance.
func (*Manager) GetExecutor ¶
GetExecutor returns the executor client for a given plugin.
type NotFoundPluginError ¶
type NotFoundPluginError struct {
// contains filtered or unexported fields
}
NotFoundPluginError is an error returned when a given Plugin cannot be found in a given repository.
func NewNotFoundPluginError ¶
func NewNotFoundPluginError(msg string, args ...any) *NotFoundPluginError
NewNotFoundPluginError return a new NotFoundPluginError instance.
func (NotFoundPluginError) Error ¶
func (n NotFoundPluginError) Error() string
Error returns the error message.
func (*NotFoundPluginError) Is ¶
func (n *NotFoundPluginError) Is(target error) bool
Is returns true if target is not found error.