policy

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultReportPath

func DefaultReportPath(attestDir string) string

func WriteReport

func WriteReport(path string, report *Report) error

Types

type BuildInput

type BuildInput struct {
	WhenUTC  time.Time         `json:"whenUtc"`
	Context  string            `json:"context,omitempty"`
	Digest   string            `json:"digest,omitempty"`
	Tags     []string          `json:"tags,omitempty"`
	Bases    []string          `json:"bases,omitempty"`
	Labels   map[string]string `json:"labels,omitempty"`
	Files    []string          `json:"files,omitempty"`
	External json.RawMessage   `json:"external,omitempty"`
	Data     map[string]any    `json:"data,omitempty"`
}

type Bundle

type Bundle struct {
	Dir  string
	Data map[string]any
}

func LoadBundle

func LoadBundle(ctx context.Context, ref string) (*Bundle, error)

type Mode

type Mode string
const (
	ModeEnforce Mode = "enforce"
	ModeWarn    Mode = "warn"
)

type Report

type Report struct {
	PolicyRef   string      `json:"policyRef,omitempty"`
	Mode        Mode        `json:"mode"`
	Passed      bool        `json:"passed"`
	DenyCount   int         `json:"denyCount"`
	WarnCount   int         `json:"warnCount"`
	Deny        []Violation `json:"deny,omitempty"`
	Warn        []Violation `json:"warn,omitempty"`
	EvaluatedAt time.Time   `json:"evaluatedAt"`
}

func Evaluate

func Evaluate(ctx context.Context, bundle *Bundle, input BuildInput) (*Report, error)

func EvaluateWithQuery

func EvaluateWithQuery(ctx context.Context, bundle *Bundle, input BuildInput, query string) (*Report, error)

type Violation

type Violation struct {
	Code    string `json:"code,omitempty"`
	Message string `json:"message"`
	Path    string `json:"path,omitempty"`
	Subject string `json:"subject,omitempty"`
}

Jump to

Keyboard shortcuts

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