api

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: MPL-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package api provides handlers for mserv's various endpoints.

Index

Constants

View Source
const (
	// FmtPluginContainer is a format string for the layout of the container names.
	FmtPluginContainer = "mserv-plugin-%s"
)

Variables

View Source
var (
	ErrCreateLocal = errors.New("could not create local directory for files")
	ErrFSKind      = errors.New("storage kind not supported")
	ErrNoFSConfig  = errors.New("no filestore configuration found")
)

Functions

func GetFileStore

func GetFileStore() (stow.Location, error)

func LoadPlugin

func LoadPlugin(funcName, dir, fName string) (func(*coprocess.Object) (*coprocess.Object, error), error)

Types

type API

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

func NewAPI

func NewAPI(store storage.MservStore) *API

func (*API) FetchAndServeBundleFile

func (a *API) FetchAndServeBundleFile(mw *storage.MW) (string, error)

func (*API) GetAllActiveMW

func (a *API) GetAllActiveMW(ctx context.Context) ([]*storage.MW, error)

func (*API) GetMWByID

func (a *API) GetMWByID(ctx context.Context, id string) (*storage.MW, error)

func (*API) HandleDeleteBundle

func (a *API) HandleDeleteBundle(ctx context.Context, bundleName string) error

func (*API) HandleNewBundle

func (a *API) HandleNewBundle(ctx context.Context, filePath, apiID, bundleName string) (*storage.MW, error)

HandleNewBundle func creates new bundle and uploads it in to the store.

func (*API) HandleUpdateBundle

func (a *API) HandleUpdateBundle(ctx context.Context, filePath, bundleName string) (*storage.MW, error)

func (*API) LoadMWIntoDispatcher

func (a *API) LoadMWIntoDispatcher(mw *storage.MW, pluginPath string) (*storage.MW, error)

func (*API) StoreBundleOnly

func (a *API) StoreBundleOnly(ctx context.Context, filePath, apiID, bundleName string) (*storage.MW, error)

StoreBundleOnly will only store the bundle file into our store, so we can pull it from a gateway if necessary.

type Dispatcher

type Dispatcher struct{}

Dispatcher implementation

func (*Dispatcher) Dispatch

func (d *Dispatcher) Dispatch(ctx context.Context, object *coprocess.Object) (*coprocess.Object, error)

Dispatch will be called on every request:

func (*Dispatcher) DispatchEvent

func (d *Dispatcher) DispatchEvent(ctx context.Context, event *coprocess.Event) (*coprocess.EventReply, error)

DispatchEvent will be called when a Tyk event is triggered:

Jump to

Keyboard shortcuts

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