checks

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2020 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Overview

Package checks implements Compliance Agent checks

Index

Constants

This section is empty.

Variables

View Source
var ErrGroupNotFound = errors.New("group not found")

ErrGroupNotFound is returned when a group cannot be found

View Source
var ErrInvalidIteration = errors.New("out of bounds iteration")

ErrInvalidIteration is returned when an invalid (out of bounds) iteration is performed

View Source
var (
	// ErrResourceKindNotSupported is returned in case resource kind is not supported by evaluator
	ErrResourceKindNotSupported = errors.New("resource kind not supported")
)
View Source
var ErrResourceNotSupported = errors.New("resource type not supported")

ErrResourceNotSupported is returned when resource type is not supported by Builder

View Source
var ErrRuleDoesNotApply = errors.New("rule does not apply to this environment")

ErrRuleDoesNotApply is returned when a rule cannot be applied to the current environment

View Source
var ErrRuleScopeNotSupported = errors.New("rule scope not supported")

ErrRuleScopeNotSupported is returned when resource scope is not supported

Functions

This section is empty.

Types

type Builder

type Builder interface {
	ChecksFromFile(file string, onCheck compliance.CheckVisitor) error
	CheckFromRule(meta *compliance.SuiteMeta, rule *compliance.Rule) (check.Check, error)
	Close() error
}

Builder defines an interface to build checks from rules

func NewBuilder

func NewBuilder(reporter event.Reporter, options ...BuilderOption) (Builder, error)

NewBuilder constructs a check builder

type BuilderOption

type BuilderOption func(*builder) error

BuilderOption defines a configuration option for the builder

func MayFail

func MayFail(o BuilderOption) BuilderOption

MayFail configures a builder option to succeed on failures and logs an error

func WithAudit

func WithAudit() BuilderOption

WithAudit configures using audit checks

func WithAuditClient

func WithAuditClient(cli env.AuditClient) BuilderOption

WithAuditClient configures using specific audit client

func WithDocker

func WithDocker() BuilderOption

WithDocker configures using docker

func WithDockerClient

func WithDockerClient(cli env.DockerClient) BuilderOption

WithDockerClient configurs specific docker client

func WithHostRootMount

func WithHostRootMount(hostRootMount string) BuilderOption

WithHostRootMount defines host root filesystem mount location

func WithHostname

func WithHostname(hostname string) BuilderOption

WithHostname configures hostname used by checks

func WithInterval

func WithInterval(interval time.Duration) BuilderOption

WithInterval configures default check interval

func WithKubernetesClient

func WithKubernetesClient(cli env.KubeClient) BuilderOption

WithKubernetesClient allows specific Kubernetes client

func WithMatchRule

func WithMatchRule(matcher RuleMatcher) BuilderOption

WithMatchRule configures builder to use a suite matcher

func WithMatchSuite

func WithMatchSuite(matcher SuiteMatcher) BuilderOption

WithMatchSuite configures builder to use a suite matcher

type RuleMatcher

type RuleMatcher func(*compliance.Rule) bool

RuleMatcher checks if a compliance rule is included

func IsRuleID

func IsRuleID(ruleID string) RuleMatcher

IsRuleID matches a compliance rule by ID

type SuiteMatcher

type SuiteMatcher func(*compliance.SuiteMeta) bool

SuiteMatcher checks if a compliance suite is included

func IsFramework

func IsFramework(framework string) SuiteMatcher

IsFramework matches a compliance suite by the name of the framework

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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