common

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2019 License: CC0-1.0 Imports: 3 Imported by: 104

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoDataToParse represents the case that there is no data to be found to be parsed (either nil or empty).
	ErrNoDataToParse = errors.New("No data to parse")
	// ErrUnknownSchemaVersion is thrown when the schema version is unknown to the parser.
	ErrUnknownSchemaVersion = errors.New("Unknown schema version")
	// ErrCantParseSemver is thrown when the semantic versioning can not be parsed.
	ErrCantParseSemver = errors.New("Can't parse semantic versioning of schema_version")
	// 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 interface {
	GetKey() string
	GetSortedStandards() []string
	GetControlKeysFor(standardKey string) []string
}

Certification is the interface for getting all the attributes for a given certification. Schema info: https://github.com/opencontrol/schemas#certifications

GetKey returns the the unique key that represents the name of the certification.

GetSortedStandards returns the list of sorted standard keys.

GetControlKeysFor returns the list of control keys for a given standard key.

type Component

type Component interface {
	GetName() string
	GetKey() string
	SetKey(string)
	GetAllSatisfies() []Satisfies
	GetVerifications() *VerificationReferences
	GetReferences() *GeneralReferences
	GetVersion() semver.Version
	SetVersion(semver.Version)
	GetResponsibleRole() string
}

Component is the basic building block for all systems. Schema info: https://github.com/opencontrol/schemas#component-yaml

GetName returns the name of the component

GetKey returns the key for the component (may not be unique). Useful for creating directories.

SetKey sets the key for the component. Useful for overriding.

GetAllSatisfies gets all the Satisfies objects for the component.

GetVerifications get all the verifications.

GetReferences get all the references.

GetVersion returns the version

SetVersion sets the version for the component.

GetResponsibleRole gets the responsible party / role for the component.

type Control

type Control interface {
	GetName() string
	GetFamily() string
	GetDescription() string
}

Control is the interface for getting all the attributes for a given control. Schema info: https://github.com/opencontrol/schemas#standards-documentation

GetName returns the string representation of the control.

GetFamily returns which family the control belongs to.

type CoveredBy

type CoveredBy struct {
	ComponentKey    string `yaml:"component_key" json:"component_key"`
	VerificationKey string `yaml:"verification_key" json:"verification_key"`
}

CoveredBy struct is the pointing mechanism for for referring to VerificationReferences in the documentation. This struct is a one-to-one mapping of `covered_by` in the component.yaml schema https://github.com/opencontrol/schemas#component-yaml

type CoveredByList

type CoveredByList []CoveredBy

CoveredByList a slice of type CoveredBy

type GeneralReference

type GeneralReference struct {
	Name string `yaml:"name" json:"name"`
	Path string `yaml:"path" json:"path"`
	Type string `yaml:"type" json:"type"`
}

GeneralReference struct contains data for the name and path of a compliance reference. This struct is a one-to-one mapping of `references` in the component.yaml schema https://github.com/opencontrol/schemas#component-yaml

type GeneralReferences

type GeneralReferences []GeneralReference

GeneralReferences a slice of type GeneralReference

func (GeneralReferences) Len

func (slice GeneralReferences) Len() int

Len returns the length of the GeneralReferences slice

func (GeneralReferences) Less

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

Less returns true if a GeneralReference is less than another reference

func (GeneralReferences) Swap

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

Swap swaps the two GeneralReferences

type OpenControl

type OpenControl interface {
	GetCertifications() []string
	GetStandards() []string
	GetComponents() []string
	GetCertificationsDependencies() []RemoteSource
	GetStandardsDependencies() []RemoteSource
	GetComponentsDependencies() []RemoteSource
}

OpenControl is an interface that every OpenControl yaml version should implement. Schema info: https://github.com/opencontrol/schemas#opencontrolyaml

GetCertifications retrieves the list of certifications

GetStandards retrieves the list of standards

GetComponents retrieves the list of components

GetCertificationsDependencies retrieves the list of certifications that this config will inherit.

GetStandardsDependencies retrieves the list of standards that this config will inherit.

GetComponentsDependencies retrieves the list of components / systems that this config will inherit.

type RemoteSource

type RemoteSource interface {
	GetURL() string
	GetContextDir() string
	GetRevision() string
	GetConfigFile() string
}

RemoteSource is an interface that any remote sources should implement in order to know how to download them.

GetURL returns the URL of the resource.

GetContextDir returns the specific directory containing the OpenControl content.

GetRevision returns the specific revision of the resource.

GetConfigFile returns the config file to look at once the resource is downloaded.

type Satisfies

type Satisfies interface {
	GetStandardKey() string
	GetControlKey() string
	GetNarratives() []Section
	GetParameters() []Section
	GetCoveredBy() CoveredByList
	GetControlOrigin() string
	GetControlOrigins() []string
	GetImplementationStatus() string
	GetImplementationStatuses() []string
}

Satisfies contains information regarding how the component satisfies a given standard and control

GetStandardKey returns the standard

GetControlKey returns the control

GetNarratives gets all the general documentation for this particular standard and control

GetParameters gets all the parameters for this particular standard and control

GetCoveredBy gets the list of all the CoveredBy

GetControlOrigin returns the control origin (only the first one if multiple)

GetControlOrigins returns all the control origins

GetImplementationStatus returns the implementation status (only the first one if multiple)

GetImplementationStatuses returns all implementation statuses

type Section

type Section interface {
	GetKey() string
	GetText() string
}

Section is a general holder that allows it to be used in something like a map

GetKey returns a unique key

GetText returns the text for the section

type Standard

type Standard interface {
	GetName() string
	GetControls() map[string]Control
	GetControl(string) Control
	GetSortedControls() []string
}

Standard is the container of all the information for a particular Standard. Schema info: https://github.com/opencontrol/schemas#standards-documentation

GetName returns the name

GetControls returns all controls associated with the standard

GetControl returns a particular control

GetSortedControls returns a list of sorted controls

type Verification

type Verification struct {
	ComponentKey  string
	SatisfiesData 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 VerificationReference

type VerificationReference struct {
	GeneralReference `yaml:",inline"`
	Key              string `yaml:"key" json:"key"`
}

VerificationReference struct is a general reference that verifies a specific control, it can be pointed to in the control documentation. This struct is a one-to-one mapping of `verifications` in the component.yaml schema https://github.com/opencontrol/schemas#component-yaml

type VerificationReferences

type VerificationReferences []VerificationReference

VerificationReferences a slice of type VerificationReference

func (VerificationReferences) Get

Get returns a VerificationReference of the given key

func (VerificationReferences) Len

func (slice VerificationReferences) Len() int

Len returns the length of the VerificationReference slice

func (VerificationReferences) Less

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

Less returns true if a VerificationReference is less than another reference

func (VerificationReferences) Swap

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

Swap swaps the two VerificationReferences

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

type Workspace

type Workspace interface {
	LoadComponents(string) []error
	LoadStandards(string) []error
	LoadCertification(string) error
	GetCertification() Certification
	GetAllComponents() []Component
	GetComponent(componentKey string) (Component, bool)
	GetAllStandards() []Standard
	GetStandard(standardKey string) (Standard, bool)
	GetAllVerificationsWith(standardKey string, controlKey string) Verifications
}

Workspace represents all the information such as components, standards, and certification as well as the result information such as the justifications.

Directories

Path Synopsis
Code generated by mockery v1.0.0.
Code generated by mockery v1.0.0.

Jump to

Keyboard shortcuts

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