plugins

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConsumerUserHeader   = "Direktiv-Consumer-User"
	ConsumerTagsHeader   = "Direktiv-Consumer-Tags"
	ConsumerGroupsHeader = "Direktiv-Consumer-Groups"
)

nolint

Variables

View Source
var (
	URLParamCtxKey       = &ContextKey{"URLParamContext"}
	ConsumersParamCtxKey = &ContextKey{"ConsumersParamCtxKey"}
	NamespaceCtxKey      = &ContextKey{"namespace"}
	EndpointCtxKey       = &ContextKey{"endpoint"}
	RouteCtxKey          = &ContextKey{"route"}
)

Functions

func AddPluginToRegistry

func AddPluginToRegistry(plugin Plugin)

func ConvertConfig

func ConvertConfig(config interface{}, target interface{}) error

ConvertConfig converts an interface into the config struct of the plugin. It is used in the `Configure` function of the Plugin.

func GetAllPlugins

func GetAllPlugins() map[string]Plugin

func IsJSON

func IsJSON(str string) bool

func ReportError

func ReportError(ctx context.Context, w http.ResponseWriter, status int, msg string, err error)

func ReportNotFound

func ReportNotFound(w http.ResponseWriter)

Types

type ContextKey

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

func (*ContextKey) String

func (k *ContextKey) String() string

type Plugin

type Plugin interface {
	Configure(config interface{}, namespace string) (core.PluginInstance, error)
	Name() string
	Type() PluginType
}

func GetPluginFromRegistry

func GetPluginFromRegistry(plugin string) (Plugin, error)

func NewPluginBase

func NewPluginBase(pname string, ptype PluginType,
	configFn func(interface{}, string) (core.PluginInstance, error),
) Plugin

type PluginBase

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

PluginBase is a basic implementation of the Plugin interface.

func (PluginBase) Configure

func (p PluginBase) Configure(config interface{}, ns string) (core.PluginInstance, error)

func (PluginBase) Name

func (p PluginBase) Name() string

func (PluginBase) Type

func (p PluginBase) Type() PluginType

type PluginType

type PluginType string
var (
	AuthPluginType     PluginType = "auth"
	TargetPluginType   PluginType = "target"
	InboundPluginType  PluginType = "inbound"
	OutboundPluginType PluginType = "outbound"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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