policyconfig

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Version            string         `json:"version"`
	Profile            policy.Profile `json:"profile"`
	RulePack           string         `json:"rulePack"`
	NonBypassableRules *bool          `json:"nonBypassableRules"`
}

func DefaultConfig

func DefaultConfig() Config

type DecisionMetadata

type DecisionMetadata struct {
	ConfigDigest       string `json:"config_digest"`
	ActivationID       string `json:"activation_id"`
	ConfigSource       string `json:"config_source"`
	ConfigStatus       string `json:"config_status"`
	PolicyVersion      string `json:"policy_version"`
	RulePack           string `json:"rule_pack"`
	RulePackVersion    string `json:"rule_pack_version"`
	Profile            string `json:"profile"`
	NonBypassableRules bool   `json:"non_bypassable_rules"`
}

type Option

type Option func(*Store)

func WithClock

func WithClock(clock clockFunc) Option

type Snapshot

type Snapshot struct {
	Config Config

	ConfigDigest string
	ActivationID string
	Source       Source
	Status       Status
	LoadedAt     time.Time

	PolicyVersion   string
	RulePack        string
	RulePackVersion string
}

func (Snapshot) DecisionMetadata

func (s Snapshot) DecisionMetadata() DecisionMetadata

func (Snapshot) ToPolicyConfig

func (s Snapshot) ToPolicyConfig() policy.Config

type Source

type Source string
const (
	SourceActiveFile    Source = "active-file"
	SourceDefault       Source = "default"
	SourceLastKnownGood Source = "last-known-good"
)

type Status

type Status string
const (
	StatusOK               Status = "ok"
	StatusDefaultedMissing Status = "defaulted_missing"
	StatusRecoveredLKG     Status = "recovered_lkg"
	StatusDefaultedInvalid Status = "defaulted_invalid"
)

type Store

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

func Open

func Open(dir string, opts ...Option) (*Store, error)

func (*Store) Activate

func (s *Store) Activate(ctx context.Context, candidate Config) (Snapshot, error)

func (*Store) ActivateProfile

func (s *Store) ActivateProfile(ctx context.Context, profile policy.Profile) (Snapshot, error)

func (*Store) Current

func (s *Store) Current() Snapshot

func (*Store) Load

func (s *Store) Load(ctx context.Context) (Snapshot, error)

type ValidationError

type ValidationError struct {
	Reason string
}

func (ValidationError) Error

func (e ValidationError) Error() string

Jump to

Keyboard shortcuts

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