Documentation
¶
Index ¶
- Variables
- type Config
- type GRPCClient
- func (c *GRPCClient) SetConfig(ctx context.Context, configRaw string) error
- func (c *GRPCClient) SyncRuntimeConfig(ctx context.Context, namespaceID uint64, namespaceURN string, ...) (map[string]string, error)
- func (c *GRPCClient) TransformToAlerts(ctx context.Context, providerID uint64, namespaceID uint64, ...) ([]alert.Alert, int, error)
- func (c *GRPCClient) UpsertRule(ctx context.Context, ns namespace.Namespace, prov provider.Provider, ...) error
- type GRPCServer
- func (s *GRPCServer) SetConfig(ctx context.Context, req *sirenproviderv1beta1.SetConfigRequest) (*sirenproviderv1beta1.SetConfigResponse, error)
- func (s *GRPCServer) SyncRuntimeConfig(ctx context.Context, req *sirenproviderv1beta1.SyncRuntimeConfigRequest) (*sirenproviderv1beta1.SyncRuntimeConfigResponse, error)
- func (s *GRPCServer) TransformToAlerts(ctx context.Context, req *sirenproviderv1beta1.TransformToAlertsRequest) (*sirenproviderv1beta1.TransformToAlertsResponse, error)
- func (s *GRPCServer) UpsertRule(ctx context.Context, req *sirenproviderv1beta1.UpsertRuleRequest) (*sirenproviderv1beta1.UpsertRuleResponse, error)
- type HandshakeConfig
- type PluginConfig
- type ProviderV1beta1
- type ProviderV1beta1GRPCPlugin
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 NewProviderClient(c sirenproviderv1beta1.ProviderServiceClient) *GRPCClient
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 (*GRPCClient) TransformToAlerts ¶ added in v0.6.7
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 (s *GRPCServer) SetConfig(ctx context.Context, req *sirenproviderv1beta1.SetConfigRequest) (*sirenproviderv1beta1.SetConfigResponse, error)
func (*GRPCServer) SyncRuntimeConfig ¶ added in v0.6.7
func (s *GRPCServer) SyncRuntimeConfig(ctx context.Context, req *sirenproviderv1beta1.SyncRuntimeConfigRequest) (*sirenproviderv1beta1.SyncRuntimeConfigResponse, error)
func (*GRPCServer) TransformToAlerts ¶ added in v0.6.7
func (s *GRPCServer) TransformToAlerts(ctx context.Context, req *sirenproviderv1beta1.TransformToAlertsRequest) (*sirenproviderv1beta1.TransformToAlertsResponse, error)
func (*GRPCServer) UpsertRule ¶ added in v0.6.7
func (s *GRPCServer) UpsertRule(ctx context.Context, req *sirenproviderv1beta1.UpsertRuleRequest) (*sirenproviderv1beta1.UpsertRuleResponse, error)
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
Click to show internal directories.
Click to hide internal directories.