policy_manager

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2025 License: AGPL-3.0 Imports: 14 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FirstOf added in v0.1.7

func FirstOf[K interface{}](inputs ...*K) *K

FirstOf will return the first pointer which is not null. This is used when multiple optional options exist to fill a field, but they have an order of priority

func MergeMaps added in v0.1.7

func MergeMaps[K comparable, V comparable](maps ...map[K]V) map[K]V

func Pointer added in v0.1.7

func Pointer[K interface{}](input K) *K

Types

type Activity

type Activity struct {
	Title       string   `json:"title" mapstructure:"title"`
	Description string   `json:"description" mapstructure:"description"`
	Type        string   `json:"type" mapstructure:"type"`
	Steps       []Step   `json:"steps" mapstructure:"steps"`
	Tools       []string `json:"tools" mapstructure:"tools"`
}

type EvalOutput

type EvalOutput struct {
	Title               *string            `mapstructure:"title,omitempty"`
	Description         *string            `mapstructure:"description,omitempty"`
	Remarks             *string            `mapstructure:"remarks,omitempty"`
	Labels              *map[string]string `mapstructure:"labels,omitempty"`
	Violations          []Violation
	AdditionalVariables map[string]interface{}
}

type Labels added in v0.2.0

type Labels map[string]string
type Link struct {
	Text string `json:"text" mapstructure:"text"`
	URL  string `json:"href" mapstructure:"href"`
}

type Package

type Package string

func (Package) PurePackage

func (p Package) PurePackage() string

type Policy

type Policy struct {
	File        string
	Package     Package
	Annotations []*ast.Annotations
}

type PolicyManager

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

func New

func New(ctx context.Context, logger hclog.Logger, policyPath string) *PolicyManager

func (*PolicyManager) Execute

func (pm *PolicyManager) Execute(ctx context.Context, input interface{}) ([]Result, error)

type PolicyProcessor added in v0.1.7

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

func NewPolicyProcessor added in v0.1.7

func NewPolicyProcessor(
	logger hclog.Logger,
	labels map[string]string,
	subjects []*proto.Subject,
	components []*proto.Component,
	inventoryItems []*proto.InventoryItem,
	actors []*proto.OriginActor,
	activities []*proto.Activity,
) *PolicyProcessor

func (*PolicyProcessor) GenerateResults added in v0.1.7

func (p *PolicyProcessor) GenerateResults(ctx context.Context, policyPath string, data interface{}) ([]*proto.Evidence, error)

type Result

type Result struct {
	Policy Policy
	*EvalOutput
}

func (Result) String

func (res Result) String() string

type Risk

type Risk struct {
	Title       string `json:"title" mapstructure:"title"`
	Description string `json:"description" mapstructure:"description"`
	Statement   string `json:"statement" mapstructure:"statement"`
	Links       []Link `json:"links" mapstructure:"links"`
}

type Step

type Step struct {
	Title       string `json:"title" mapstructure:"title"`
	Description string `json:"description" mapstructure:"description"`
}

type Violation

type Violation struct {
	Title       *string `json:"title,omitempty" mapstructure:"title,omitempty"`
	Description *string `json:"description,omitempty" mapstructure:"description,omitempty"`
	Remarks     *string `json:"remarks,omitempty" mapstructure:"remarks,omitempty"`
}

Jump to

Keyboard shortcuts

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