Documentation ¶
Index ¶
- Constants
- type Cfgu
- type CfguType
- type Command
- type Config
- type ConfigSchema
- type ConfigSchemaContents
- type ConfigSchemaContentsValue
- type ConfigSchemaType
- type ConfigSet
- type ConfigStore
- type ConfigStoreContents
- type ConfigStoreContentsElement
- type ConfigStoreQuery
- type ConfiguConfigStore
- type ConfiguError
- type EvalCommand
- type EvalCommandReturn
- type EvalCommandReturnContext
- type EvalCommandReturnResult
- type EvalCommandReturnValue
- type EvaluatedConfigOrigin
- type IConfigStore
- type InMemoryStore
- type JsonFileConfigStore
- func (s JsonFileConfigStore) Get(queries []ConfigStoreQuery) ([]Config, error)
- func (s JsonFileConfigStore) GetType() string
- func (s JsonFileConfigStore) Read() ([]ConfigStoreContentsElement, error)
- func (s JsonFileConfigStore) Set(configs []Config) error
- func (s JsonFileConfigStore) Write(elements []ConfigStoreContentsElement) error
- type UpsertCommand
Constants ¶
View Source
const ( SEPARATOR string = "/" ROOT string = "" ROOT_LABEL string = "/" )
View Source
const (
EXT string = ".cfgu"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cfgu ¶
type Cfgu struct { Default *string `json:"default,omitempty"` Depends []string `json:"depends,omitempty"` Description *string `json:"description,omitempty"` Options []string `json:"options,omitempty"` Pattern *string `json:"pattern,omitempty"` Required *bool `json:"required,omitempty"` Schema map[string]interface{} `json:"schema,omitempty"` Template *string `json:"template,omitempty"` Type CfguType `json:"type"` }
A generic declaration of a Config, aka Cfgu that specifies information about its type and other characteristics
func UnmarshalCfgu ¶
type CfguType ¶
type CfguType string
const ( AWSRegion CfguType = "AWSRegion" AZRegion CfguType = "AZRegion" AlibabaRegion CfguType = "AlibabaRegion" Arn CfguType = "ARN" Base64 CfguType = "Base64" Boolean CfguType = "Boolean" Color CfguType = "Color" ConnectionString CfguType = "ConnectionString" Country CfguType = "Country" Currency CfguType = "Currency" DateTime CfguType = "DateTime" DockerImage CfguType = "DockerImage" Domain CfguType = "Domain" Email CfguType = "Email" GCPRegion CfguType = "GCPRegion" Hex CfguType = "Hex" IBMRegion CfguType = "IBMRegion" IPv4 CfguType = "IPv4" IPv6 CfguType = "IPv6" JSONSchema CfguType = "JSONSchema" Language CfguType = "Language" LatLong CfguType = "LatLong" Locale CfguType = "Locale" MACAddress CfguType = "MACAddress" MIMEType CfguType = "MIMEType" Md5 CfguType = "MD5" MobilePhone CfguType = "MobilePhone" MongoID CfguType = "MongoId" Number CfguType = "Number" OracleRegion CfguType = "OracleRegion" RegEx CfguType = "RegEx" SHA CfguType = "SHA" SemVer CfguType = "SemVer" String CfguType = "String" URL CfguType = "URL" UUID CfguType = "UUID" )
func UnmarshalCfguType ¶
type Config ¶
A generic representation of a software configuration, aka Config
func UnmarshalConfig ¶
type ConfigSchema ¶
type ConfigSchema struct { Path string `json:"path"` Type ConfigSchemaType `json:"type"` }
An interface of a <file>.cfgu.json, aka ConfigSchema that contains binding records between a unique Config.<key> and its Cfgu declaration
func NewConfigSchema ¶
func NewConfigSchema(path string) (schema ConfigSchema, err error)
func UnmarshalConfigSchema ¶
func UnmarshalConfigSchema(data []byte) (ConfigSchema, error)
func (*ConfigSchema) Marshal ¶
func (r *ConfigSchema) Marshal() ([]byte, error)
func (ConfigSchema) Parse ¶
func (schema ConfigSchema) Parse() (cfgu ConfigSchemaContents, err error)
func (ConfigSchema) Read ¶
func (schema ConfigSchema) Read() []byte
type ConfigSchemaContents ¶
type ConfigSchemaContents map[string]ConfigSchemaContentsValue
func UnmarshalConfigSchemaContents ¶
func UnmarshalConfigSchemaContents(data []byte) (ConfigSchemaContents, error)
func (*ConfigSchemaContents) Marshal ¶
func (r *ConfigSchemaContents) Marshal() ([]byte, error)
type ConfigSchemaContentsValue ¶
type ConfigSchemaContentsValue struct { Default *string `json:"default,omitempty"` Depends []string `json:"depends,omitempty"` Description *string `json:"description,omitempty"` Options []string `json:"options,omitempty"` Pattern *string `json:"pattern,omitempty"` Required *bool `json:"required,omitempty"` Schema map[string]interface{} `json:"schema,omitempty"` Template *string `json:"template,omitempty"` Type CfguType `json:"type"` }
func UnmarshalConfigSchemaContentsValue ¶
func UnmarshalConfigSchemaContentsValue(data []byte) (ConfigSchemaContentsValue, error)
func (*ConfigSchemaContentsValue) Marshal ¶
func (r *ConfigSchemaContentsValue) Marshal() ([]byte, error)
type ConfigSchemaType ¶
type ConfigSchemaType string
const (
JSON ConfigSchemaType = "json"
)
func UnmarshalConfigSchemaType ¶
func UnmarshalConfigSchemaType(data []byte) (ConfigSchemaType, error)
func (*ConfigSchemaType) Marshal ¶
func (r *ConfigSchemaType) Marshal() ([]byte, error)
type ConfigSet ¶
An interface of a path in an hierarchy, aka ConfigSet that uniquely groups Config.<key> with their Config.<value>.
func NewConfigSet ¶
func UnmarshalConfigSet ¶
type ConfigStore ¶
type ConfigStore struct {
Type string `json:"type"`
}
An interface of a storage, aka ConfigStore that I/Os Config records (Config[])
func UnmarshalConfigStore ¶
func UnmarshalConfigStore(data []byte) (ConfigStore, error)
func (*ConfigStore) Marshal ¶
func (r *ConfigStore) Marshal() ([]byte, error)
type ConfigStoreContents ¶
type ConfigStoreContents []ConfigStoreContentsElement
func UnmarshalConfigStoreContents ¶
func UnmarshalConfigStoreContents(data []byte) (ConfigStoreContents, error)
func (*ConfigStoreContents) Marshal ¶
func (r *ConfigStoreContents) Marshal() ([]byte, error)
type ConfigStoreContentsElement ¶
type ConfigStoreContentsElement struct { Key string `json:"key"` Set string `json:"set"` Value string `json:"value"` }
func UnmarshalConfigStoreContentsElement ¶
func UnmarshalConfigStoreContentsElement(data []byte) (ConfigStoreContentsElement, error)
func (*ConfigStoreContentsElement) Marshal ¶
func (r *ConfigStoreContentsElement) Marshal() ([]byte, error)
type ConfigStoreQuery ¶
func UnmarshalConfigStoreQuery ¶
func UnmarshalConfigStoreQuery(data []byte) (ConfigStoreQuery, error)
func (*ConfigStoreQuery) Marshal ¶
func (r *ConfigStoreQuery) Marshal() ([]byte, error)
type ConfiguConfigStore ¶
func (ConfiguConfigStore) Get ¶
func (s ConfiguConfigStore) Get(queries []ConfigStoreQuery) ([]Config, error)
func (ConfiguConfigStore) GetType ¶
func (s ConfiguConfigStore) GetType() string
func (ConfiguConfigStore) Set ¶
func (s ConfiguConfigStore) Set(configs []Config) error
type ConfiguError ¶
func (ConfiguError) Error ¶
func (err ConfiguError) Error() string
type EvalCommand ¶
type EvalCommand struct { Store IConfigStore Set ConfigSet Schema ConfigSchema Configs map[string]string Validate *bool Previous *EvalCommandReturn }
func (EvalCommand) Run ¶
func (c EvalCommand) Run() (EvalCommandReturn, error)
type EvalCommandReturn ¶
type EvalCommandReturn map[string]*EvalCommandReturnValue
type EvalCommandReturnContext ¶
type EvalCommandReturnContext struct { Store string Set string Schema string Key string Cfgu ConfigSchemaContentsValue }
type EvalCommandReturnResult ¶
type EvalCommandReturnResult struct { Origin EvaluatedConfigOrigin Source string Value string }
type EvalCommandReturnValue ¶
type EvalCommandReturnValue struct { Context EvalCommandReturnContext Result EvalCommandReturnResult }
type EvaluatedConfigOrigin ¶
type EvaluatedConfigOrigin string
const ( ConfigsOverride EvaluatedConfigOrigin = "CONFIGS_OVERRIDE" StoreSet EvaluatedConfigOrigin = "STORE_SET" SchemaTemplate EvaluatedConfigOrigin = "SCHEMA_TEMPLATE" SchemaDefault EvaluatedConfigOrigin = "SCHEMA_DEFAULT" EmptyValue EvaluatedConfigOrigin = "EMPTY_VALUE" )
type IConfigStore ¶
type InMemoryStore ¶
type InMemoryStore struct {
// contains filtered or unexported fields
}
func (*InMemoryStore) Get ¶
func (s *InMemoryStore) Get(queries []ConfigStoreQuery) ([]Config, error)
func (*InMemoryStore) GetType ¶
func (s *InMemoryStore) GetType() string
func (*InMemoryStore) Set ¶
func (s *InMemoryStore) Set(configs []Config) error
type JsonFileConfigStore ¶
type JsonFileConfigStore struct {
Path string
}
func (JsonFileConfigStore) Get ¶
func (s JsonFileConfigStore) Get(queries []ConfigStoreQuery) ([]Config, error)
func (JsonFileConfigStore) GetType ¶
func (s JsonFileConfigStore) GetType() string
func (JsonFileConfigStore) Read ¶
func (s JsonFileConfigStore) Read() ([]ConfigStoreContentsElement, error)
func (JsonFileConfigStore) Set ¶
func (s JsonFileConfigStore) Set(configs []Config) error
func (JsonFileConfigStore) Write ¶
func (s JsonFileConfigStore) Write(elements []ConfigStoreContentsElement) error
type UpsertCommand ¶
type UpsertCommand struct { Store IConfigStore Set ConfigSet Schema ConfigSchema Configs map[string]string }
func (UpsertCommand) Run ¶
func (c UpsertCommand) Run() (interface{}, error)
Click to show internal directories.
Click to hide internal directories.