emissary/internal/spec/uci.go

38 lines
906 B
Go

package spec
import "forge.cadoles.com/Cadoles/emissary/internal/openwrt/uci"
const NameUCI Name = "uci.emissary.cadoles.com"
type UCI struct {
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 (u *UCI) SpecName() Name {
return NameUCI
}
func (u *UCI) SpecRevision() int {
return u.Revision
}
func (u *UCI) SpecData() any {
return struct {
Config *uci.UCI `json:"config"`
PostImportCommands []*UCIPostImportCommand `json:"postImportCommands"`
}{Config: u.Config, PostImportCommands: u.PostImportCommands}
}
func NewUCISpec() *UCI {
return &UCI{
PostImportCommands: make([]*UCIPostImportCommand, 0),
}
}