emissary/internal/spec/uci/spec.go

44 lines
931 B
Go

package uci
import (
"forge.cadoles.com/Cadoles/emissary/internal/openwrt/uci"
"forge.cadoles.com/Cadoles/emissary/internal/spec"
)
const NameUCI spec.Name = "uci.emissary.cadoles.com"
type Spec struct {
Revision int `json:"revision"`
Config *uci.UCI `json:"config"`
PostImportCommands []*UCIPostImportCommand `json:"postImportCommands"`
}
type UCIPostImportCommand struct {
Command string `json:"command"`
Args []string `json:"args"`
}
func (s *Spec) SpecName() spec.Name {
return NameUCI
}
func (s *Spec) SpecRevision() int {
return s.Revision
}
func (s *Spec) SpecData() map[string]any {
return map[string]any{
"config": s.Config,
"postImportCommands": s.PostImportCommands,
}
}
func NewSpec() *Spec {
return &Spec{
Revision: -1,
PostImportCommands: make([]*UCIPostImportCommand, 0),
}
}
var _ spec.Spec = &Spec{}