51 lines
1.0 KiB
Go
51 lines
1.0 KiB
Go
package uci
|
|
|
|
import (
|
|
"forge.cadoles.com/Cadoles/emissary/internal/openwrt/uci"
|
|
"forge.cadoles.com/Cadoles/emissary/internal/spec"
|
|
)
|
|
|
|
const (
|
|
Name string = "uci.emissary.cadoles.com"
|
|
Version string = "0.0.0"
|
|
)
|
|
|
|
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) SpecDefinitionName() string {
|
|
return Name
|
|
}
|
|
|
|
func (s *Spec) SpecDefinitionVersion() string {
|
|
return Version
|
|
}
|
|
|
|
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{}
|