hooks

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 1 Imported by: 3

Documentation

Overview

Deprecated: This package is intended for older projects transitioning from OPA v0.x and will remain for the lifetime of OPA v1.x, but its use is not recommended. For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the github.com/open-policy-agent/opa/v1 package instead. See https://www.openpolicyagent.org/docs/latest/v0-compatibility/ for more information.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigDiscoveryHook

type ConfigDiscoveryHook = v1.ConfigDiscoveryHook

ConfigHook allows inspecting or rewriting the discovered configuration when the discovery plugin is processing it.

type ConfigHook

type ConfigHook = v1.ConfigHook

ConfigHook allows inspecting or rewriting the configuration when the plugin manager is processing it. Note that this hook is not run when the plugin manager is reconfigured. This usually only happens when there's a new config from a discovery bundle, and for processing _that_, there's `ConfigDiscoveryHook`.

type Hook

type Hook = v1.Hook

Hook is a hook to be called in some select places in OPA's operation.

The base Hook interface is any, and wherever a hook can occur, the calling code will check if your hook implements an appropriate interface. If so, your hook is called.

This allows you to only hook in to behavior you care about, and it allows the OPA to add more hooks in the future.

All hook interfaces in this package have Hook in the name. Hooks must be safe for concurrent use. It is expected that hooks are fast; if a hook needs to take time, then copy what you need and ensure the hook is async.

When multiple instances of a hook are provided, they are all going to be executed in an unspecified order (it's a map-range call underneath). If you need hooks to be run in order, you can wrap them into another hook, and configure that one.

type Hooks

type Hooks = v1.Hooks

Hooks is the type used for every struct in OPA that can work with hooks.

func New

func New(hs ...Hook) Hooks

New creates a new instance of Hooks.

Jump to

Keyboard shortcuts

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