plugin

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package plugin provides functionality for loading and managing HashiCorp plugins from individual config.yml files in plugin directories.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertEnvVariablesFromProto

func ConvertEnvVariablesFromProto(protoEnvVars []*protobuff.EnvVariable) []*protobuff.EnvVariable

ConvertEnvVariablesFromProto converts protobuf environment variables to extensions environment variables

func ConvertGraphQLSchemaToProto

func ConvertGraphQLSchemaToProto(schema *protobuff.ThirdPartyGraphQLSchemas) (*protobuff.ThirdPartyGraphQLSchemas, error)

ConvertGraphQLSchemaToProto converts protobuf GraphQL schema to protobuf format (passthrough)

func ConvertProtoRestApisToLocal

func ConvertProtoRestApisToLocal(protoApis []*protobuff.ThirdPartyRESTApi) []*protobuff.ThirdPartyRESTApi

ConvertProtoRestApisToLocal converts protobuf REST APIs to local format (passthrough)

func ConvertRestApisToProto

func ConvertRestApisToProto(apis []*protobuff.ThirdPartyRESTApi) []*protobuff.ThirdPartyRESTApi

ConvertRestApisToProto converts protobuf REST APIs to protobuf format (passthrough)

func LoadHashiCorpPluginRegistry

func LoadHashiCorpPluginRegistry(cfg *models.Config) (map[string]*protobuff.PluginDetails, error)

func LoadHashiCorpPluginRegistryFromYAML

func LoadHashiCorpPluginRegistryFromYAML(cfg *models.Config) (map[string]*protobuff.PluginDetails, error)

LoadHashiCorpPluginRegistryFromYAML loads plugin configurations from individual config.yml files

Types

type HashiCorpNormalPluginGRPC

type HashiCorpNormalPluginGRPC struct {
	hcplugin.NetRPCUnsupportedPlugin

	Impl interfaces.HashiCorpPluginInterface
	// contains filtered or unexported fields
}

HashiCorpNormalPluginGRPC is the gRPC implementation for normal plugins

func (*HashiCorpNormalPluginGRPC) Execute

func (p *HashiCorpNormalPluginGRPC) Execute(ctx context.Context, functionName, functionType string, args map[string]interface{}, contextData map[string]interface{}) (*protobuff.ExecuteResponse, error)

Execute calls the plugin's Execute method for function/resolver execution

func (*HashiCorpNormalPluginGRPC) GRPCClient

func (p *HashiCorpNormalPluginGRPC) GRPCClient(ctx context.Context, broker *hcplugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

GRPCClient implementation

func (*HashiCorpNormalPluginGRPC) GRPCServer

func (p *HashiCorpNormalPluginGRPC) GRPCServer(broker *hcplugin.GRPCBroker, s *grpc.Server) error

GRPCServer implementation

func (*HashiCorpNormalPluginGRPC) GetVersion

func (p *HashiCorpNormalPluginGRPC) GetVersion(ctx context.Context) (string, error)

func (*HashiCorpNormalPluginGRPC) Init

func (*HashiCorpNormalPluginGRPC) Migration

func (p *HashiCorpNormalPluginGRPC) Migration(ctx context.Context) error

func (*HashiCorpNormalPluginGRPC) RESTApiRegister

func (*HashiCorpNormalPluginGRPC) SchemaRegister

type HashiCorpNormalPluginGRPCServer

type HashiCorpNormalPluginGRPCServer struct {
	protobuff.UnimplementedPluginServiceServer
	Impl interfaces.HashiCorpPluginInterface
	// contains filtered or unexported fields
}

HashiCorpNormalPluginGRPCServer is the gRPC server implementation for normal plugins

func (*HashiCorpNormalPluginGRPCServer) GetVersion

func (*HashiCorpNormalPluginGRPCServer) Init

func (*HashiCorpNormalPluginGRPCServer) Migration

func (*HashiCorpNormalPluginGRPCServer) RESTApiRegister

func (*HashiCorpNormalPluginGRPCServer) SchemaRegister

type HashiCorpPluginManager

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

HashiCorpPluginManager handles lifecycle operations for HashiCorp plugins

func NewHashiCorpPluginManager

func NewHashiCorpPluginManager() *HashiCorpPluginManager

NewHashiCorpPluginManager creates a new plugin manager

func (*HashiCorpPluginManager) GetAllPlugins

func (pm *HashiCorpPluginManager) GetAllPlugins() map[string]*models.HashiCorpPluginCache

GetAllPlugins returns all registered plugins

func (*HashiCorpPluginManager) GetPlugin

func (pm *HashiCorpPluginManager) GetPlugin(pluginID string) (*models.HashiCorpPluginCache, bool)

GetPlugin retrieves a plugin from the cache

func (*HashiCorpPluginManager) GetPluginMetrics

func (pm *HashiCorpPluginManager) GetPluginMetrics(pluginID string) (*PluginMetrics, error)

GetPluginMetrics collects metrics for a specific plugin

func (*HashiCorpPluginManager) GetPluginsByType

func (pm *HashiCorpPluginManager) GetPluginsByType(pluginType protobuff.PluginType) []*models.HashiCorpPluginCache

GetPluginsByType returns all plugins of a specific type

func (*HashiCorpPluginManager) HealthCheckAllPlugins

func (pm *HashiCorpPluginManager) HealthCheckAllPlugins(ctx context.Context) map[string]*PluginHealthCheck

HealthCheckAllPlugins performs health checks on all registered plugins

func (*HashiCorpPluginManager) HealthCheckPlugin

func (pm *HashiCorpPluginManager) HealthCheckPlugin(ctx context.Context, pluginID string) (*PluginHealthCheck, error)

HealthCheckPlugin performs a health check on a specific plugin

func (*HashiCorpPluginManager) RegisterPlugin

func (pm *HashiCorpPluginManager) RegisterPlugin(pluginID string, cache *models.HashiCorpPluginCache)

RegisterPlugin adds a plugin to the cache

func (*HashiCorpPluginManager) RestartPlugin

func (pm *HashiCorpPluginManager) RestartPlugin(ctx context.Context, pluginID string, details *protobuff.PluginDetails) error

RestartPlugin attempts to restart a failed plugin

func (*HashiCorpPluginManager) ShutdownAllPlugins

func (pm *HashiCorpPluginManager) ShutdownAllPlugins() error

ShutdownAllPlugins gracefully shuts down all plugins

func (*HashiCorpPluginManager) UnregisterPlugin

func (pm *HashiCorpPluginManager) UnregisterPlugin(pluginID string) error

UnregisterPlugin removes a plugin from the cache and cleans up

func (*HashiCorpPluginManager) ValidatePlugin

func (pm *HashiCorpPluginManager) ValidatePlugin(ctx context.Context, pluginID string) error

ValidatePlugin checks if a plugin is properly configured and functional

type PluginHealthCheck

type PluginHealthCheck struct {
	Status      string `json:"status"`
	Message     string `json:"message"`
	LastChecked int64  `json:"last_checked"`
}

PluginHealthCheck represents the health status of a plugin

type PluginMetrics

type PluginMetrics struct {
	RequestCount    int64   `json:"request_count"`
	ErrorCount      int64   `json:"error_count"`
	AverageLatency  float64 `json:"average_latency"`
	LastRequestTime int64   `json:"last_request_time"`
	MemoryUsage     int64   `json:"memory_usage"`
}

PluginMetrics represents metrics collected for a plugin

type YAMLEnvVar

type YAMLEnvVar struct {
	Key   string `yaml:"key"`
	Value string `yaml:"value"`
}

YAMLEnvVar represents an environment variable in YAML

type YAMLHandshakeConfig

type YAMLHandshakeConfig struct {
	ProtocolVersion  int32  `yaml:"protocol_version"`
	MagicCookieKey   string `yaml:"magic_cookie_key"`
	MagicCookieValue string `yaml:"magic_cookie_value"`
}

YAMLHandshakeConfig represents the handshake configuration in YAML

type YAMLPlugin

type YAMLPlugin struct {
	ID               string              `yaml:"id"`
	Language         string              `yaml:"language"`
	Title            string              `yaml:"title"`
	Icon             string              `yaml:"icon"`
	Description      string              `yaml:"description"`
	Type             string              `yaml:"type"`
	Role             string              `yaml:"role"`
	ExportedVariable string              `yaml:"exported_variable"`
	Enable           bool                `yaml:"enable"`
	Debug            bool                `yaml:"debug"`
	Version          string              `yaml:"version"`
	Author           string              `yaml:"author"`
	RepositoryURL    string              `yaml:"repository_url"`
	Branch           string              `yaml:"branch"`
	BinaryPath       string              `yaml:"binary_path"`
	HandshakeConfig  YAMLHandshakeConfig `yaml:"handshake_config"`
	UIConfig         *YAMLUIConfig       `yaml:"ui_config,omitempty"`
	EnvVars          []YAMLEnvVar        `yaml:"env_vars"`
}

YAMLPlugin represents a single plugin configuration in YAML

type YAMLPluginConfig

type YAMLPluginConfig struct {
	Plugin YAMLPlugin `yaml:"plugin"`
}

YAMLPluginConfig represents the structure of the individual plugin config.yml file

type YAMLUIConfig added in v1.1.8

type YAMLUIConfig struct {
	EntryPath string `yaml:"entry_path"`
}

YAMLUIConfig represents the UI configuration in YAML

Jump to

Keyboard shortcuts

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