Documentation
¶
Index ¶
- Constants
- Variables
- func IncidentToProto(incident models.Incident) *proto.Incident
- func NotifyRequestToProto(notifyRequest *models.NotifyRequest) *proto.NotifyRequest
- func ProtoToIncident(incident *proto.Incident) models.Incident
- func ProtoToNotifyRequest(notifyRequest *proto.NotifyRequest) *models.NotifyRequest
- type Base
- type GRPCClient
- func (m *GRPCClient) Description() (string, error)
- func (m *GRPCClient) Id() (string, error)
- func (m *GRPCClient) Init(baseInfo config.BaseInfo, params map[string]interface{}) error
- func (m *GRPCClient) MetadataFields() ([]models.MetadataField, error)
- func (m *GRPCClient) Name() (string, error)
- func (m *GRPCClient) Notify(notifyReq *models.NotifyRequest) error
- func (m *GRPCClient) PreCheck(incident *models.Incident) error
- type GRPCServer
- func (s *GRPCServer) Description(ctx context.Context, empty *emptypb.Empty) (*proto.DescriptionResponse, error)
- func (s *GRPCServer) Id(ctx context.Context, request *emptypb.Empty) (*proto.IdResponse, error)
- func (s *GRPCServer) Init(ctx context.Context, request *proto.InitRequest) (*emptypb.Empty, error)
- func (s *GRPCServer) MetadataFields(ctx context.Context, request *emptypb.Empty) (*proto.ListMetadataField, error)
- func (s *GRPCServer) Name(ctx context.Context, request *emptypb.Empty) (*proto.NameResponse, error)
- func (s *GRPCServer) Notify(ctx context.Context, request *proto.NotifyRequest) (*proto.ErrorResponse, error)
- func (s *GRPCServer) PreCheck(ctx context.Context, request *proto.NotifyRequest) (*proto.ErrorResponse, error)
- type Notifier
- type NotifierGRPCPlugin
- type Plugin
- func (n *Plugin) Creator(params map[string]interface{}, baseInfo config.BaseInfo) (notifiers.Notifier, error)
- func (n *Plugin) Description() string
- func (n *Plugin) Id() string
- func (n *Plugin) MetadataFields() []models.MetadataField
- func (n *Plugin) Name() string
- func (n *Plugin) Notify(notifyReq *models.NotifyRequest) error
- func (n *Plugin) PreCheck(incident *models.Incident) error
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 NotifyRequestToProto ¶
func NotifyRequestToProto(notifyRequest *models.NotifyRequest) *proto.NotifyRequest
func ProtoToNotifyRequest ¶
func ProtoToNotifyRequest(notifyRequest *proto.NotifyRequest) *models.NotifyRequest
Types ¶
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
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) Description ¶
func (*Plugin) MetadataFields ¶
func (n *Plugin) MetadataFields() []models.MetadataField
Click to show internal directories.
Click to hide internal directories.