policy

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package policy implements cluster policy rules and policy evaluation features

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloneFn

type CloneFn func(s storage.Storer, worktree billy.Filesystem, o *git.CloneOptions) (*git.Repository, error)

type GKEPolicyAgent added in v1.2.0

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

func (*GKEPolicyAgent) Compile added in v1.2.0

func (pa *GKEPolicyAgent) Compile(files []*PolicyFile) error

func (*GKEPolicyAgent) Evaluate added in v1.2.0

func (pa *GKEPolicyAgent) Evaluate(input interface{}, packageBase string) (*PolicyEvaluationResult, error)

func (*GKEPolicyAgent) GetPolicies added in v1.2.0

func (pa *GKEPolicyAgent) GetPolicies() []*Policy

func (*GKEPolicyAgent) ParseCompiled added in v1.2.0

func (pa *GKEPolicyAgent) ParseCompiled() []error

func (*GKEPolicyAgent) WithFiles added in v1.2.0

func (pa *GKEPolicyAgent) WithFiles(files []*PolicyFile, excludes cfg.ConfigPolicyExclusions) error

type GitClient

type GitClient interface {
	Clone(s storage.Storer, worktree billy.Filesystem, o *git.CloneOptions) (*git.Repository, error)
}

type GitPolicyFile

type GitPolicyFile struct {
	Hash string
	*PolicyFile
}

type GitPolicySource

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

func (GitPolicySource) GetPolicyFiles

func (src GitPolicySource) GetPolicyFiles() ([]*PolicyFile, error)

func (GitPolicySource) String

func (src GitPolicySource) String() string

type GitTree

type GitTree interface {
	TreeEntryFile(e *object.TreeEntry) (*object.File, error)
}

type GitTreeWalker

type GitTreeWalker interface {
	Next() (name string, entry object.TreeEntry, err error)
	Close()
}

type LocalPolicySource

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

func (LocalPolicySource) GetPolicyFiles

func (src LocalPolicySource) GetPolicyFiles() ([]*PolicyFile, error)

func (LocalPolicySource) String

func (src LocalPolicySource) String() string

type Policy

type Policy struct {
	Name             string
	File             string
	Title            string
	Description      string
	Group            string
	Severity         string
	Category         string
	Valid            bool
	Violations       []string
	ProcessingErrors []error
	CisVersion       string
	CisID            string
	ExternalURI      string
	Recommendation   string
}

func NewPolicyFromEvalResult

func NewPolicyFromEvalResult(result *RegoEvaluationResult, errors []error) *Policy

func (Policy) MetadataErrors

func (p Policy) MetadataErrors() []string

type PolicyAgent

type PolicyAgent interface {
	Compile(files []*PolicyFile) error
	WithFiles(files []*PolicyFile, excludes cfg.ConfigPolicyExclusions) error
	Evaluate(input interface{}, packageBase string) (*PolicyEvaluationResult, error)
	GetPolicies() []*Policy
}

func NewPolicyAgent

func NewPolicyAgent(ctx context.Context) PolicyAgent

type PolicyEvaluationResult

type PolicyEvaluationResult struct {
	ClusterID string
	Policies  []*Policy
}

type PolicyFile

type PolicyFile struct {
	Name     string
	FullName string
	Content  string
}

type PolicySource

type PolicySource interface {
	GetPolicyFiles() ([]*PolicyFile, error)
	String() string
}

func NewGitPolicySource

func NewGitPolicySource(repoURL string, repoBrach string, policyDir string) PolicySource

func NewLocalPolicySource

func NewLocalPolicySource(rootDirectory string) PolicySource

type ReadFn

type ReadFn func(name string) ([]byte, error)

type RegoEvaluationResult

type RegoEvaluationResult struct {
	Name       string
	Valid      bool
	Violations []string
}

type WalkFn

type WalkFn func(root string, fn filepath.WalkFunc) error

Jump to

Keyboard shortcuts

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