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 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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