package plugins

import "github.com/open-policy-agent/opa/plugins"

Package plugins implements plugin management for the policy engine.

Index

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

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

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.

type Plugin

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

Plugin defines the interface for OPA plugins.

Source Files

plugins.go

Directories

PathSynopsis
plugins/bundlePackage bundle implements bundle downloading.
plugins/logsPackage logs implements decision log buffering and uploading.
plugins/restPackage rest implements a REST client for communicating with remote services.
plugins/statusPackage status implements status reporting.
Version
v0.8.2
Published
Jun 22, 2018
Platform
js/wasm
Imports
7 packages
Last checked
2 hours ago

Tools for package owners.