Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
func Register(name string, factory EngineFactory)
Register adds the factory to the built-in opaEngines map.
Types ¶
type Config ¶
type Config struct {
// Name is the name of the policy engine.
Name string
// QueryLanguage is the language of the policy query.
QueryLanguage string
// Query is the policy used for query.
Policy string
}
Config represents the configuration for an OPA policy engine.
type EngineFactory ¶
type EngineFactory interface {
// Create creates a new engine.
Create(policy string, queryLanguage string) (PolicyEngine, error)
}
EngineFactory is an interface for creating OPA policy engines.
type PolicyEngine ¶
type PolicyEngine interface {
// Evaluate evaluates the policy with the given input.
// input is the verifier reports that engine evaluates against.
// result indicates whether the input satisfies the policy.
// err indicates an error happened during the evaluation.
Evaluate(ctx context.Context, input map[string]interface{}) (result bool, err error)
}
PolicyEngine is an interface that represents a policy engine.
func CreateEngineFromConfig ¶
func CreateEngineFromConfig(engineConfig Config) (PolicyEngine, error)
CreateEngineFromConfig creates an OPA policy engine from the provided configuration.
Click to show internal directories.
Click to hide internal directories.