Skip to content

Repository files navigation

runtime - an abstraction library on top of the Open Policy Agent (OPA)

Go ReferenceGo Report Card

Introduction

The "runtime" project is a library that sits on top of OPA.

The goal of the project is to allow you to quickly write code that builds, runs or tests OPA policies.

It uses the options pattern to facilitate construction of Runtime instances specific to your needs. You can start super simple, using it just to build some rego into a bundle, or you can get more complex, using it to start a runtime with plugins, built-ins and other features.

Install

go get -u github.com/aserto-dev/runtime

Usage

// Create a runtimer, err:=runtime.New(ctx, &logger, &runtime.Config{}, runtime.WithRegoVersion(ast.RegoV1)))
iferr!=nil {
returnerrors.Wrap(err, "failed to create runtime")
}
iferr:=r.Start(ctx); err!=nil {
returnerrors.Wrap(err, "failed to start runtime")
}
deferfunc() { r.Stop(ctx) }()
// Use the runtime to build a bundle from the current directoryreturnr.Build(runtime.BuildParams{
OutputFile: "my-bundle.tar.gz",
}, ".")

You can find a more complete example in the example directory.

Credits

Based on the awesome Open Policy Agent.

About

an abstraction library on top of OPA

Topics

Resources

Stars

30 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages