Documentation ¶
Index ¶
- Variables
- func CompileConfig(ids []string, path string) ([]byte, error)
- func CreateOrUpdateConfig(changeId, id, path, userMech, userId, message string, data []byte) error
- func DeleteConfig(changeId, id, path, userMech, userId, message string) error
- func ExplainConfig(ids []string, path string) ([]byte, error)
- func NewMemoryRepository(data map[string]*ChangeSet) *memoryRepository
- type ChangeSet
- type ConfigRepository
Constants ¶
This section is empty.
Variables ¶
var ( ErrPathNotFound = errors.New("Config path not found") ErrIdNotFound = errors.New("Config ID not found") DefaultRepository ConfigRepository )
Functions ¶
func CompileConfig ¶
CompileConfig will combine multiple configs together.
func CreateOrUpdateConfig ¶
CreateOrUpdateConfig will create or update the config for id at the specified path. Message should be a description of the change. Data should be the JSON data. userMech identifies the authentication mechanism of the scope from which this change was applied
func DeleteConfig ¶
DeleteConfig will delete the node at the specified path It will return ErrPathNotFound if the path does not exist
func ExplainConfig ¶
ExplainConfig returns the compiled config except that instead of showing the original values, it shows which id was responsible for setting it
func NewMemoryRepository ¶
Types ¶
type ChangeSet ¶
type ChangeSet struct { // Id is a unique ID for the change Id string `cf:"configservice" key:"Id" name:"id" json:"id"` // Body is the JSON being applied Body []byte `name:"body" json:"body"` // Timestamp is when this happened Timestamp time.Time `name:"timestamp" json:"timestamp"` // UserMech identifies the authentication mechanism of the scope from which this change was applied UserMech string `name:"userMech" json:"userMech"` // UserId identifies the authenticated user ID of the scope from which this change was applied UserId string `name:"userId" json:"userId"` // Message tells us some human-readable message about the change Message string `name:"message" json:"message"` // ChangeId is some unique ID for this change ChangeId string `name:"changeId" json:"changeId"` // Path of the config being updated Path string `name:"path" json:"path"` // Old value for the config OldConfig []byte `name:"oldConfig" json:"oldConfig"` }
ChangeSet represents some change to our config
func ReadConfig ¶
ReadConfig returns the config item with the specified id. The path is optional, and if included will only return the contents at that path within the config. For reference, the changeset is included which will contain meta data about the last update
type ConfigRepository ¶
type ConfigRepository interface { ReadConfig(ids []string) ([]*ChangeSet, error) UpdateConfig(cs *ChangeSet) error ChangeLog(start, end time.Time, count int, lastId string) ([]*ChangeSet, string, error) ServiceChangeLog(id string, start, end time.Time, count int, lastId string) ([]*ChangeSet, string, error) }