plugin

package
v2.15.2 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const RegisterFuncName = "Register"

Variables

View Source
var Handshake = pluginhc.HandshakeConfig{

	ProtocolVersion:  1,
	MagicCookieKey:   "BASIC_PLUGIN",
	MagicCookieValue: "hello",
}

Handshake is a common handshake that is shared by plugin and host.

Functions

func IncidentToProto

func IncidentToProto(incident models.Incident) *proto.Incident

func NotifyRequestToProto

func NotifyRequestToProto(notifyRequest *models.NotifyRequest) *proto.NotifyRequest

func ProtoToIncident

func ProtoToIncident(incident *proto.Incident) models.Incident

func ProtoToNotifyRequest

func ProtoToNotifyRequest(notifyRequest *proto.NotifyRequest) *models.NotifyRequest

Types

type Base

type Base struct {
	BaseInfo config.BaseInfo
	Params   map[string]interface{}
}

type GRPCClient

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

func (*GRPCClient) Description

func (m *GRPCClient) Description() (string, error)

func (*GRPCClient) Id

func (m *GRPCClient) Id() (string, error)

func (*GRPCClient) Init

func (m *GRPCClient) Init(baseInfo config.BaseInfo, params map[string]interface{}) error

func (*GRPCClient) MetadataFields

func (m *GRPCClient) MetadataFields() ([]models.MetadataField, error)

func (*GRPCClient) Name

func (m *GRPCClient) Name() (string, error)

func (*GRPCClient) Notify

func (m *GRPCClient) Notify(notifyReq *models.NotifyRequest) error

func (*GRPCClient) PreCheck

func (m *GRPCClient) PreCheck(incident *models.Incident) error

type GRPCServer

type GRPCServer struct {
	proto.UnsafeNotifierServer
	// This is the real implementation
	Impl Notifier
}

func (*GRPCServer) Description

func (s *GRPCServer) Description(ctx context.Context, empty *emptypb.Empty) (*proto.DescriptionResponse, error)

func (*GRPCServer) Id

func (s *GRPCServer) Id(ctx context.Context, request *emptypb.Empty) (*proto.IdResponse, error)

func (*GRPCServer) Init

func (s *GRPCServer) Init(ctx context.Context, request *proto.InitRequest) (*emptypb.Empty, error)

func (*GRPCServer) MetadataFields

func (s *GRPCServer) MetadataFields(ctx context.Context, request *emptypb.Empty) (*proto.ListMetadataField, error)

func (*GRPCServer) Name

func (s *GRPCServer) Name(ctx context.Context, request *emptypb.Empty) (*proto.NameResponse, error)

func (*GRPCServer) Notify

func (s *GRPCServer) Notify(ctx context.Context, request *proto.NotifyRequest) (*proto.ErrorResponse, error)

func (*GRPCServer) PreCheck

func (s *GRPCServer) PreCheck(ctx context.Context, request *proto.NotifyRequest) (*proto.ErrorResponse, error)

type Notifier

type Notifier interface {
	Init(baseInfo config.BaseInfo, params map[string]interface{}) error
	Name() (string, error)
	Description() (string, error)
	Id() (string, error)
	MetadataFields() ([]models.MetadataField, error)
	Notify(notifyReq *models.NotifyRequest) error
	PreCheck(incident *models.Incident) error
}

type NotifierGRPCPlugin

type NotifierGRPCPlugin struct {
	// GRPCPlugin must still implement the Plugin interface
	pluginhc.Plugin
	// Concrete implementation, written in Go. This is only used for plugins
	// that are written in Go.
	Impl Notifier
}

func (*NotifierGRPCPlugin) GRPCClient

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

func (*NotifierGRPCPlugin) GRPCServer

func (p *NotifierGRPCPlugin) GRPCServer(broker *pluginhc.GRPCBroker, s *grpc.Server) error

type Plugin

type Plugin struct {
	BaseRequest Base
	// contains filtered or unexported fields
}

func (*Plugin) Creator

func (n *Plugin) Creator(params map[string]interface{}, baseInfo config.BaseInfo) (notifiers.Notifier, error)

func (*Plugin) Description

func (n *Plugin) Description() string

func (*Plugin) Id

func (n *Plugin) Id() string

func (*Plugin) MetadataFields

func (n *Plugin) MetadataFields() []models.MetadataField

func (*Plugin) Name

func (n *Plugin) Name() string

func (*Plugin) Notify

func (n *Plugin) Notify(notifyReq *models.NotifyRequest) error

func (*Plugin) PreCheck

func (n *Plugin) PreCheck(incident *models.Incident) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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