opa_auditor

package
v3.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PolicyQuery = "violation"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuditResultsCache

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

func NewAuditResultsCache

func NewAuditResultsCache() *AuditResultsCache

func (*AuditResultsCache) Get

func (c *AuditResultsCache) Get(constraintId string, resourceId string) (agent.AuditResultStatus, bool)

func (*AuditResultsCache) Put

func (c *AuditResultsCache) Put(constraintId string, resourceId string, status agent.AuditResultStatus)

func (*AuditResultsCache) RemoveConstraint

func (c *AuditResultsCache) RemoveConstraint(constraintId string)

func (*AuditResultsCache) RemoveResource

func (c *AuditResultsCache) RemoveResource(resourceId string)

type Constraint

type Constraint struct {
	Id         string
	TemplateId string

	Name       string
	Parameters map[string]interface{}
	Match      agent.Match

	UpdatedAt  time.Time
	CategoryId string
	Severity   string
}

type OpaAuditor

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

func New

func New(parentsStore *kuber.ParentsStore) *OpaAuditor

func (*OpaAuditor) AddConstraint

func (a *OpaAuditor) AddConstraint(constraint *agent.Constraint) (bool, error)

func (*OpaAuditor) Audit

func (a *OpaAuditor) Audit(resource *unstructured.Unstructured, constraintIds []string, useCache bool) ([]*agent.AuditResult, []error)

func (*OpaAuditor) RemoveConstraint

func (a *OpaAuditor) RemoveConstraint(id string)

func (*OpaAuditor) RemoveResource

func (a *OpaAuditor) RemoveResource(resource *unstructured.Unstructured)

func (*OpaAuditor) UpdateConstraints

func (a *OpaAuditor) UpdateConstraints(constraints []*agent.Constraint) ([]string, map[string]error)

type Template

type Template struct {
	Id          string
	Name        string
	Policy      opa.Policy
	Description string
	HowToSolve  string
	UsageCount  int
}

Jump to

Keyboard shortcuts

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