plugins

package
v2.4.14 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2021 License: MIT Imports: 22 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Setup

func Setup(client *Client, plugins map[string]Descriptor, devPlugin *DevPlugin) error

Setup setup plugins environment.

Types

type Builder

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

Builder is a plugin builder.

func NewBuilder

func NewBuilder(client *Client, plugins map[string]Descriptor, devPlugin *DevPlugin) (*Builder, error)

NewBuilder creates a new Builder.

func (Builder) Build

func (b Builder) Build(pName string, config map[string]interface{}, middlewareName string) (Constructor, error)

Build builds a plugin.

type Client

type Client struct {
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

Client a Traefik Pilot client.

func NewClient

func NewClient(opts ClientOptions) (*Client, error)

NewClient creates a new Traefik Pilot client.

func (*Client) Check

func (c *Client) Check(ctx context.Context, pName, pVersion, hash string) error

Check checks the plugin archive integrity.

func (*Client) CleanArchives

func (c *Client) CleanArchives(plugins map[string]Descriptor) error

CleanArchives cleans plugins archives.

func (*Client) Download

func (c *Client) Download(ctx context.Context, pName, pVersion string) (string, error)

Download downloads a plugin archive.

func (*Client) GoPath

func (c *Client) GoPath() string

GoPath gets the plugins GoPath.

func (*Client) ReadManifest

func (c *Client) ReadManifest(moduleName string) (*Manifest, error)

ReadManifest reads a plugin manifest.

func (*Client) ResetAll

func (c *Client) ResetAll() error

ResetAll resets all plugins related directories.

func (*Client) Unzip

func (c *Client) Unzip(pName, pVersion string) error

Unzip unzip a plugin archive.

func (*Client) WriteState

func (c *Client) WriteState(plugins map[string]Descriptor) error

WriteState writes the plugins state files.

type ClientOptions

type ClientOptions struct {
	Output string
	Token  string
}

ClientOptions the options of a Traefik Pilot client.

type Constructor

type Constructor func(context.Context, http.Handler) (http.Handler, error)

Constructor creates a plugin handler.

type Descriptor

type Descriptor struct {
	// ModuleName (required)
	ModuleName string `` /* 133-byte string literal not displayed */

	// Version (required)
	Version string `description:"plugin's version." json:"version,omitempty" toml:"version,omitempty" yaml:"version,omitempty" export:"true"`
}

Descriptor The static part of a plugin configuration (prod).

type DevPlugin

type DevPlugin struct {
	// GoPath plugin's GOPATH. (required)
	GoPath string `description:"plugin's GOPATH." json:"goPath,omitempty" toml:"goPath,omitempty" yaml:"goPath,omitempty" export:"true"`

	// ModuleName (required)
	ModuleName string `` /* 134-byte string literal not displayed */
}

DevPlugin The static part of a plugin configuration (only for dev).

type Manifest

type Manifest struct {
	DisplayName   string                 `yaml:"displayName"`
	Type          string                 `yaml:"type"`
	Import        string                 `yaml:"import"`
	BasePkg       string                 `yaml:"basePkg"`
	Compatibility string                 `yaml:"compatibility"`
	Summary       string                 `yaml:"summary"`
	TestData      map[string]interface{} `yaml:"testData"`
}

Manifest The plugin manifest.

func ReadManifest

func ReadManifest(goPath, moduleName string) (*Manifest, error)

ReadManifest reads a plugin manifest.

type Middleware

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

Middleware is a HTTP handler plugin wrapper.

func (*Middleware) NewHandler

func (m *Middleware) NewHandler(ctx context.Context, next http.Handler) (http.Handler, error)

NewHandler creates a new HTTP handler.

Jump to

Keyboard shortcuts

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