plugin

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterPlugin added in v0.7.0

func RegisterPlugin(typ Type, name string, fn func() Plugin)

Types

type BasePlugin added in v0.7.0

type BasePlugin[T Configuration] struct {
	Config T
}

func (*BasePlugin[T]) ExecuteInbound added in v0.7.0

func (p *BasePlugin[T]) ExecuteInbound(ctx context.Context, inbound *Inbound) (InboundResult, error)

func (*BasePlugin[T]) ExecuteOutbound added in v0.7.0

func (p *BasePlugin[T]) ExecuteOutbound(ctx context.Context, outbound *Outbound) error

func (*BasePlugin[T]) GetConfig added in v1.0.0

func (p *BasePlugin[T]) GetConfig() map[string]interface{}

func (*BasePlugin[T]) Init added in v1.0.0

func (p *BasePlugin[T]) Init(config map[string]interface{}) error

func (*BasePlugin[T]) Priority added in v1.0.0

func (p *BasePlugin[T]) Priority() int

func (*BasePlugin[T]) ValidateConfig added in v1.0.0

func (p *BasePlugin[T]) ValidateConfig(config map[string]interface{}) error

type Configuration added in v1.0.0

type Configuration interface {
	Schema() *openapi3.Schema
}

Configuration plugin configuration

type Inbound added in v0.7.0

type Inbound struct {
	Request  *http.Request
	Response http.ResponseWriter
	RawBody  []byte
}

type InboundResult added in v0.7.0

type InboundResult struct {
	Terminated bool
	Payload    []byte
}

type Outbound added in v0.7.0

type Outbound struct {
	URL     string            `json:"url"`
	Method  string            `json:"method"`
	Headers map[string]string `json:"headers"`
	Payload string            `json:"payload"`
}

type Plugin added in v0.7.0

type Plugin interface {
	// Name returns plugin's name
	Name() string

	// Priority returns plugin's priority
	Priority() int

	// Init inits plugin with configuration
	Init(config map[string]interface{}) error

	// GetConfig returns plugin's configuration
	GetConfig() map[string]interface{}

	// ValidateConfig validates plugin's configuration
	ValidateConfig(config map[string]interface{}) error

	// ExecuteInbound executes inbound
	ExecuteInbound(ctx context.Context, inbound *Inbound) (InboundResult, error)

	// ExecuteOutbound executes outbound
	ExecuteOutbound(ctx context.Context, outbound *Outbound) error
}

func New

func New(name string) (Plugin, bool)

type Registration added in v0.7.0

type Registration struct {
	Type    Type
	Factory func() Plugin
}

func GetRegistration added in v0.7.0

func GetRegistration(name string) *Registration

type Type added in v0.7.0

type Type string
const (
	TypeInbound  Type = "inbound"
	TypeOutbound Type = "outbound"
)

Jump to

Keyboard shortcuts

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