package bundle
import "github.com/open-policy-agent/opa/plugins/bundle"
Package bundle implements bundle downloading.
Index ¶
- type Config
- type Plugin
- func New(config []byte, manager *plugins.Manager) (*Plugin, error)
- 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 PollingConfig
- type Status
Types ¶
type Config ¶
type Config struct { Name string `json:"name"` Service string `json:"service"` Polling PollingConfig `json:"polling"` }
Config represents configuration the plguin.
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin implements bundle downloading and activation.
func New ¶
New returns a new Plugin with the given config.
func (*Plugin) Register ¶
Register a lisetner 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 PollingConfig ¶
type PollingConfig struct { MinDelaySeconds *int64 `json:"min_delay_seconds,omitempty"` // min amount of time to wait between successful poll attempts MaxDelaySeconds *int64 `json:"max_delay_seconds,omitempty"` // max amount of time to wait between poll attempts }
PollingConfig represents configuration for the plugin's polling behaviour.
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 the plugin.
Source Files ¶
- Version
- v0.9.2
- Published
- Sep 24, 2018
- Platform
- js/wasm
- Imports
- 14 packages
- Last checked
- 46 seconds ago –
Tools for package owners.