rego

package
v0.1.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseDir

func ParseDir(dir string) ([]*ast.Module, []diagnostic.Diagnostic)

ParseDir parses all .rego files in the given directory using opa/ast.

Types

type AllowRule

type AllowRule struct {
	Actions    []string
	Resource   string
	UsesOwner  bool
	UsesRole   bool
	RoleValue  string
	SourceLine int
}

AllowRule represents an extracted (action, resource) pair from an allow rule.

type OwnershipMapping

type OwnershipMapping struct {
	Resource  string
	Table     string
	Column    string
	JoinTable string
	JoinFK    string
}

OwnershipMapping represents a @ownership annotation.

type Policy

type Policy struct {
	File       string
	Rules      []AllowRule
	Ownerships []OwnershipMapping
	ClaimsRefs []string
}

Policy represents parsed OPA Rego policy information.

func ParsePolicies

func ParsePolicies(dir string) ([]Policy, []diagnostic.Diagnostic)

ParsePolicies parses all .rego files in dir and returns structured policies.

func ParsePolicyFile

func ParsePolicyFile(path string) (*Policy, []diagnostic.Diagnostic)

ParsePolicyFile parses a single .rego file and extracts policy information.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL