Documentation
¶
Overview ¶
Package config stores the policy configuration Go representation, a global variable called Policies that is for reading the Config as it is updated on disk and configuration validation to make sure errors don't slip in to the Config.
A configuration is stored in JSON and looks like:
{ "Name": "SateliteDiskErase", "Policies": [ { "Name": "restrictJobTypes", "Settings": { "AllowedJobs": [ "JTValidateDecom", "JTDiskErase", "JTSleep", "JTGetTokenFromBucket" ] } } ] }
...
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { // Workflows stored by name. Workflows map[string]Workflow // contains filtered or unexported fields }
Config represents a policy config that is stored on disk.
type Policy ¶
type Policy struct { // Name is the name of the policy type. Name string // Settings are the settings for that particular policy. We store this as // a RawMessage so that we can parse it into the typed version on a second pass. Settings json.RawMessage // SettingsTyped is the parsed version of the Settings. This is not stored in the Config. SettingsTyped policy.Settings `json:"-"` }
Policy is the policy to apply to a Workflow.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader is used to read the current policy configuration. The configuration is checked for updates every 10 seconds and if there is a valid configuration, it is updated. If not, an error is recorded. Once a Reader is returned by New(), it guarantees to always return a Config. If there is an error also returned, then the Config is the last known good Config.
var Policies *Reader
Policies provides the policy Reader that can be used to read the current policy.