plugin

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 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 ProtoToIncident added in v1.5.0

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

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) 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(incident models.Incident) error

func (*GRPCClient) NotifySubscriber added in v1.5.0

func (m *GRPCClient) NotifySubscriber(incident models.Incident, subscribers []string) error

type GRPCServer added in v1.5.0

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

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

func (s GRPCServer) NotifySubscriber(ctx context.Context, request *proto.NotifySubscriberRequest) (*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)
	Id() (string, error)
	MetadataFields() ([]models.MetadataField, error)
	Notify(incident models.Incident) error
	NotifySubscriber(incident models.Incident, subscribers []string) 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) 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(incident models.Incident) error

func (Plugin) NotifySubscriber

func (n Plugin) NotifySubscriber(incident models.Incident, subscribers []string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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