plugins

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotImplemented                 = errors.New("operation not supported")
	ErrProviderSyncMethodNotSupported = errors.New("provider sync method not supported")
)

Functions

This section is empty.

Types

type Config added in v0.6.7

type Config struct {
	PluginPath string                  `mapstructure:"plugin_path" yaml:"plugin_path" json:"plugin_path" default:"./plugin"`
	Plugins    map[string]PluginConfig `mapstructure:"plugins" yaml:"plugins" json:"plugins"`
}

type GRPCClient added in v0.6.7

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

func NewProviderClient added in v0.6.7

func (*GRPCClient) SetConfig added in v0.6.7

func (c *GRPCClient) SetConfig(ctx context.Context, configRaw string) error

func (*GRPCClient) SyncRuntimeConfig added in v0.6.7

func (c *GRPCClient) SyncRuntimeConfig(ctx context.Context, namespaceID uint64, namespaceURN string, namespaceLabels map[string]string, prov provider.Provider) (map[string]string, error)

func (*GRPCClient) TransformToAlerts added in v0.6.7

func (c *GRPCClient) TransformToAlerts(ctx context.Context, providerID uint64, namespaceID uint64, body map[string]any) ([]alert.Alert, int, error)

func (*GRPCClient) UpsertRule added in v0.6.7

func (c *GRPCClient) UpsertRule(ctx context.Context, ns namespace.Namespace, prov provider.Provider, rl *rule.Rule, templateToUpdate *template.Template) error

type GRPCServer added in v0.6.7

type GRPCServer struct {
	sirenproviderv1beta1.UnimplementedProviderServiceServer
	// contains filtered or unexported fields
}

func NewProviderServer added in v0.6.7

func NewProviderServer(service ProviderV1beta1) *GRPCServer

func (*GRPCServer) SetConfig added in v0.6.7

func (*GRPCServer) UpsertRule added in v0.6.7

type HandshakeConfig added in v0.6.7

type HandshakeConfig struct {
	// ProtocolVersion is the version that clients must match on to
	// agree they can communicate. This should match the ProtocolVersion
	// set on ClientConfig when using a plugin.
	// This field is not required if VersionedPlugins are being used in the
	// Client or Server configurations.
	ProtocolVersion uint `mapstructure:"protocol_version" yaml:"protocol_version" json:"protocol_version"`

	// MagicCookieKey and value are used as a very basic verification
	// that a plugin is intended to be launched. This is not a security
	// measure, just a UX feature. If the magic cookie doesn't match,
	// we show human-friendly output.
	MagicCookieKey   string `mapstructure:"magic_cookie_key" yaml:"magic_cookie_key" json:"magic_cookie_key"`
	MagicCookieValue string `mapstructure:"magic_cookie_value" yaml:"magic_cookie_value" json:"magic_cookie_value"`
}

type PluginConfig added in v0.6.7

type PluginConfig struct {
	Handshake     HandshakeConfig        `mapstructure:"handshake" yaml:"handshake" json:"handshake"`
	ServiceConfig map[string]interface{} `mapstructure:"service_config" yaml:"plugin_config" json:"plugin_config"`
}

type ProviderV1beta1 added in v0.6.7

type ProviderV1beta1 interface {
	SyncRuntimeConfig(ctx context.Context, namespaceID uint64, namespaceURN string, namespaceLabels map[string]string, prov provider.Provider) (map[string]string, error)
	UpsertRule(ctx context.Context, ns namespace.Namespace, prov provider.Provider, rl *rule.Rule, templateToUpdate *template.Template) error
	SetConfig(ctx context.Context, configRaw string) error
	TransformToAlerts(ctx context.Context, providerID uint64, namespaceID uint64, body map[string]any) ([]alert.Alert, int, error)
}

type ProviderV1beta1GRPCPlugin added in v0.6.7

type ProviderV1beta1GRPCPlugin struct {
	plugin.NetRPCUnsupportedPlugin
	GRPCProvider func() sirenproviderv1beta1.ProviderServiceServer
}

func (*ProviderV1beta1GRPCPlugin) GRPCClient added in v0.6.7

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

func (*ProviderV1beta1GRPCPlugin) GRPCServer added in v0.6.7

func (c *ProviderV1beta1GRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error

Jump to

Keyboard shortcuts

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