package bundle

import "github.com/open-policy-agent/opa/bundle"

Package bundle implements bundle loading.

Index

Constants

const (
	RegoExt = ".rego"
)

Common file extensions and file names.

Functions

func Write

func Write(w io.Writer, bundle Bundle) error

Write serializes the Bundle and writes it to w.

Types

type Bundle

type Bundle struct {
	Manifest Manifest
	Data     map[string]interface{}
	Modules  []ModuleFile
}

Bundle represents a loaded bundle. The bundle can contain data and policies.

func (Bundle) Equal

func (b Bundle) Equal(other Bundle) bool

Equal returns true if this bundle's contents equal the other bundle's contents.

type Manifest

type Manifest struct {
	Revision string    `json:"revision"`
	Roots    *[]string `json:"roots,omitempty"`
}

Manifest represents the manifest from a bundle. The manifest may contain metadata such as the bundle revision.

func (*Manifest) Init

func (m *Manifest) Init()

Init initializes the manifest. If you instantiate a manifest manually, call Init to ensure that the roots are set properly.

type ModuleFile

type ModuleFile struct {
	Path   string
	Raw    []byte
	Parsed *ast.Module
}

ModuleFile represents a single module contained a bundle.

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader contains the reader to load the bundle from.

func NewReader

func NewReader(r io.Reader) *Reader

NewReader returns a new Reader.

func (*Reader) IncludeManifestInData

func (r *Reader) IncludeManifestInData(includeManifestInData bool) *Reader

IncludeManifestInData sets whether the manifest metadata should be included in the bundle's data.

func (*Reader) Read

func (r *Reader) Read() (Bundle, error)

Read returns a new Bundle loaded from the reader.

Source Files

bundle.go

Version
v0.10.4
Published
Feb 19, 2019
Platform
linux/amd64
Imports
12 packages
Last checked
26 minutes ago

Tools for package owners.