emissary/internal/spec/uci/spec.go

51 lines
1.0 KiB
Go
Raw Permalink Normal View History

package uci
2023-02-02 10:55:24 +01:00
import (
"forge.cadoles.com/Cadoles/emissary/internal/openwrt/uci"
"forge.cadoles.com/Cadoles/emissary/internal/spec"
)
2023-02-02 10:55:24 +01:00
const (
Name string = "uci.emissary.cadoles.com"
Version string = "0.0.0"
)
2023-02-02 10:55:24 +01:00
type Spec struct {
2023-03-21 15:21:19 +01:00
Revision int `json:"revision"`
2023-02-02 10:55:24 +01:00
Config *uci.UCI `json:"config"`
PostImportCommands []*UCIPostImportCommand `json:"postImportCommands"`
}
type UCIPostImportCommand struct {
Command string `json:"command"`
Args []string `json:"args"`
}
func (s *Spec) SpecDefinitionName() string {
return Name
}
func (s *Spec) SpecDefinitionVersion() string {
return Version
2023-02-02 10:55:24 +01:00
}
func (s *Spec) SpecRevision() int {
return s.Revision
2023-02-02 10:55:24 +01:00
}
func (s *Spec) SpecData() map[string]any {
return map[string]any{
"config": s.Config,
"postImportCommands": s.PostImportCommands,
}
2023-02-02 10:55:24 +01:00
}
func NewSpec() *Spec {
return &Spec{
2023-03-13 10:44:58 +01:00
Revision: -1,
2023-02-02 10:55:24 +01:00
PostImportCommands: make([]*UCIPostImportCommand, 0),
}
}
var _ spec.Spec = &Spec{}