emissary/internal/spec/uci/spec.go

43 lines
906 B
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 NameUCI spec.Name = "uci.emissary.cadoles.com"
2023-02-02 10:55:24 +01:00
type Spec struct {
2023-02-02 10:55:24 +01:00
Revision int `json:"revisions"`
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 {
2023-02-02 10:55:24 +01:00
return NameUCI
}
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-02-02 10:55:24 +01:00
PostImportCommands: make([]*UCIPostImportCommand, 0),
}
}
var _ spec.Spec = &Spec{}