models

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2016 License: CC0-1.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrReadFile is raised when a file can not be read
	ErrReadFile = errors.New("Unable to read the file")
	// ErrCertificationSchema is raised a certification cannot be parsed
	ErrCertificationSchema = errors.New("Unable to parse certification")
	// ErrStandardSchema is raised a standard cannot be parsed
	ErrStandardSchema = errors.New("Unable to parse standard")
)

Functions

This section is empty.

Types

type Certification

type Certification struct {
	Key       string              `yaml:"name" json:"name"`
	Standards map[string]Standard `yaml:"standards" json:"standards"`
}

Certification struct is a collection of specific standards and controls Schema info: https://github.com/opencontrol/schemas#certifications

func (Certification) GetSortedData

func (certification Certification) GetSortedData(callback func(string, string))

GetSortedData returns a list of sorted standards

type Control

type Control struct {
	Family string `yaml:"family" json:"family"`
	Name   string `yaml:"name" json:"name"`
}

Control struct stores data on a specific security requirement Schema info: https://github.com/opencontrol/schemas#standards-documentation

type Justifications

type Justifications struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Justifications struct contains the mapping that links controls to specific components

func NewJustifications

func NewJustifications() *Justifications

NewJustifications creates a new justification

func (*Justifications) Add

func (justifications *Justifications) Add(standardKey string, controlKey string, componentKey string, satisfies base.Satisfies)

Add methods adds a new mapping to the justification while locking

func (*Justifications) Get

func (justifications *Justifications) Get(standardKey string, controlKey string) Verifications

Get retrieves justifications for a specific standard and control

func (*Justifications) GetAndApply

func (justifications *Justifications) GetAndApply(standardKey string, controlKey string, callback func(selectJustifications Verifications))

GetAndApply get a justification set and apply a generic function

func (*Justifications) LoadMappings

func (justifications *Justifications) LoadMappings(component base.Component)

LoadMappings loads a set of mappings from a component

type OpenControl

type OpenControl struct {
	Components     *components.Components
	Standards      *Standards
	Justifications *Justifications
	Certification  *Certification
}

OpenControl struct combines components, standards, and a certification data For more information on the opencontrol schema visit: https://github.com/opencontrol/schemas

func LoadData

func LoadData(openControlDir string, certificationPath string) (*OpenControl, []error)

LoadData creates a new instance of OpenControl struct and loads the components, standards, and certification data.

func NewOpenControl

func NewOpenControl() *OpenControl

NewOpenControl initializes an empty OpenControl struct

func (*OpenControl) LoadCertification

func (openControl *OpenControl) LoadCertification(certificationFile string) error

LoadCertification struct loads certifications into a Certification struct and add it to the main object.

func (*OpenControl) LoadComponent

func (openControl *OpenControl) LoadComponent(componentDir string) error

LoadComponent imports components into a Component struct and adds it to the Components map.

func (*OpenControl) LoadComponents

func (openControl *OpenControl) LoadComponents(directory string) []error

LoadComponents loads multiple components by searching for components in a given directory

func (*OpenControl) LoadStandard

func (openControl *OpenControl) LoadStandard(standardFile string) error

LoadStandard imports a standard into the Standard struct and adds it to the main object.

func (*OpenControl) LoadStandards

func (openControl *OpenControl) LoadStandards(standardsDir string) []error

LoadStandards loads multiple standards by searching for components in a given directory

type Standard

type Standard struct {
	Name     string             `yaml:"name" json:"name"`
	Controls map[string]Control `yaml:",inline"`
}

Standard struct is a collection of security requirements Schema info: https://github.com/opencontrol/schemas#standards-documentation

func (Standard) GetSortedData

func (standard Standard) GetSortedData(callback func(string))

GetSortedData returns a list of sorted controls

type Standards

type Standards struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Standards struct is a thread save mapping of Standards

func NewStandards

func NewStandards() *Standards

NewStandards creates an instance of Components struct

func (*Standards) Add

func (standards *Standards) Add(standard *Standard)

Add adds a standard to the standards mapping

func (*Standards) Get

func (standards *Standards) Get(standardName string) *Standard

Get retrieves a standard

func (*Standards) GetAll

func (standards *Standards) GetAll() map[string]*Standard

GetAll retrieves all the standards

type Verification

type Verification struct {
	ComponentKey  string
	SatisfiesData base.Satisfies
}

Verification struct holds data for a specific component and verification This is an internal data structure that helps map standards and controls to components

type Verifications

type Verifications []Verification

Verifications is a slice of type Verifications

func (Verifications) Len

func (slice Verifications) Len() int

Len returns the length of the GeneralReferences slice

func (Verifications) Less

func (slice Verifications) Less(i, j int) bool

Less returns true if a GeneralReference is less than another reference

func (Verifications) Swap

func (slice Verifications) Swap(i, j int)

Swap swaps the two GeneralReferences

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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