plugin

package
v1.148.2 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 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 added in v1.5.0

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

func NotifyRequestToProto added in v1.6.1

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

func ProtoToIncident added in v1.5.0

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

func ProtoToNotifyRequest added in v1.6.1

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

Types

type Base added in v1.5.0

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

type GRPCClient added in v1.5.0

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

func (*GRPCClient) Description added in v1.6.1

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

func (*GRPCClient) Id added in v1.5.0

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

func (*GRPCClient) Init added in v1.5.0

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

func (*GRPCClient) MetadataFields added in v1.5.0

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

func (*GRPCClient) Name added in v1.5.0

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

func (*GRPCClient) Notify added in v1.5.0

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

func (*GRPCClient) PreCheck added in v1.6.1

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

type GRPCServer added in v1.5.0

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

func (*GRPCServer) Description added in v1.6.1

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

func (*GRPCServer) Id added in v1.5.0

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

func (*GRPCServer) Init added in v1.5.0

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

func (*GRPCServer) MetadataFields added in v1.5.0

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

func (*GRPCServer) Name added in v1.5.0

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

func (*GRPCServer) Notify added in v1.5.0

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

func (*GRPCServer) PreCheck added in v1.6.1

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

type Notifier added in v1.5.0

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 added in v1.5.0

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 added in v1.5.0

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

func (*NotifierGRPCPlugin) GRPCServer added in v1.5.0

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 added in v1.6.1

func (n *Plugin) Description() string

func (*Plugin) Id

func (n *Plugin) Id() string

func (*Plugin) MetadataFields added in v1.3.0

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 added in v1.6.1

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