plugins

package
v0.9.3-rc1 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package plugins implements plugin management for the policy engine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	Labels map[string]string
	Store  storage.Store
	// contains filtered or unexported fields
}

Manager implements lifecycle management of plugins and gives plugins access to engine-wide components like storage.

func New

func New(config []byte, id string, store storage.Store) (*Manager, error)

New creates a new Manager using config.

func (*Manager) Client

func (m *Manager) Client(name string) rest.Client

Client returns a client for communicating with a remote service.

func (*Manager) GetCompiler added in v0.8.1

func (m *Manager) GetCompiler() *ast.Compiler

GetCompiler returns the manager's compiler.

func (*Manager) Register

func (m *Manager) Register(plugin Plugin)

Register adds a plugin to the manager. When the manager is started, all of the plugins will be started.

func (*Manager) RegisterCompilerTrigger added in v0.8.1

func (m *Manager) RegisterCompilerTrigger(f func(txn storage.Transaction))

RegisterCompilerTrigger registers for change notifications when the compiler is changed.

func (*Manager) Services

func (m *Manager) Services() []string

Services returns a list of services that m can provide clients for.

func (*Manager) Start

func (m *Manager) Start(ctx context.Context) error

Start starts the manager.

func (*Manager) Stop added in v0.9.2

func (m *Manager) Stop(ctx context.Context)

Stop stops the manager, stopping all the plugins registered with it

type Plugin

type Plugin interface {
	Start(ctx context.Context) error
	Stop(ctx context.Context)
}

Plugin defines the interface for OPA plugins.

type PluginInitFunc added in v0.9.2

type PluginInitFunc func(m *Manager, config []byte) (Plugin, error)

PluginInitFunc defines the interface for the constructing plugins from configuration. The function will be called with the plugin manager (which provides access to OPA's storage layer, compiler, and service clients) and the configuration for the plugin itself.

Directories

Path Synopsis
Package bundle implements bundle downloading.
Package bundle implements bundle downloading.
Package logs implements decision log buffering and uploading.
Package logs implements decision log buffering and uploading.
Package rest implements a REST client for communicating with remote services.
Package rest implements a REST client for communicating with remote services.
Package status implements status reporting.
Package status implements status reporting.

Jump to

Keyboard shortcuts

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