model

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package model defines the comply data model.

Markdown Wrappers

The model package treats typed markdown files as model objects. All wrapped markdown documents are assumed to have a YAML header and a markdown body separated by three dashes: "---".

Local Ticket Cache

Tickets are defined externally (in the configured ticketing system), and cached locally for rapid dashboard rendering.

Index

Constants

View Source
const (
	// Jira from Atlassian.
	Jira = TicketSystem(config.Jira)
	// GitHub from GitHub.
	GitHub = TicketSystem(config.GitHub)
	// GitLab from GitLab.
	GitLab = TicketSystem(config.GitLab)
	// NoTickets indicates no ticketing system integration.
	NoTickets = TicketSystem(config.NoTickets)
)
View Source
const (
	Open   = TicketState("open")
	Closed = TicketState("closed")
)

Variables

This section is empty.

Functions

func ControlsSatisfied

func ControlsSatisfied(data *Data) map[string][]string

ControlsSatisfied determines the unique controls currently satisfied by all Narratives, Policies, and Procedures

func DB

func DB() *scribble.Driver

DB provides a singleton reference to a local json cache; will panic if storage location is not writeable.

func Register

func Register(ts TicketSystem, plugin TicketPlugin)

Register ticketing system plugin.

Types

type Audit

type Audit struct {
	ID   string
	Name string
}

type Control

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

type Data

type Data struct {
	Standards  []*Standard
	Narratives []*Document
	Policies   []*Document
	Procedures []*Procedure
	Tickets    []*Ticket
	Audits     []*Audit
}

func ReadData

func ReadData() (*Data, error)

ReadData loads all records from both the filesystem and ticket cache.

type Document added in v1.2.1

type Document struct {
	Name    string `yaml:"name"`
	Acronym string `yaml:"acronym"`

	Revisions      []Revision   `yaml:"majorRevisions"`
	Satisfies      Satisfaction `yaml:"satisfies"`
	FullPath       string
	OutputFilename string
	ModifiedAt     time.Time
	Body           string
}

func ReadNarratives

func ReadNarratives() ([]*Document, error)

ReadNarratives loads narrative descriptions from the filesystem.

func ReadPolicies

func ReadPolicies() ([]*Document, error)

ReadPolicies loads policy documents from the filesystem.

type Procedure

type Procedure struct {
	Name string `yaml:"name"`
	ID   string `yaml:"id"`
	Cron string `yaml:"cron"`

	Revisions      []Revision   `yaml:"majorRevisions"`
	Satisfies      Satisfaction `yaml:"satisfies"`
	FullPath       string
	OutputFilename string
	ModifiedAt     time.Time
	Body           string
}

func ReadProcedures

func ReadProcedures() ([]*Procedure, error)

ReadProcedures loads procedure descriptions from the filesystem.

type Revision

type Revision struct {
	Date    string `yaml:"date"`
	Comment string `yaml:"comment"`
}

type Satisfaction

type Satisfaction map[string][]string

type Standard

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

func ReadStandards

func ReadStandards() ([]*Standard, error)

ReadStandards loads standard definitions from the filesystem.

type Ticket

type Ticket struct {
	ID         string
	Name       string
	State      TicketState
	Body       string
	Attributes map[string]interface{}
	ClosedAt   *time.Time
	CreatedAt  *time.Time
	UpdatedAt  *time.Time
}

func ReadTickets

func ReadTickets() ([]*Ticket, error)

ReadTickets returns all known tickets, or an empty list in the event the ticket cache is empty or unavailable.

func (*Ticket) Bool

func (t *Ticket) Bool(name string) bool

func (*Ticket) ProcedureID

func (t *Ticket) ProcedureID() string

func (*Ticket) SetBool

func (t *Ticket) SetBool(name string)
type TicketLinks struct {
	ProcedureOpen string
	ProcedureAll  string
	AuditOpen     string
	AuditAll      string
}

type TicketPlugin

type TicketPlugin interface {
	Get(ID string) (*Ticket, error)
	FindOpen() ([]*Ticket, error)
	FindByTag(name, value string) ([]*Ticket, error)
	FindByTagName(name string) ([]*Ticket, error)
	Create(ticket *Ticket, labels []string) error
	Configure(map[string]interface{}) error
	Prompts() map[string]string
	Links() TicketLinks
	LinkFor(ticket *Ticket) string
	Configured() bool
}

TicketPlugin models support for ticketing systems.

func GetPlugin

func GetPlugin(ts TicketSystem) TicketPlugin

GetPlugin loads the ticketing database.

type TicketState

type TicketState string

type TicketSystem

type TicketSystem string

TicketSystem is the type of ticket database.

Jump to

Keyboard shortcuts

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