package bundle
import "github.com/open-policy-agent/opa/plugins/bundle"
Package bundle implements bundle downloading.
Index ¶
- Constants
- type Config
- type Plugin
- func Lookup(manager *plugins.Manager) *Plugin
- func New(parsedConfig *Config, manager *plugins.Manager) *Plugin
- func (p *Plugin) Reconfigure(ctx context.Context, config interface{})
- func (p *Plugin) Register(name interface{}, listener func(Status))
- func (p *Plugin) Start(ctx context.Context) error
- func (p *Plugin) Stop(ctx context.Context)
- func (p *Plugin) Unregister(name interface{})
- type Status
Constants ¶
const Name = "bundle"
Name identifies the plugin on manager.
Types ¶
type Config ¶
type Config struct { download.Config Name string `json:"name"` Service string `json:"service"` Prefix *string `json:"prefix"` }
Config represents the configuration of the plugin.
func ParseConfig ¶
ParseConfig validates the config and injects default values.
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin implements bundle activation.
func Lookup ¶
Lookup returns the bundle plugin registered with the manager.
func New ¶
New returns a new Plugin with the given config.
func (*Plugin) Reconfigure ¶
Reconfigure notifies the plugin that it's configuration has changed.
func (*Plugin) Register ¶
Register a listener to receive status updates. The name must be comparable.
func (*Plugin) Start ¶
Start runs the plugin. The plugin will periodically try to download bundles from the configured service. When a new bundle is downloaded, the data and policies are extracted and inserted into storage.
func (*Plugin) Stop ¶
Stop stops the plugin.
func (*Plugin) Unregister ¶
func (p *Plugin) Unregister(name interface{})
Unregister a listener to stop receiving status updates.
type Status ¶
type Status struct { Name string `json:"name"` ActiveRevision string `json:"active_revision,omitempty"` LastSuccessfulActivation time.Time `json:"last_successful_activation,omitempty"` LastSuccessfulDownload time.Time `json:"last_successful_download,omitempty"` Code string `json:"code,omitempty"` Message string `json:"message,omitempty"` Errors []error `json:"errors,omitempty"` }
Status represents the status of processing a bundle.
func (*Status) SetActivateSuccess ¶
SetActivateSuccess updates the status object to reflect a successful activation.
func (*Status) SetDownloadSuccess ¶
func (s *Status) SetDownloadSuccess()
SetDownloadSuccess updates the status object to reflect a successful download.
func (*Status) SetError ¶
SetError updates the status object to reflect a failure to download or activate. If err is nil, the error status is cleared.
Source Files ¶
- Version
- v0.12.1
- Published
- Jul 3, 2019
- Platform
- js/wasm
- Imports
- 16 packages
- Last checked
- 39 seconds ago –
Tools for package owners.