plugin

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DSPlugin_GetMetadata_FullMethodName    = "/plugin.DSPlugin/GetMetadata"
	DSPlugin_Execute_FullMethodName        = "/plugin.DSPlugin/Execute"
	DSPlugin_ValidateConfig_FullMethodName = "/plugin.DSPlugin/ValidateConfig"
	DSPlugin_GetSchema_FullMethodName      = "/plugin.DSPlugin/GetSchema"
)

Variables

View Source
var DSPlugin_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "plugin.DSPlugin",
	HandlerType: (*DSPluginServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetMetadata",
			Handler:    _DSPlugin_GetMetadata_Handler,
		},
		{
			MethodName: "Execute",
			Handler:    _DSPlugin_Execute_Handler,
		},
		{
			MethodName: "ValidateConfig",
			Handler:    _DSPlugin_ValidateConfig_Handler,
		},
		{
			MethodName: "GetSchema",
			Handler:    _DSPlugin_GetSchema_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "plugin.proto",
}

DSPlugin_ServiceDesc is the grpc.ServiceDesc for DSPlugin service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_plugin_proto protoreflect.FileDescriptor
View Source
var Handshake = plugin.HandshakeConfig{
	ProtocolVersion:  1,
	MagicCookieKey:   "DS_PLUGIN_MAGIC_COOKIE",
	MagicCookieValue: "delivery-station-plugin",
}

Handshake is a common handshake config for all plugins

View Source
var PluginMap = map[string]plugin.Plugin{
	"ds-plugin": &DSPlugin{},
}

PluginMap is the map of plugins we can dispense.

Functions

func RegisterDSPluginServer

func RegisterDSPluginServer(s grpc.ServiceRegistrar, srv DSPluginServer)

Types

type DSPlugin

type DSPlugin struct {
	plugin.Plugin
	// Impl is the interface implementation
	Impl types.PluginProtocol
}

DSPlugin is the implementation of plugin.Plugin so we can serve/consume this

func (*DSPlugin) GRPCClient

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

func (*DSPlugin) GRPCServer

func (p *DSPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error

type DSPluginClient

type DSPluginClient interface {
	GetMetadata(ctx context.Context, in *GetMetadataRequest, opts ...grpc.CallOption) (*GetMetadataResponse, error)
	Execute(ctx context.Context, in *ExecuteRequest, opts ...grpc.CallOption) (*ExecuteResponse, error)
	ValidateConfig(ctx context.Context, in *ValidateConfigRequest, opts ...grpc.CallOption) (*ValidateConfigResponse, error)
	GetSchema(ctx context.Context, in *GetSchemaRequest, opts ...grpc.CallOption) (*GetSchemaResponse, error)
}

DSPluginClient is the client API for DSPlugin 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.

DSPlugin service definition

func NewDSPluginClient

func NewDSPluginClient(cc grpc.ClientConnInterface) DSPluginClient

type DSPluginServer

type DSPluginServer interface {
	GetMetadata(context.Context, *GetMetadataRequest) (*GetMetadataResponse, error)
	Execute(context.Context, *ExecuteRequest) (*ExecuteResponse, error)
	ValidateConfig(context.Context, *ValidateConfigRequest) (*ValidateConfigResponse, error)
	GetSchema(context.Context, *GetSchemaRequest) (*GetSchemaResponse, error)
	// contains filtered or unexported methods
}

DSPluginServer is the server API for DSPlugin service. All implementations must embed UnimplementedDSPluginServer for forward compatibility.

DSPlugin service definition

type ExecuteRequest

type ExecuteRequest struct {
	Operation string            `protobuf:"bytes,1,opt,name=operation,proto3" json:"operation,omitempty"`
	Args      []string          `protobuf:"bytes,2,rep,name=args,proto3" json:"args,omitempty"`
	Env       map[string]string `` /* 133-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*ExecuteRequest) Descriptor deprecated

func (*ExecuteRequest) Descriptor() ([]byte, []int)

Deprecated: Use ExecuteRequest.ProtoReflect.Descriptor instead.

func (*ExecuteRequest) GetArgs

func (x *ExecuteRequest) GetArgs() []string

func (*ExecuteRequest) GetEnv

func (x *ExecuteRequest) GetEnv() map[string]string

func (*ExecuteRequest) GetOperation

func (x *ExecuteRequest) GetOperation() string

func (*ExecuteRequest) ProtoMessage

func (*ExecuteRequest) ProtoMessage()

func (*ExecuteRequest) ProtoReflect

func (x *ExecuteRequest) ProtoReflect() protoreflect.Message

func (*ExecuteRequest) Reset

func (x *ExecuteRequest) Reset()

func (*ExecuteRequest) String

func (x *ExecuteRequest) String() string

type ExecuteResponse

type ExecuteResponse struct {
	Stdout   string `protobuf:"bytes,1,opt,name=stdout,proto3" json:"stdout,omitempty"`
	Stderr   string `protobuf:"bytes,2,opt,name=stderr,proto3" json:"stderr,omitempty"`
	ExitCode int32  `protobuf:"varint,3,opt,name=exit_code,json=exitCode,proto3" json:"exit_code,omitempty"`
	Error    string `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

func (*ExecuteResponse) Descriptor deprecated

func (*ExecuteResponse) Descriptor() ([]byte, []int)

Deprecated: Use ExecuteResponse.ProtoReflect.Descriptor instead.

func (*ExecuteResponse) GetError

func (x *ExecuteResponse) GetError() string

func (*ExecuteResponse) GetExitCode

func (x *ExecuteResponse) GetExitCode() int32

func (*ExecuteResponse) GetStderr

func (x *ExecuteResponse) GetStderr() string

func (*ExecuteResponse) GetStdout

func (x *ExecuteResponse) GetStdout() string

func (*ExecuteResponse) ProtoMessage

func (*ExecuteResponse) ProtoMessage()

func (*ExecuteResponse) ProtoReflect

func (x *ExecuteResponse) ProtoReflect() protoreflect.Message

func (*ExecuteResponse) Reset

func (x *ExecuteResponse) Reset()

func (*ExecuteResponse) String

func (x *ExecuteResponse) String() string

type GRPCClient

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

GRPCClient is an implementation of PluginProtocol that talks over RPC

func (*GRPCClient) Execute

func (m *GRPCClient) Execute(ctx context.Context, operation string, args []string, env map[string]string) (*types.ExecutionResult, error)

func (*GRPCClient) GetMetadata

func (m *GRPCClient) GetMetadata(ctx context.Context) (*types.PluginMetadata, error)

func (*GRPCClient) GetSchema

func (m *GRPCClient) GetSchema(ctx context.Context) (*types.PluginSchema, error)

func (*GRPCClient) ValidateConfig

func (m *GRPCClient) ValidateConfig(ctx context.Context, config map[string]interface{}) error

type GRPCServer

type GRPCServer struct {
	UnimplementedDSPluginServer
	Impl types.PluginProtocol
}

GRPCServer is the gRPC server that GRPCClient talks to

func (*GRPCServer) Execute

func (m *GRPCServer) Execute(ctx context.Context, req *ExecuteRequest) (*ExecuteResponse, error)

func (*GRPCServer) GetMetadata

func (m *GRPCServer) GetMetadata(ctx context.Context, req *GetMetadataRequest) (*GetMetadataResponse, error)

func (*GRPCServer) GetSchema

func (m *GRPCServer) GetSchema(ctx context.Context, req *GetSchemaRequest) (*GetSchemaResponse, error)

func (*GRPCServer) ValidateConfig

type GetMetadataRequest

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

func (*GetMetadataRequest) Descriptor deprecated

func (*GetMetadataRequest) Descriptor() ([]byte, []int)

Deprecated: Use GetMetadataRequest.ProtoReflect.Descriptor instead.

func (*GetMetadataRequest) ProtoMessage

func (*GetMetadataRequest) ProtoMessage()

func (*GetMetadataRequest) ProtoReflect

func (x *GetMetadataRequest) ProtoReflect() protoreflect.Message

func (*GetMetadataRequest) Reset

func (x *GetMetadataRequest) Reset()

func (*GetMetadataRequest) String

func (x *GetMetadataRequest) String() string

type GetMetadataResponse

type GetMetadataResponse struct {
	Name        string            `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Version     string            `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
	Description string            `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
	Operations  []string          `protobuf:"bytes,4,rep,name=operations,proto3" json:"operations,omitempty"`
	Platform    *Platform         `protobuf:"bytes,5,opt,name=platform,proto3" json:"platform,omitempty"`
	Config      map[string]string `` /* 139-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*GetMetadataResponse) Descriptor deprecated

func (*GetMetadataResponse) Descriptor() ([]byte, []int)

Deprecated: Use GetMetadataResponse.ProtoReflect.Descriptor instead.

func (*GetMetadataResponse) GetConfig

func (x *GetMetadataResponse) GetConfig() map[string]string

func (*GetMetadataResponse) GetDescription

func (x *GetMetadataResponse) GetDescription() string

func (*GetMetadataResponse) GetName

func (x *GetMetadataResponse) GetName() string

func (*GetMetadataResponse) GetOperations

func (x *GetMetadataResponse) GetOperations() []string

func (*GetMetadataResponse) GetPlatform

func (x *GetMetadataResponse) GetPlatform() *Platform

func (*GetMetadataResponse) GetVersion

func (x *GetMetadataResponse) GetVersion() string

func (*GetMetadataResponse) ProtoMessage

func (*GetMetadataResponse) ProtoMessage()

func (*GetMetadataResponse) ProtoReflect

func (x *GetMetadataResponse) ProtoReflect() protoreflect.Message

func (*GetMetadataResponse) Reset

func (x *GetMetadataResponse) Reset()

func (*GetMetadataResponse) String

func (x *GetMetadataResponse) String() string

type GetSchemaRequest

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

func (*GetSchemaRequest) Descriptor deprecated

func (*GetSchemaRequest) Descriptor() ([]byte, []int)

Deprecated: Use GetSchemaRequest.ProtoReflect.Descriptor instead.

func (*GetSchemaRequest) ProtoMessage

func (*GetSchemaRequest) ProtoMessage()

func (*GetSchemaRequest) ProtoReflect

func (x *GetSchemaRequest) ProtoReflect() protoreflect.Message

func (*GetSchemaRequest) Reset

func (x *GetSchemaRequest) Reset()

func (*GetSchemaRequest) String

func (x *GetSchemaRequest) String() string

type GetSchemaResponse

type GetSchemaResponse struct {
	Version    string                     `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"`
	Properties map[string]*SchemaProperty `` /* 147-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*GetSchemaResponse) Descriptor deprecated

func (*GetSchemaResponse) Descriptor() ([]byte, []int)

Deprecated: Use GetSchemaResponse.ProtoReflect.Descriptor instead.

func (*GetSchemaResponse) GetProperties

func (x *GetSchemaResponse) GetProperties() map[string]*SchemaProperty

func (*GetSchemaResponse) GetVersion

func (x *GetSchemaResponse) GetVersion() string

func (*GetSchemaResponse) ProtoMessage

func (*GetSchemaResponse) ProtoMessage()

func (*GetSchemaResponse) ProtoReflect

func (x *GetSchemaResponse) ProtoReflect() protoreflect.Message

func (*GetSchemaResponse) Reset

func (x *GetSchemaResponse) Reset()

func (*GetSchemaResponse) String

func (x *GetSchemaResponse) String() string

type Platform

type Platform struct {
	Os   []string `protobuf:"bytes,1,rep,name=os,proto3" json:"os,omitempty"`
	Arch []string `protobuf:"bytes,2,rep,name=arch,proto3" json:"arch,omitempty"`
	// contains filtered or unexported fields
}

func (*Platform) Descriptor deprecated

func (*Platform) Descriptor() ([]byte, []int)

Deprecated: Use Platform.ProtoReflect.Descriptor instead.

func (*Platform) GetArch

func (x *Platform) GetArch() []string

func (*Platform) GetOs

func (x *Platform) GetOs() []string

func (*Platform) ProtoMessage

func (*Platform) ProtoMessage()

func (*Platform) ProtoReflect

func (x *Platform) ProtoReflect() protoreflect.Message

func (*Platform) Reset

func (x *Platform) Reset()

func (*Platform) String

func (x *Platform) String() string

type SchemaProperty

type SchemaProperty struct {
	Type        string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
	Required    bool   `protobuf:"varint,3,opt,name=required,proto3" json:"required,omitempty"`
	Default     string `protobuf:"bytes,4,opt,name=default,proto3" json:"default,omitempty"`
	// contains filtered or unexported fields
}

func (*SchemaProperty) Descriptor deprecated

func (*SchemaProperty) Descriptor() ([]byte, []int)

Deprecated: Use SchemaProperty.ProtoReflect.Descriptor instead.

func (*SchemaProperty) GetDefault

func (x *SchemaProperty) GetDefault() string

func (*SchemaProperty) GetDescription

func (x *SchemaProperty) GetDescription() string

func (*SchemaProperty) GetRequired

func (x *SchemaProperty) GetRequired() bool

func (*SchemaProperty) GetType

func (x *SchemaProperty) GetType() string

func (*SchemaProperty) ProtoMessage

func (*SchemaProperty) ProtoMessage()

func (*SchemaProperty) ProtoReflect

func (x *SchemaProperty) ProtoReflect() protoreflect.Message

func (*SchemaProperty) Reset

func (x *SchemaProperty) Reset()

func (*SchemaProperty) String

func (x *SchemaProperty) String() string

type UnimplementedDSPluginServer

type UnimplementedDSPluginServer struct{}

UnimplementedDSPluginServer 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.

func (UnimplementedDSPluginServer) Execute

func (UnimplementedDSPluginServer) GetMetadata

func (UnimplementedDSPluginServer) GetSchema

func (UnimplementedDSPluginServer) ValidateConfig

type UnsafeDSPluginServer

type UnsafeDSPluginServer interface {
	// contains filtered or unexported methods
}

UnsafeDSPluginServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to DSPluginServer will result in compilation errors.

type ValidateConfigRequest

type ValidateConfigRequest struct {
	Config map[string]string `` /* 139-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*ValidateConfigRequest) Descriptor deprecated

func (*ValidateConfigRequest) Descriptor() ([]byte, []int)

Deprecated: Use ValidateConfigRequest.ProtoReflect.Descriptor instead.

func (*ValidateConfigRequest) GetConfig

func (x *ValidateConfigRequest) GetConfig() map[string]string

func (*ValidateConfigRequest) ProtoMessage

func (*ValidateConfigRequest) ProtoMessage()

func (*ValidateConfigRequest) ProtoReflect

func (x *ValidateConfigRequest) ProtoReflect() protoreflect.Message

func (*ValidateConfigRequest) Reset

func (x *ValidateConfigRequest) Reset()

func (*ValidateConfigRequest) String

func (x *ValidateConfigRequest) String() string

type ValidateConfigResponse

type ValidateConfigResponse struct {
	Valid bool   `protobuf:"varint,1,opt,name=valid,proto3" json:"valid,omitempty"`
	Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

func (*ValidateConfigResponse) Descriptor deprecated

func (*ValidateConfigResponse) Descriptor() ([]byte, []int)

Deprecated: Use ValidateConfigResponse.ProtoReflect.Descriptor instead.

func (*ValidateConfigResponse) GetError

func (x *ValidateConfigResponse) GetError() string

func (*ValidateConfigResponse) GetValid

func (x *ValidateConfigResponse) GetValid() bool

func (*ValidateConfigResponse) ProtoMessage

func (*ValidateConfigResponse) ProtoMessage()

func (*ValidateConfigResponse) ProtoReflect

func (x *ValidateConfigResponse) ProtoReflect() protoreflect.Message

func (*ValidateConfigResponse) Reset

func (x *ValidateConfigResponse) Reset()

func (*ValidateConfigResponse) String

func (x *ValidateConfigResponse) String() string

Jump to

Keyboard shortcuts

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