package bundle
import "github.com/open-policy-agent/opa/bundle"
Package bundle implements bundle loading.
Index ¶
- Constants
- func EraseManifestFromStore(ctx context.Context, store storage.Store, txn storage.Transaction, name string) error
- func LegacyEraseManifestFromStore(ctx context.Context, store storage.Store, txn storage.Transaction) error
- func LegacyReadRevisionFromStore(ctx context.Context, store storage.Store, txn storage.Transaction) (string, error)
- func LegacyWriteManifestToStore(ctx context.Context, store storage.Store, txn storage.Transaction, manifest Manifest) error
- func ManifestStoragePath(name string) storage.Path
- func ReadBundleNamesFromStore(ctx context.Context, store storage.Store, txn storage.Transaction) ([]string, error)
- func ReadBundleRevisionFromStore(ctx context.Context, store storage.Store, txn storage.Transaction, name string) (string, error)
- func ReadBundleRootsFromStore(ctx context.Context, store storage.Store, txn storage.Transaction, name string) ([]string, error)
- func Write(w io.Writer, bundle Bundle) error
- func WriteManifestToStore(ctx context.Context, store storage.Store, txn storage.Transaction, name string, manifest Manifest) error
- type Bundle
- type Manifest
- type ModuleFile
- type Reader
Constants ¶
const (
RegoExt = ".rego"
)
Common file extensions and file names.
Functions ¶
func EraseManifestFromStore ¶
func EraseManifestFromStore(ctx context.Context, store storage.Store, txn storage.Transaction, name string) error
EraseManifestFromStore will remove the manifest from storage. This function is called when the bundle is deactivated.
func LegacyEraseManifestFromStore ¶
func LegacyEraseManifestFromStore(ctx context.Context, store storage.Store, txn storage.Transaction) error
LegacyEraseManifestFromStore will erase the bundle manifest from the older single (unnamed) bundle manifest location. Deprecated: Use WriteManifestToStore and named bundles instead.
func LegacyReadRevisionFromStore ¶
func LegacyReadRevisionFromStore(ctx context.Context, store storage.Store, txn storage.Transaction) (string, error)
LegacyReadRevisionFromStore will read the bundle manifest revision from the older single (unnamed) bundle manifest location. Deprecated: Use ReadBundleRevisionFromStore and named bundles instead.
func LegacyWriteManifestToStore ¶
func LegacyWriteManifestToStore(ctx context.Context, store storage.Store, txn storage.Transaction, manifest Manifest) error
LegacyWriteManifestToStore will write the bundle manifest to the older single (unnamed) bundle manifest location. Deprecated: Use WriteManifestToStore and named bundles instead.
func ManifestStoragePath ¶
ManifestStoragePath is the storage path used for the given named bundle manifest.
func ReadBundleNamesFromStore ¶
func ReadBundleNamesFromStore(ctx context.Context, store storage.Store, txn storage.Transaction) ([]string, error)
ReadBundleNamesFromStore will return a list of bundle names which have had their metadata stored.
func ReadBundleRevisionFromStore ¶
func ReadBundleRevisionFromStore(ctx context.Context, store storage.Store, txn storage.Transaction, name string) (string, error)
ReadBundleRevisionFromStore returns the revision in the specified bundle. If the bundle is not activated, this function will return storage NotFound error.
func ReadBundleRootsFromStore ¶
func ReadBundleRootsFromStore(ctx context.Context, store storage.Store, txn storage.Transaction, name string) ([]string, error)
ReadBundleRootsFromStore returns the roots in the specified bundle. If the bundle is not activated, this function will return storage NotFound error.
func Write ¶
Write serializes the Bundle and writes it to w.
func WriteManifestToStore ¶
func WriteManifestToStore(ctx context.Context, store storage.Store, txn storage.Transaction, name string, manifest Manifest) error
WriteManifestToStore will write the manifest into the storage. This function is called when the bundle is activated.
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 ¶
Equal returns true if this bundle's contents equal the other bundle's contents.
type Manifest ¶
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 ¶
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 ¶
NewReader returns a new Reader.
func (*Reader) IncludeManifestInData ¶
IncludeManifestInData sets whether the manifest metadata should be included in the bundle's data.
func (*Reader) Read ¶
Read returns a new Bundle loaded from the reader.
Source Files ¶
- Version
- v0.13.2
- Published
- Aug 14, 2019
- Platform
- js/wasm
- Imports
- 14 packages
- Last checked
- 51 seconds ago –
Tools for package owners.