Documentation
¶
Overview ¶
Package plugin provides functionality for loading and managing HashiCorp plugins from individual config.yml files in plugin directories.
Index ¶
- func ConvertEnvVariablesFromProto(protoEnvVars []*protobuff.EnvVariable) []*protobuff.EnvVariable
- func ConvertGraphQLSchemaToProto(schema *protobuff.ThirdPartyGraphQLSchemas) (*protobuff.ThirdPartyGraphQLSchemas, error)
- func ConvertProtoRestApisToLocal(protoApis []*protobuff.ThirdPartyRESTApi) []*protobuff.ThirdPartyRESTApi
- func ConvertRestApisToProto(apis []*protobuff.ThirdPartyRESTApi) []*protobuff.ThirdPartyRESTApi
- func LoadHashiCorpPluginRegistry(cfg *models.Config) (map[string]*protobuff.PluginDetails, error)
- func LoadHashiCorpPluginRegistryFromYAML(cfg *models.Config) (map[string]*protobuff.PluginDetails, error)
- type HashiCorpNormalPluginGRPC
- func (p *HashiCorpNormalPluginGRPC) Execute(ctx context.Context, functionName, functionType string, ...) (*protobuff.ExecuteResponse, error)
- func (p *HashiCorpNormalPluginGRPC) GRPCClient(ctx context.Context, broker *hcplugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
- func (p *HashiCorpNormalPluginGRPC) GRPCServer(broker *hcplugin.GRPCBroker, s *grpc.Server) error
- func (p *HashiCorpNormalPluginGRPC) GetVersion(ctx context.Context) (string, error)
- func (p *HashiCorpNormalPluginGRPC) Init(ctx context.Context, env []*protobuff.EnvVariable) error
- func (p *HashiCorpNormalPluginGRPC) Migration(ctx context.Context) error
- func (p *HashiCorpNormalPluginGRPC) RESTApiRegister(ctx context.Context) ([]*protobuff.ThirdPartyRESTApi, error)
- func (p *HashiCorpNormalPluginGRPC) SchemaRegister(ctx context.Context) (*protobuff.ThirdPartyGraphQLSchemas, error)
- type HashiCorpNormalPluginGRPCServer
- func (s *HashiCorpNormalPluginGRPCServer) GetVersion(ctx context.Context, req *protobuff.GetVersionRequest) (*protobuff.GetVersionResponse, error)
- func (s *HashiCorpNormalPluginGRPCServer) Init(ctx context.Context, req *protobuff.InitRequest) (*protobuff.InitResponse, error)
- func (s *HashiCorpNormalPluginGRPCServer) Migration(ctx context.Context, req *protobuff.MigrationRequest) (*protobuff.MigrationResponse, error)
- func (s *HashiCorpNormalPluginGRPCServer) RESTApiRegister(ctx context.Context, req *protobuff.RESTApiRegisterRequest) (*protobuff.RESTApiRegisterResponse, error)
- func (s *HashiCorpNormalPluginGRPCServer) SchemaRegister(ctx context.Context, req *protobuff.SchemaRegisterRequest) (*protobuff.SchemaRegisterResponse, error)
- type HashiCorpPluginManager
- func (pm *HashiCorpPluginManager) GetAllPlugins() map[string]*models.HashiCorpPluginCache
- func (pm *HashiCorpPluginManager) GetPlugin(pluginID string) (*models.HashiCorpPluginCache, bool)
- func (pm *HashiCorpPluginManager) GetPluginMetrics(pluginID string) (*PluginMetrics, error)
- func (pm *HashiCorpPluginManager) GetPluginsByType(pluginType protobuff.PluginType) []*models.HashiCorpPluginCache
- func (pm *HashiCorpPluginManager) HealthCheckAllPlugins(ctx context.Context) map[string]*PluginHealthCheck
- func (pm *HashiCorpPluginManager) HealthCheckPlugin(ctx context.Context, pluginID string) (*PluginHealthCheck, error)
- func (pm *HashiCorpPluginManager) RegisterPlugin(pluginID string, cache *models.HashiCorpPluginCache)
- func (pm *HashiCorpPluginManager) RestartPlugin(ctx context.Context, pluginID string, details *protobuff.PluginDetails) error
- func (pm *HashiCorpPluginManager) ShutdownAllPlugins() error
- func (pm *HashiCorpPluginManager) UnregisterPlugin(pluginID string) error
- func (pm *HashiCorpPluginManager) ValidatePlugin(ctx context.Context, pluginID string) error
- type PluginHealthCheck
- type PluginMetrics
- type YAMLEnvVar
- type YAMLHandshakeConfig
- type YAMLPlugin
- type YAMLPluginConfig
- type YAMLUIConfig
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 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 (p *HashiCorpNormalPluginGRPC) Init(ctx context.Context, env []*protobuff.EnvVariable) error
func (*HashiCorpNormalPluginGRPC) Migration ¶
func (p *HashiCorpNormalPluginGRPC) Migration(ctx context.Context) error
func (*HashiCorpNormalPluginGRPC) RESTApiRegister ¶
func (p *HashiCorpNormalPluginGRPC) RESTApiRegister(ctx context.Context) ([]*protobuff.ThirdPartyRESTApi, error)
func (*HashiCorpNormalPluginGRPC) SchemaRegister ¶
func (p *HashiCorpNormalPluginGRPC) SchemaRegister(ctx context.Context) (*protobuff.ThirdPartyGraphQLSchemas, error)
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 (s *HashiCorpNormalPluginGRPCServer) GetVersion(ctx context.Context, req *protobuff.GetVersionRequest) (*protobuff.GetVersionResponse, error)
func (*HashiCorpNormalPluginGRPCServer) Init ¶
func (s *HashiCorpNormalPluginGRPCServer) Init(ctx context.Context, req *protobuff.InitRequest) (*protobuff.InitResponse, error)
func (*HashiCorpNormalPluginGRPCServer) Migration ¶
func (s *HashiCorpNormalPluginGRPCServer) Migration(ctx context.Context, req *protobuff.MigrationRequest) (*protobuff.MigrationResponse, error)
func (*HashiCorpNormalPluginGRPCServer) RESTApiRegister ¶
func (s *HashiCorpNormalPluginGRPCServer) RESTApiRegister(ctx context.Context, req *protobuff.RESTApiRegisterRequest) (*protobuff.RESTApiRegisterResponse, error)
func (*HashiCorpNormalPluginGRPCServer) SchemaRegister ¶
func (s *HashiCorpNormalPluginGRPCServer) SchemaRegister(ctx context.Context, req *protobuff.SchemaRegisterRequest) (*protobuff.SchemaRegisterResponse, error)
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 ¶
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