policy

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Contents

type Contents map[string]string

Contents is a map of file paths to their policy data (Rego).

type Diff

type Diff struct {
	ID             PolicyDiffID      `json:"id"`
	Title          string            `json:"title"`
	Description    string            `json:"description"`
	CreatedAt      time.Time         `json:"created_at"`
	New            map[string]string `json:"new"`
	Old            map[string]string `json:"old"`
	NewTestDataSet *TestDataSet      `json:"new_test_data_set"`
}

func NewDiff

func NewDiff(ctx context.Context, title, description string, new, old map[string]string, newTestDataSet *TestDataSet) *Diff

func (*Diff) DiffPolicy

func (x *Diff) DiffPolicy() map[string]string

type PolicyDiffID

type PolicyDiffID string

PolicyDiffID is a unique identifier for a policy diff.

func NewPolicyDiffID

func NewPolicyDiffID() PolicyDiffID

func (PolicyDiffID) String

func (x PolicyDiffID) String() string

type QueryFunc

type QueryFunc func(ctx context.Context, query string, data any, result any, queryOptions ...opaq.QueryOption) error

type TestData

type TestData struct {
	// Metafiles is the metadata (README) of the test data that is generated by the AI.
	Metafiles map[types.AlertSchema]map[string]string
	// Data is the test data that is from the original alert or modified.
	Data map[types.AlertSchema]map[string]any
}

func NewTestData

func NewTestData() *TestData

func (*TestData) Add

func (x *TestData) Add(schema types.AlertSchema, filename string, data any)

func (*TestData) Clone

func (x *TestData) Clone() *TestData

func (TestData) LogValue

func (x TestData) LogValue() slog.Value

type TestDataSet

type TestDataSet struct {
	Detect *TestData `json:"detect"`
	Ignore *TestData `json:"ignore"`
}

func NewTestDataSet

func NewTestDataSet() *TestDataSet

func (*TestDataSet) Test

func (x *TestDataSet) Test(ctx context.Context, queryFunc QueryFunc) []error

Jump to

Keyboard shortcuts

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