packaging

package
v0.1.8-rc Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EvalPackage

func EvalPackage(ctx context.Context, pkg Package, input interface{}) (*results.ResultCollection, error)

EvalPackage evaluated the rules in a package given an input

Types

type Package

type Package interface {
	// PolicyManifest returns the manifest data about the policy
	// in struct format.
	PolicyManifest() *PolicyManifest

	// Return any rego files, with their names as the keys and
	// their content as strings.
	RegoText() map[string]string
}

A Package is an interface that Package Sources should implement to provide details about a package in an agnostic way.

type PolicyManifest

type PolicyManifest struct {
	Namespace     string    `yaml:"namespace"`
	ID            string    `yaml:"id"`
	DataGatherers []string  `yaml:"data-gatherers,omitempty"`
	RootQuery     string    `yaml:"root-query"`
	Name          string    `yaml:"name"`
	Description   string    `yaml:"description,omitempty"`
	Sections      []Section `yaml:"sections,omitempty"`
}

PolicyManifest contains all the information about the policy manifest of the package.

func (*PolicyManifest) GlobalID

func (m *PolicyManifest) GlobalID() string

GlobalID returns a global unique ID that contains the namespace and the ID.

type Rule

type Rule struct {
	ID          string   `yaml:"id"`
	Name        string   `yaml:"name"`
	Description string   `yaml:"description,omitempty"`
	Manual      bool     `yaml:"manual,omitempty"`
	Remediation string   `yaml:"remediation,omitempty"`
	Links       []string `yaml:"links,omitempty"`
}

Rule holds the information for a rule.

type Section

type Section struct {
	ID          string `yaml:"id"`
	Name        string `yaml:"name"`
	Description string `yaml:"description,omitempty"`
	Rules       []Rule `yaml:"rules,omitempty"`
}

Section holds the information for a section of the policy manifest.

Jump to

Keyboard shortcuts

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