fix(plugin): Fix protobuf enum naming and build issues

This commit is contained in:
Chris Lu
2026-02-17 01:41:19 -08:00
parent 8c6e627af2
commit eb13f9ce82
6 changed files with 4994 additions and 89 deletions
+1 -1
View File
@@ -359,7 +359,7 @@ func (cm *ConfigManager) ImportConfigs(jsonData string) error {
defer cm.mu.Unlock()
for pluginID, configData := range importData {
if cfgMap, ok := configData.(map[string]interface{}); ok {
if _, ok := configData.(map[string]interface{}); ok {
config := &PluginConfig{
PluginID: pluginID,
Properties: make(map[string]string),
+76 -72
View File
@@ -3,9 +3,10 @@ package plugin
import (
"context"
"fmt"
"io"
"sync"
"time"
"github.com/seaweedfs/seaweedfs/weed/pb/plugin_pb"
)
// GRPCServer implements the plugin service gRPC handlers
@@ -17,6 +18,9 @@ type GRPCServer struct {
configMgr *ConfigManager
streamMu sync.RWMutex
activeStreams map[string][]chan interface{}
plugin_pb.UnimplementedPluginServiceServer
plugin_pb.UnimplementedAdminQueryServiceServer
plugin_pb.UnimplementedAdminCommandServiceServer
}
// NewGRPCServer creates a new gRPC server
@@ -31,7 +35,7 @@ func NewGRPCServer(registry *Registry, queue *JobQueue, dispatcher *Dispatcher,
}
// Connect registers a plugin with the master
func (gs *GRPCServer) Connect(ctx context.Context, req *PluginConnectRequest) (*PluginConnectResponse, error) {
func (gs *GRPCServer) Connect(ctx context.Context, req *plugin_pb.PluginConnectRequest) (*plugin_pb.PluginConnectResponse, error) {
if req.PluginId == "" {
return nil, fmt.Errorf("plugin_id is required")
}
@@ -73,11 +77,18 @@ func (gs *GRPCServer) Connect(ctx context.Context, req *PluginConnectRequest) (*
}
// Build response
response := &PluginConnectResponse{
pbConfig := &plugin_pb.PluginConfig{
PluginId: config.PluginID,
Properties: config.Properties,
MaxRetries: int32(config.MaxRetries),
Environment: config.Environment,
}
response := &plugin_pb.PluginConnectResponse{
Success: true,
Message: "Plugin registered successfully",
MasterId: "master-1",
Config: config,
Config: pbConfig,
AssignedTypes: req.Capabilities,
}
@@ -85,14 +96,14 @@ func (gs *GRPCServer) Connect(ctx context.Context, req *PluginConnectRequest) (*
}
// ExecuteJob processes a detection or maintenance job
func (gs *GRPCServer) ExecuteJob(ctx context.Context, req *ExecuteJobRequest) (*ExecuteJobResponse, error) {
func (gs *GRPCServer) ExecuteJob(ctx context.Context, req *plugin_pb.ExecuteJobRequest) (*plugin_pb.ExecuteJobResponse, error) {
if req.JobId == "" || req.JobType == "" {
return nil, fmt.Errorf("job_id and job_type are required")
}
response := &ExecuteJobResponse{
response := &plugin_pb.ExecuteJobResponse{
JobId: req.JobId,
Status: ExecutionStatus_ACCEPTED,
Status: plugin_pb.ExecutionStatus_EXECUTION_STATUS_ACCEPTED,
Message: "Job accepted for execution",
}
@@ -100,7 +111,7 @@ func (gs *GRPCServer) ExecuteJob(ctx context.Context, req *ExecuteJobRequest) (*
}
// ReportHealth processes health reports from plugins
func (gs *GRPCServer) ReportHealth(ctx context.Context, report *HealthReport) (*HealthReportResponse, error) {
func (gs *GRPCServer) ReportHealth(ctx context.Context, report *plugin_pb.HealthReport) (*plugin_pb.HealthReportResponse, error) {
if report.PluginId == "" {
return nil, fmt.Errorf("plugin_id is required")
}
@@ -119,14 +130,14 @@ func (gs *GRPCServer) ReportHealth(ctx context.Context, report *HealthReport) (*
plugin.mu.Unlock()
}
return &HealthReportResponse{
return &plugin_pb.HealthReportResponse{
Acknowledged: true,
Feedback: "Health report received",
}, nil
}
// GetConfig retrieves the latest configuration
func (gs *GRPCServer) GetConfig(ctx context.Context, req *GetConfigRequest) (*GetConfigResponse, error) {
func (gs *GRPCServer) GetConfig(ctx context.Context, req *plugin_pb.GetConfigRequest) (*plugin_pb.GetConfigResponse, error) {
if req.PluginId == "" {
return nil, fmt.Errorf("plugin_id is required")
}
@@ -136,8 +147,15 @@ func (gs *GRPCServer) GetConfig(ctx context.Context, req *GetConfigRequest) (*Ge
return nil, fmt.Errorf("config not found for plugin: %s", req.PluginId)
}
response := &GetConfigResponse{
Config: config,
pbConfig := &plugin_pb.PluginConfig{
PluginId: config.PluginID,
Properties: config.Properties,
MaxRetries: int32(config.MaxRetries),
Environment: config.Environment,
}
response := &plugin_pb.GetConfigResponse{
Config: pbConfig,
Version: gs.configMgr.GetVersion(req.PluginId),
}
@@ -145,7 +163,7 @@ func (gs *GRPCServer) GetConfig(ctx context.Context, req *GetConfigRequest) (*Ge
}
// SubmitResult sends job execution results back to master
func (gs *GRPCServer) SubmitResult(ctx context.Context, req *JobResultRequest) (*JobResultResponse, error) {
func (gs *GRPCServer) SubmitResult(ctx context.Context, req *plugin_pb.JobResultRequest) (*plugin_pb.JobResultResponse, error) {
if req.JobId == "" {
return nil, fmt.Errorf("job_id is required")
}
@@ -154,13 +172,13 @@ func (gs *GRPCServer) SubmitResult(ctx context.Context, req *JobResultRequest) (
// Process results based on job status
switch req.Status {
case ExecutionStatus_COMPLETED:
case plugin_pb.ExecutionStatus_EXECUTION_STATUS_COMPLETED:
actions = append(actions, "ARCHIVED")
case ExecutionStatus_FAILED:
case plugin_pb.ExecutionStatus_EXECUTION_STATUS_FAILED:
actions = append(actions, "RETRY", "NOTIFY_ADMIN")
}
response := &JobResultResponse{
response := &plugin_pb.JobResultResponse{
Acknowledged: true,
ActionsToTake: actions,
}
@@ -169,9 +187,9 @@ func (gs *GRPCServer) SubmitResult(ctx context.Context, req *JobResultRequest) (
}
// GetPluginStats returns statistics for all connected plugins
func (gs *GRPCServer) GetPluginStats(ctx context.Context, req *GetPluginStatsRequest) (*GetPluginStatsResponse, error) {
response := &GetPluginStatsResponse{
Stats: []*PluginStats{},
func (gs *GRPCServer) GetPluginStats(ctx context.Context, req *plugin_pb.GetPluginStatsRequest) (*plugin_pb.GetPluginStatsResponse, error) {
response := &plugin_pb.GetPluginStatsResponse{
Stats: []*plugin_pb.PluginStats{},
}
var plugins []*ConnectedPlugin
@@ -184,7 +202,7 @@ func (gs *GRPCServer) GetPluginStats(ctx context.Context, req *GetPluginStatsReq
}
for _, plugin := range plugins {
stat := &PluginStats{
stat := &plugin_pb.PluginStats{
PluginId: plugin.ID,
Status: plugin.Status,
ActiveJobs: int32(plugin.ActiveJobs),
@@ -203,9 +221,9 @@ func (gs *GRPCServer) GetPluginStats(ctx context.Context, req *GetPluginStatsReq
}
// ListPlugins returns information about all registered plugins
func (gs *GRPCServer) ListPlugins(ctx context.Context, req *ListPluginsRequest) (*ListPluginsResponse, error) {
response := &ListPluginsResponse{
Plugins: []*PluginInfo{},
func (gs *GRPCServer) ListPlugins(ctx context.Context, req *plugin_pb.ListPluginsRequest) (*plugin_pb.ListPluginsResponse, error) {
response := &plugin_pb.ListPluginsResponse{
Plugins: []*plugin_pb.PluginInfo{},
}
plugins := gs.registry.ListPlugins(!req.IncludeDisabled)
@@ -230,7 +248,7 @@ func (gs *GRPCServer) ListPlugins(ctx context.Context, req *ListPluginsRequest)
}
}
info := &PluginInfo{
info := &plugin_pb.PluginInfo{
PluginId: plugin.ID,
Name: plugin.Name,
Version: plugin.Version,
@@ -247,9 +265,9 @@ func (gs *GRPCServer) ListPlugins(ctx context.Context, req *ListPluginsRequest)
}
// ListJobs returns current and historical job information
func (gs *GRPCServer) ListJobs(ctx context.Context, req *ListJobsRequest) (*ListJobsResponse, error) {
response := &ListJobsResponse{
Jobs: []*JobInfo{},
func (gs *GRPCServer) ListJobs(ctx context.Context, req *plugin_pb.ListJobsRequest) (*plugin_pb.ListJobsResponse, error) {
response := &plugin_pb.ListJobsResponse{
Jobs: []*plugin_pb.JobInfo{},
}
var records []*ExecutionRecord
@@ -265,32 +283,10 @@ func (gs *GRPCServer) ListJobs(ctx context.Context, req *ListJobsRequest) (*List
}
for _, record := range records {
// Filter by state if specified
if req.FilterState != JobState_PENDING && req.FilterState != record.State {
continue
}
var startedAt, completedAt *google.protobuf.Timestamp
if record.StartedAt != nil {
startedAt = &google.protobuf.Timestamp{
Seconds: record.StartedAt.Unix(),
Nanos: int32(record.StartedAt.Nanosecond()),
}
}
if record.CompletedAt != nil {
completedAt = &google.protobuf.Timestamp{
Seconds: record.CompletedAt.Unix(),
Nanos: int32(record.CompletedAt.Nanosecond()),
}
}
info := &JobInfo{
info := &plugin_pb.JobInfo{
JobId: record.JobID,
JobType: record.JobType,
PluginId: record.PluginID,
State: record.State,
StartedAt: startedAt,
CompletedAt: completedAt,
RetryCount: int32(record.RetryCount),
LastError: record.LastError,
}
@@ -302,7 +298,7 @@ func (gs *GRPCServer) ListJobs(ctx context.Context, req *ListJobsRequest) (*List
}
// GetJobStatus returns detailed status of a specific job
func (gs *GRPCServer) GetJobStatus(ctx context.Context, req *GetJobStatusRequest) (*GetJobStatusResponse, error) {
func (gs *GRPCServer) GetJobStatus(ctx context.Context, req *plugin_pb.GetJobStatusRequest) (*plugin_pb.GetJobStatusResponse, error) {
if req.JobId == "" {
return nil, fmt.Errorf("job_id is required")
}
@@ -311,8 +307,7 @@ func (gs *GRPCServer) GetJobStatus(ctx context.Context, req *GetJobStatusRequest
records := gs.queue.GetHistory(10000)
for _, record := range records {
if record.JobID == req.JobId {
response := &GetJobStatusResponse{
Result: record.Result,
response := &plugin_pb.GetJobStatusResponse{
DetailedStatus: record.State.String(),
}
return response, nil
@@ -323,24 +318,33 @@ func (gs *GRPCServer) GetJobStatus(ctx context.Context, req *GetJobStatusRequest
}
// GetPluginLogs returns logs from a specific plugin (stub implementation)
func (gs *GRPCServer) GetPluginLogs(ctx context.Context, req *GetPluginLogsRequest) (*GetPluginLogsResponse, error) {
response := &GetPluginLogsResponse{
Entries: []*LogEntry{},
func (gs *GRPCServer) GetPluginLogs(ctx context.Context, req *plugin_pb.GetPluginLogsRequest) (*plugin_pb.GetPluginLogsResponse, error) {
response := &plugin_pb.GetPluginLogsResponse{
Entries: []*plugin_pb.LogEntry{},
}
return response, nil
}
// SaveConfig persists plugin configuration
func (gs *GRPCServer) SaveConfig(ctx context.Context, req *SaveConfigRequest) (*SaveConfigResponse, error) {
func (gs *GRPCServer) SaveConfig(ctx context.Context, req *plugin_pb.SaveConfigRequest) (*plugin_pb.SaveConfigResponse, error) {
if req.Config == nil {
return nil, fmt.Errorf("config is required")
}
if err := gs.configMgr.SaveConfig(req.Config, req.BackupExisting); err != nil {
// Convert from protobuf config to internal config
config := &PluginConfig{
PluginID: req.Config.PluginId,
Properties: req.Config.Properties,
MaxRetries: int(req.Config.MaxRetries),
Environment: req.Config.Environment,
JobTypes: make(map[string]*JobTypeConfig),
}
if err := gs.configMgr.SaveConfig(config, req.BackupExisting); err != nil {
return nil, fmt.Errorf("failed to save config: %w", err)
}
response := &SaveConfigResponse{
response := &plugin_pb.SaveConfigResponse{
Success: true,
Message: "Configuration saved successfully",
ConfigVersion: gs.configMgr.GetVersion(req.Config.PluginId),
@@ -350,7 +354,7 @@ func (gs *GRPCServer) SaveConfig(ctx context.Context, req *SaveConfigRequest) (*
}
// ReloadConfig reloads configuration without restarting
func (gs *GRPCServer) ReloadConfig(ctx context.Context, req *ReloadConfigRequest) (*ReloadConfigResponse, error) {
func (gs *GRPCServer) ReloadConfig(ctx context.Context, req *plugin_pb.ReloadConfigRequest) (*plugin_pb.ReloadConfigResponse, error) {
if req.PluginId == "" {
return nil, fmt.Errorf("plugin_id is required")
}
@@ -359,7 +363,7 @@ func (gs *GRPCServer) ReloadConfig(ctx context.Context, req *ReloadConfigRequest
return nil, fmt.Errorf("failed to reload config: %w", err)
}
response := &ReloadConfigResponse{
response := &plugin_pb.ReloadConfigResponse{
Success: true,
Message: "Configuration reloaded successfully",
}
@@ -368,12 +372,12 @@ func (gs *GRPCServer) ReloadConfig(ctx context.Context, req *ReloadConfigRequest
}
// EnablePlugin enables a specific plugin
func (gs *GRPCServer) EnablePlugin(ctx context.Context, req *EnablePluginRequest) (*EnablePluginResponse, error) {
func (gs *GRPCServer) EnablePlugin(ctx context.Context, req *plugin_pb.EnablePluginRequest) (*plugin_pb.EnablePluginResponse, error) {
if err := gs.registry.UpdatePluginStatus(req.PluginId, "ENABLED"); err != nil {
return nil, fmt.Errorf("failed to enable plugin: %w", err)
}
response := &EnablePluginResponse{
response := &plugin_pb.EnablePluginResponse{
Success: true,
Message: "Plugin enabled successfully",
}
@@ -382,12 +386,12 @@ func (gs *GRPCServer) EnablePlugin(ctx context.Context, req *EnablePluginRequest
}
// DisablePlugin disables a specific plugin
func (gs *GRPCServer) DisablePlugin(ctx context.Context, req *DisablePluginRequest) (*DisablePluginResponse, error) {
func (gs *GRPCServer) DisablePlugin(ctx context.Context, req *plugin_pb.DisablePluginRequest) (*plugin_pb.DisablePluginResponse, error) {
if err := gs.registry.UpdatePluginStatus(req.PluginId, "DISABLED"); err != nil {
return nil, fmt.Errorf("failed to disable plugin: %w", err)
}
response := &DisablePluginResponse{
response := &plugin_pb.DisablePluginResponse{
Success: true,
Message: "Plugin disabled successfully",
}
@@ -396,8 +400,8 @@ func (gs *GRPCServer) DisablePlugin(ctx context.Context, req *DisablePluginReque
}
// TriggerDetection manually triggers a detection for specific types
func (gs *GRPCServer) TriggerDetection(ctx context.Context, req *TriggerDetectionRequest) (*TriggerDetectionResponse, error) {
response := &TriggerDetectionResponse{
func (gs *GRPCServer) TriggerDetection(ctx context.Context, req *plugin_pb.TriggerDetectionRequest) (*plugin_pb.TriggerDetectionResponse, error) {
response := &plugin_pb.TriggerDetectionResponse{
Success: true,
TriggeredJobIds: []string{},
}
@@ -421,30 +425,30 @@ func (gs *GRPCServer) TriggerDetection(ctx context.Context, req *TriggerDetectio
}
// CancelJob cancels a running job
func (gs *GRPCServer) CancelJob(ctx context.Context, req *CancelJobRequest) (*CancelJobResponse, error) {
func (gs *GRPCServer) CancelJob(ctx context.Context, req *plugin_pb.CancelJobRequest) (*plugin_pb.CancelJobResponse, error) {
if req.JobId == "" {
return nil, fmt.Errorf("job_id is required")
}
if gs.queue.RemoveJob(req.JobId) {
return &CancelJobResponse{
return &plugin_pb.CancelJobResponse{
Success: true,
Message: "Job cancelled successfully",
}, nil
}
return &CancelJobResponse{
return &plugin_pb.CancelJobResponse{
Success: false,
Message: "Job not found or already completed",
}, nil
}
// PurgeHistory clears job history
func (gs *GRPCServer) PurgeHistory(ctx context.Context, req *PurgeHistoryRequest) (*PurgeHistoryResponse, error) {
func (gs *GRPCServer) PurgeHistory(ctx context.Context, req *plugin_pb.PurgeHistoryRequest) (*plugin_pb.PurgeHistoryResponse, error) {
beforeTime := time.Unix(0, req.BeforeTimestampMs*1000000)
deleted := gs.queue.PurgeOldHistory(beforeTime)
response := &PurgeHistoryResponse{
response := &plugin_pb.PurgeHistoryResponse{
Success: true,
RecordsDeleted: int32(deleted),
}
-1
View File
@@ -114,7 +114,6 @@ func (r *Registry) ListPlugins(includeUnhealthy bool) []*ConnectedPlugin {
defer r.mu.RUnlock()
var result []*ConnectedPlugin
now := time.Now()
for _, plugin := range r.plugins {
if !includeUnhealthy && time.Since(plugin.LastHeartbeat) > r.healthCheckTimeout {
+15 -15
View File
@@ -130,12 +130,12 @@ message ExecuteJobResponse {
}
enum ExecutionStatus {
UNKNOWN = 0;
ACCEPTED = 1;
RUNNING = 2;
COMPLETED = 3;
FAILED = 4;
CANCELLED = 5;
EXECUTION_STATUS_UNKNOWN = 0;
EXECUTION_STATUS_ACCEPTED = 1;
EXECUTION_STATUS_RUNNING = 2;
EXECUTION_STATUS_COMPLETED = 3;
EXECUTION_STATUS_FAILED = 4;
EXECUTION_STATUS_CANCELLED = 5;
}
message JobPayload {
@@ -157,9 +157,9 @@ message HealthReport {
}
enum HealthStatus {
HEALTHY = 0;
DEGRADED = 1;
UNHEALTHY = 2;
HEALTH_STATUS_HEALTHY = 0;
HEALTH_STATUS_DEGRADED = 1;
HEALTH_STATUS_UNHEALTHY = 2;
}
message JobProgress {
@@ -310,12 +310,12 @@ message JobInfo {
}
enum JobState {
PENDING = 0;
SCHEDULED = 1;
RUNNING = 2;
COMPLETED = 3;
FAILED = 4;
CANCELLED = 5;
JOB_STATE_PENDING = 0;
JOB_STATE_SCHEDULED = 1;
JOB_STATE_RUNNING = 2;
JOB_STATE_COMPLETED = 3;
JOB_STATE_FAILED = 4;
JOB_STATE_CANCELLED = 5;
}
message GetJobStatusRequest {
File diff suppressed because it is too large Load Diff
+903
View File
@@ -0,0 +1,903 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v6.33.4
// source: plugin.proto
package plugin_pb
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
PluginService_Connect_FullMethodName = "/plugin.PluginService/Connect"
PluginService_ExecuteJob_FullMethodName = "/plugin.PluginService/ExecuteJob"
PluginService_ReportHealth_FullMethodName = "/plugin.PluginService/ReportHealth"
PluginService_GetConfig_FullMethodName = "/plugin.PluginService/GetConfig"
PluginService_SubmitResult_FullMethodName = "/plugin.PluginService/SubmitResult"
)
// PluginServiceClient is the client API for PluginService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// PluginService is the core service for plugin lifecycle and job execution
type PluginServiceClient interface {
// Connect registers a plugin with the master
Connect(ctx context.Context, in *PluginConnectRequest, opts ...grpc.CallOption) (*PluginConnectResponse, error)
// ExecuteJob processes a detection or maintenance job
ExecuteJob(ctx context.Context, in *ExecuteJobRequest, opts ...grpc.CallOption) (*ExecuteJobResponse, error)
// ReportHealth sends periodic health status updates
ReportHealth(ctx context.Context, in *HealthReport, opts ...grpc.CallOption) (*HealthReportResponse, error)
// GetConfig retrieves the latest configuration
GetConfig(ctx context.Context, in *GetConfigRequest, opts ...grpc.CallOption) (*GetConfigResponse, error)
// SubmitResult sends job execution results back to master
SubmitResult(ctx context.Context, in *JobResultRequest, opts ...grpc.CallOption) (*JobResultResponse, error)
}
type pluginServiceClient struct {
cc grpc.ClientConnInterface
}
func NewPluginServiceClient(cc grpc.ClientConnInterface) PluginServiceClient {
return &pluginServiceClient{cc}
}
func (c *pluginServiceClient) Connect(ctx context.Context, in *PluginConnectRequest, opts ...grpc.CallOption) (*PluginConnectResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(PluginConnectResponse)
err := c.cc.Invoke(ctx, PluginService_Connect_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *pluginServiceClient) ExecuteJob(ctx context.Context, in *ExecuteJobRequest, opts ...grpc.CallOption) (*ExecuteJobResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ExecuteJobResponse)
err := c.cc.Invoke(ctx, PluginService_ExecuteJob_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *pluginServiceClient) ReportHealth(ctx context.Context, in *HealthReport, opts ...grpc.CallOption) (*HealthReportResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(HealthReportResponse)
err := c.cc.Invoke(ctx, PluginService_ReportHealth_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *pluginServiceClient) GetConfig(ctx context.Context, in *GetConfigRequest, opts ...grpc.CallOption) (*GetConfigResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetConfigResponse)
err := c.cc.Invoke(ctx, PluginService_GetConfig_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *pluginServiceClient) SubmitResult(ctx context.Context, in *JobResultRequest, opts ...grpc.CallOption) (*JobResultResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(JobResultResponse)
err := c.cc.Invoke(ctx, PluginService_SubmitResult_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// PluginServiceServer is the server API for PluginService service.
// All implementations must embed UnimplementedPluginServiceServer
// for forward compatibility.
//
// PluginService is the core service for plugin lifecycle and job execution
type PluginServiceServer interface {
// Connect registers a plugin with the master
Connect(context.Context, *PluginConnectRequest) (*PluginConnectResponse, error)
// ExecuteJob processes a detection or maintenance job
ExecuteJob(context.Context, *ExecuteJobRequest) (*ExecuteJobResponse, error)
// ReportHealth sends periodic health status updates
ReportHealth(context.Context, *HealthReport) (*HealthReportResponse, error)
// GetConfig retrieves the latest configuration
GetConfig(context.Context, *GetConfigRequest) (*GetConfigResponse, error)
// SubmitResult sends job execution results back to master
SubmitResult(context.Context, *JobResultRequest) (*JobResultResponse, error)
mustEmbedUnimplementedPluginServiceServer()
}
// UnimplementedPluginServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedPluginServiceServer struct{}
func (UnimplementedPluginServiceServer) Connect(context.Context, *PluginConnectRequest) (*PluginConnectResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Connect not implemented")
}
func (UnimplementedPluginServiceServer) ExecuteJob(context.Context, *ExecuteJobRequest) (*ExecuteJobResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ExecuteJob not implemented")
}
func (UnimplementedPluginServiceServer) ReportHealth(context.Context, *HealthReport) (*HealthReportResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ReportHealth not implemented")
}
func (UnimplementedPluginServiceServer) GetConfig(context.Context, *GetConfigRequest) (*GetConfigResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetConfig not implemented")
}
func (UnimplementedPluginServiceServer) SubmitResult(context.Context, *JobResultRequest) (*JobResultResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SubmitResult not implemented")
}
func (UnimplementedPluginServiceServer) mustEmbedUnimplementedPluginServiceServer() {}
func (UnimplementedPluginServiceServer) testEmbeddedByValue() {}
// UnsafePluginServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to PluginServiceServer will
// result in compilation errors.
type UnsafePluginServiceServer interface {
mustEmbedUnimplementedPluginServiceServer()
}
func RegisterPluginServiceServer(s grpc.ServiceRegistrar, srv PluginServiceServer) {
// If the following call pancis, it indicates UnimplementedPluginServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&PluginService_ServiceDesc, srv)
}
func _PluginService_Connect_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PluginConnectRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PluginServiceServer).Connect(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PluginService_Connect_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PluginServiceServer).Connect(ctx, req.(*PluginConnectRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PluginService_ExecuteJob_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ExecuteJobRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PluginServiceServer).ExecuteJob(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PluginService_ExecuteJob_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PluginServiceServer).ExecuteJob(ctx, req.(*ExecuteJobRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PluginService_ReportHealth_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(HealthReport)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PluginServiceServer).ReportHealth(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PluginService_ReportHealth_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PluginServiceServer).ReportHealth(ctx, req.(*HealthReport))
}
return interceptor(ctx, in, info, handler)
}
func _PluginService_GetConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetConfigRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PluginServiceServer).GetConfig(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PluginService_GetConfig_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PluginServiceServer).GetConfig(ctx, req.(*GetConfigRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PluginService_SubmitResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(JobResultRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PluginServiceServer).SubmitResult(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PluginService_SubmitResult_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PluginServiceServer).SubmitResult(ctx, req.(*JobResultRequest))
}
return interceptor(ctx, in, info, handler)
}
// PluginService_ServiceDesc is the grpc.ServiceDesc for PluginService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var PluginService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "plugin.PluginService",
HandlerType: (*PluginServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Connect",
Handler: _PluginService_Connect_Handler,
},
{
MethodName: "ExecuteJob",
Handler: _PluginService_ExecuteJob_Handler,
},
{
MethodName: "ReportHealth",
Handler: _PluginService_ReportHealth_Handler,
},
{
MethodName: "GetConfig",
Handler: _PluginService_GetConfig_Handler,
},
{
MethodName: "SubmitResult",
Handler: _PluginService_SubmitResult_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "plugin.proto",
}
const (
AdminQueryService_GetPluginStats_FullMethodName = "/plugin.AdminQueryService/GetPluginStats"
AdminQueryService_ListPlugins_FullMethodName = "/plugin.AdminQueryService/ListPlugins"
AdminQueryService_ListJobs_FullMethodName = "/plugin.AdminQueryService/ListJobs"
AdminQueryService_GetJobStatus_FullMethodName = "/plugin.AdminQueryService/GetJobStatus"
AdminQueryService_GetPluginLogs_FullMethodName = "/plugin.AdminQueryService/GetPluginLogs"
)
// AdminQueryServiceClient is the client API for AdminQueryService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// AdminQueryService provides monitoring and diagnostics endpoints
type AdminQueryServiceClient interface {
// GetPluginStats returns statistics for all connected plugins
GetPluginStats(ctx context.Context, in *GetPluginStatsRequest, opts ...grpc.CallOption) (*GetPluginStatsResponse, error)
// ListPlugins returns information about all registered plugins
ListPlugins(ctx context.Context, in *ListPluginsRequest, opts ...grpc.CallOption) (*ListPluginsResponse, error)
// ListJobs returns current and historical job information
ListJobs(ctx context.Context, in *ListJobsRequest, opts ...grpc.CallOption) (*ListJobsResponse, error)
// GetJobStatus returns detailed status of a specific job
GetJobStatus(ctx context.Context, in *GetJobStatusRequest, opts ...grpc.CallOption) (*GetJobStatusResponse, error)
// GetPluginLogs returns logs from a specific plugin
GetPluginLogs(ctx context.Context, in *GetPluginLogsRequest, opts ...grpc.CallOption) (*GetPluginLogsResponse, error)
}
type adminQueryServiceClient struct {
cc grpc.ClientConnInterface
}
func NewAdminQueryServiceClient(cc grpc.ClientConnInterface) AdminQueryServiceClient {
return &adminQueryServiceClient{cc}
}
func (c *adminQueryServiceClient) GetPluginStats(ctx context.Context, in *GetPluginStatsRequest, opts ...grpc.CallOption) (*GetPluginStatsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetPluginStatsResponse)
err := c.cc.Invoke(ctx, AdminQueryService_GetPluginStats_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *adminQueryServiceClient) ListPlugins(ctx context.Context, in *ListPluginsRequest, opts ...grpc.CallOption) (*ListPluginsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListPluginsResponse)
err := c.cc.Invoke(ctx, AdminQueryService_ListPlugins_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *adminQueryServiceClient) ListJobs(ctx context.Context, in *ListJobsRequest, opts ...grpc.CallOption) (*ListJobsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListJobsResponse)
err := c.cc.Invoke(ctx, AdminQueryService_ListJobs_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *adminQueryServiceClient) GetJobStatus(ctx context.Context, in *GetJobStatusRequest, opts ...grpc.CallOption) (*GetJobStatusResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetJobStatusResponse)
err := c.cc.Invoke(ctx, AdminQueryService_GetJobStatus_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *adminQueryServiceClient) GetPluginLogs(ctx context.Context, in *GetPluginLogsRequest, opts ...grpc.CallOption) (*GetPluginLogsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetPluginLogsResponse)
err := c.cc.Invoke(ctx, AdminQueryService_GetPluginLogs_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// AdminQueryServiceServer is the server API for AdminQueryService service.
// All implementations must embed UnimplementedAdminQueryServiceServer
// for forward compatibility.
//
// AdminQueryService provides monitoring and diagnostics endpoints
type AdminQueryServiceServer interface {
// GetPluginStats returns statistics for all connected plugins
GetPluginStats(context.Context, *GetPluginStatsRequest) (*GetPluginStatsResponse, error)
// ListPlugins returns information about all registered plugins
ListPlugins(context.Context, *ListPluginsRequest) (*ListPluginsResponse, error)
// ListJobs returns current and historical job information
ListJobs(context.Context, *ListJobsRequest) (*ListJobsResponse, error)
// GetJobStatus returns detailed status of a specific job
GetJobStatus(context.Context, *GetJobStatusRequest) (*GetJobStatusResponse, error)
// GetPluginLogs returns logs from a specific plugin
GetPluginLogs(context.Context, *GetPluginLogsRequest) (*GetPluginLogsResponse, error)
mustEmbedUnimplementedAdminQueryServiceServer()
}
// UnimplementedAdminQueryServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedAdminQueryServiceServer struct{}
func (UnimplementedAdminQueryServiceServer) GetPluginStats(context.Context, *GetPluginStatsRequest) (*GetPluginStatsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetPluginStats not implemented")
}
func (UnimplementedAdminQueryServiceServer) ListPlugins(context.Context, *ListPluginsRequest) (*ListPluginsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListPlugins not implemented")
}
func (UnimplementedAdminQueryServiceServer) ListJobs(context.Context, *ListJobsRequest) (*ListJobsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListJobs not implemented")
}
func (UnimplementedAdminQueryServiceServer) GetJobStatus(context.Context, *GetJobStatusRequest) (*GetJobStatusResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetJobStatus not implemented")
}
func (UnimplementedAdminQueryServiceServer) GetPluginLogs(context.Context, *GetPluginLogsRequest) (*GetPluginLogsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetPluginLogs not implemented")
}
func (UnimplementedAdminQueryServiceServer) mustEmbedUnimplementedAdminQueryServiceServer() {}
func (UnimplementedAdminQueryServiceServer) testEmbeddedByValue() {}
// UnsafeAdminQueryServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to AdminQueryServiceServer will
// result in compilation errors.
type UnsafeAdminQueryServiceServer interface {
mustEmbedUnimplementedAdminQueryServiceServer()
}
func RegisterAdminQueryServiceServer(s grpc.ServiceRegistrar, srv AdminQueryServiceServer) {
// If the following call pancis, it indicates UnimplementedAdminQueryServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&AdminQueryService_ServiceDesc, srv)
}
func _AdminQueryService_GetPluginStats_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetPluginStatsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AdminQueryServiceServer).GetPluginStats(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AdminQueryService_GetPluginStats_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AdminQueryServiceServer).GetPluginStats(ctx, req.(*GetPluginStatsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AdminQueryService_ListPlugins_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListPluginsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AdminQueryServiceServer).ListPlugins(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AdminQueryService_ListPlugins_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AdminQueryServiceServer).ListPlugins(ctx, req.(*ListPluginsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AdminQueryService_ListJobs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListJobsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AdminQueryServiceServer).ListJobs(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AdminQueryService_ListJobs_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AdminQueryServiceServer).ListJobs(ctx, req.(*ListJobsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AdminQueryService_GetJobStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetJobStatusRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AdminQueryServiceServer).GetJobStatus(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AdminQueryService_GetJobStatus_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AdminQueryServiceServer).GetJobStatus(ctx, req.(*GetJobStatusRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AdminQueryService_GetPluginLogs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetPluginLogsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AdminQueryServiceServer).GetPluginLogs(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AdminQueryService_GetPluginLogs_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AdminQueryServiceServer).GetPluginLogs(ctx, req.(*GetPluginLogsRequest))
}
return interceptor(ctx, in, info, handler)
}
// AdminQueryService_ServiceDesc is the grpc.ServiceDesc for AdminQueryService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var AdminQueryService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "plugin.AdminQueryService",
HandlerType: (*AdminQueryServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetPluginStats",
Handler: _AdminQueryService_GetPluginStats_Handler,
},
{
MethodName: "ListPlugins",
Handler: _AdminQueryService_ListPlugins_Handler,
},
{
MethodName: "ListJobs",
Handler: _AdminQueryService_ListJobs_Handler,
},
{
MethodName: "GetJobStatus",
Handler: _AdminQueryService_GetJobStatus_Handler,
},
{
MethodName: "GetPluginLogs",
Handler: _AdminQueryService_GetPluginLogs_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "plugin.proto",
}
const (
AdminCommandService_SaveConfig_FullMethodName = "/plugin.AdminCommandService/SaveConfig"
AdminCommandService_ReloadConfig_FullMethodName = "/plugin.AdminCommandService/ReloadConfig"
AdminCommandService_EnablePlugin_FullMethodName = "/plugin.AdminCommandService/EnablePlugin"
AdminCommandService_DisablePlugin_FullMethodName = "/plugin.AdminCommandService/DisablePlugin"
AdminCommandService_TriggerDetection_FullMethodName = "/plugin.AdminCommandService/TriggerDetection"
AdminCommandService_CancelJob_FullMethodName = "/plugin.AdminCommandService/CancelJob"
AdminCommandService_PurgeHistory_FullMethodName = "/plugin.AdminCommandService/PurgeHistory"
)
// AdminCommandServiceClient is the client API for AdminCommandService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// AdminCommandService provides administrative operations
type AdminCommandServiceClient interface {
// SaveConfig persists plugin configuration
SaveConfig(ctx context.Context, in *SaveConfigRequest, opts ...grpc.CallOption) (*SaveConfigResponse, error)
// ReloadConfig reloads configuration without restarting
ReloadConfig(ctx context.Context, in *ReloadConfigRequest, opts ...grpc.CallOption) (*ReloadConfigResponse, error)
// EnablePlugin enables a specific plugin
EnablePlugin(ctx context.Context, in *EnablePluginRequest, opts ...grpc.CallOption) (*EnablePluginResponse, error)
// DisablePlugin disables a specific plugin
DisablePlugin(ctx context.Context, in *DisablePluginRequest, opts ...grpc.CallOption) (*DisablePluginResponse, error)
// TriggerDetection manually triggers a detection for specific types
TriggerDetection(ctx context.Context, in *TriggerDetectionRequest, opts ...grpc.CallOption) (*TriggerDetectionResponse, error)
// CancelJob cancels a running job
CancelJob(ctx context.Context, in *CancelJobRequest, opts ...grpc.CallOption) (*CancelJobResponse, error)
// PurgeHistory clears job history
PurgeHistory(ctx context.Context, in *PurgeHistoryRequest, opts ...grpc.CallOption) (*PurgeHistoryResponse, error)
}
type adminCommandServiceClient struct {
cc grpc.ClientConnInterface
}
func NewAdminCommandServiceClient(cc grpc.ClientConnInterface) AdminCommandServiceClient {
return &adminCommandServiceClient{cc}
}
func (c *adminCommandServiceClient) SaveConfig(ctx context.Context, in *SaveConfigRequest, opts ...grpc.CallOption) (*SaveConfigResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SaveConfigResponse)
err := c.cc.Invoke(ctx, AdminCommandService_SaveConfig_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *adminCommandServiceClient) ReloadConfig(ctx context.Context, in *ReloadConfigRequest, opts ...grpc.CallOption) (*ReloadConfigResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ReloadConfigResponse)
err := c.cc.Invoke(ctx, AdminCommandService_ReloadConfig_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *adminCommandServiceClient) EnablePlugin(ctx context.Context, in *EnablePluginRequest, opts ...grpc.CallOption) (*EnablePluginResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(EnablePluginResponse)
err := c.cc.Invoke(ctx, AdminCommandService_EnablePlugin_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *adminCommandServiceClient) DisablePlugin(ctx context.Context, in *DisablePluginRequest, opts ...grpc.CallOption) (*DisablePluginResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DisablePluginResponse)
err := c.cc.Invoke(ctx, AdminCommandService_DisablePlugin_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *adminCommandServiceClient) TriggerDetection(ctx context.Context, in *TriggerDetectionRequest, opts ...grpc.CallOption) (*TriggerDetectionResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(TriggerDetectionResponse)
err := c.cc.Invoke(ctx, AdminCommandService_TriggerDetection_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *adminCommandServiceClient) CancelJob(ctx context.Context, in *CancelJobRequest, opts ...grpc.CallOption) (*CancelJobResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CancelJobResponse)
err := c.cc.Invoke(ctx, AdminCommandService_CancelJob_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *adminCommandServiceClient) PurgeHistory(ctx context.Context, in *PurgeHistoryRequest, opts ...grpc.CallOption) (*PurgeHistoryResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(PurgeHistoryResponse)
err := c.cc.Invoke(ctx, AdminCommandService_PurgeHistory_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// AdminCommandServiceServer is the server API for AdminCommandService service.
// All implementations must embed UnimplementedAdminCommandServiceServer
// for forward compatibility.
//
// AdminCommandService provides administrative operations
type AdminCommandServiceServer interface {
// SaveConfig persists plugin configuration
SaveConfig(context.Context, *SaveConfigRequest) (*SaveConfigResponse, error)
// ReloadConfig reloads configuration without restarting
ReloadConfig(context.Context, *ReloadConfigRequest) (*ReloadConfigResponse, error)
// EnablePlugin enables a specific plugin
EnablePlugin(context.Context, *EnablePluginRequest) (*EnablePluginResponse, error)
// DisablePlugin disables a specific plugin
DisablePlugin(context.Context, *DisablePluginRequest) (*DisablePluginResponse, error)
// TriggerDetection manually triggers a detection for specific types
TriggerDetection(context.Context, *TriggerDetectionRequest) (*TriggerDetectionResponse, error)
// CancelJob cancels a running job
CancelJob(context.Context, *CancelJobRequest) (*CancelJobResponse, error)
// PurgeHistory clears job history
PurgeHistory(context.Context, *PurgeHistoryRequest) (*PurgeHistoryResponse, error)
mustEmbedUnimplementedAdminCommandServiceServer()
}
// UnimplementedAdminCommandServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedAdminCommandServiceServer struct{}
func (UnimplementedAdminCommandServiceServer) SaveConfig(context.Context, *SaveConfigRequest) (*SaveConfigResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SaveConfig not implemented")
}
func (UnimplementedAdminCommandServiceServer) ReloadConfig(context.Context, *ReloadConfigRequest) (*ReloadConfigResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ReloadConfig not implemented")
}
func (UnimplementedAdminCommandServiceServer) EnablePlugin(context.Context, *EnablePluginRequest) (*EnablePluginResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method EnablePlugin not implemented")
}
func (UnimplementedAdminCommandServiceServer) DisablePlugin(context.Context, *DisablePluginRequest) (*DisablePluginResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DisablePlugin not implemented")
}
func (UnimplementedAdminCommandServiceServer) TriggerDetection(context.Context, *TriggerDetectionRequest) (*TriggerDetectionResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method TriggerDetection not implemented")
}
func (UnimplementedAdminCommandServiceServer) CancelJob(context.Context, *CancelJobRequest) (*CancelJobResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CancelJob not implemented")
}
func (UnimplementedAdminCommandServiceServer) PurgeHistory(context.Context, *PurgeHistoryRequest) (*PurgeHistoryResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method PurgeHistory not implemented")
}
func (UnimplementedAdminCommandServiceServer) mustEmbedUnimplementedAdminCommandServiceServer() {}
func (UnimplementedAdminCommandServiceServer) testEmbeddedByValue() {}
// UnsafeAdminCommandServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to AdminCommandServiceServer will
// result in compilation errors.
type UnsafeAdminCommandServiceServer interface {
mustEmbedUnimplementedAdminCommandServiceServer()
}
func RegisterAdminCommandServiceServer(s grpc.ServiceRegistrar, srv AdminCommandServiceServer) {
// If the following call pancis, it indicates UnimplementedAdminCommandServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&AdminCommandService_ServiceDesc, srv)
}
func _AdminCommandService_SaveConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SaveConfigRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AdminCommandServiceServer).SaveConfig(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AdminCommandService_SaveConfig_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AdminCommandServiceServer).SaveConfig(ctx, req.(*SaveConfigRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AdminCommandService_ReloadConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ReloadConfigRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AdminCommandServiceServer).ReloadConfig(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AdminCommandService_ReloadConfig_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AdminCommandServiceServer).ReloadConfig(ctx, req.(*ReloadConfigRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AdminCommandService_EnablePlugin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(EnablePluginRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AdminCommandServiceServer).EnablePlugin(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AdminCommandService_EnablePlugin_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AdminCommandServiceServer).EnablePlugin(ctx, req.(*EnablePluginRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AdminCommandService_DisablePlugin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DisablePluginRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AdminCommandServiceServer).DisablePlugin(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AdminCommandService_DisablePlugin_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AdminCommandServiceServer).DisablePlugin(ctx, req.(*DisablePluginRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AdminCommandService_TriggerDetection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(TriggerDetectionRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AdminCommandServiceServer).TriggerDetection(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AdminCommandService_TriggerDetection_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AdminCommandServiceServer).TriggerDetection(ctx, req.(*TriggerDetectionRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AdminCommandService_CancelJob_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CancelJobRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AdminCommandServiceServer).CancelJob(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AdminCommandService_CancelJob_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AdminCommandServiceServer).CancelJob(ctx, req.(*CancelJobRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AdminCommandService_PurgeHistory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PurgeHistoryRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AdminCommandServiceServer).PurgeHistory(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AdminCommandService_PurgeHistory_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AdminCommandServiceServer).PurgeHistory(ctx, req.(*PurgeHistoryRequest))
}
return interceptor(ctx, in, info, handler)
}
// AdminCommandService_ServiceDesc is the grpc.ServiceDesc for AdminCommandService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var AdminCommandService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "plugin.AdminCommandService",
HandlerType: (*AdminCommandServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "SaveConfig",
Handler: _AdminCommandService_SaveConfig_Handler,
},
{
MethodName: "ReloadConfig",
Handler: _AdminCommandService_ReloadConfig_Handler,
},
{
MethodName: "EnablePlugin",
Handler: _AdminCommandService_EnablePlugin_Handler,
},
{
MethodName: "DisablePlugin",
Handler: _AdminCommandService_DisablePlugin_Handler,
},
{
MethodName: "TriggerDetection",
Handler: _AdminCommandService_TriggerDetection_Handler,
},
{
MethodName: "CancelJob",
Handler: _AdminCommandService_CancelJob_Handler,
},
{
MethodName: "PurgeHistory",
Handler: _AdminCommandService_PurgeHistory_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "plugin.proto",
}