emissary/internal/spec/gateway/spec.go

41 lines
710 B
Go
Raw Normal View History

package gateway
import "forge.cadoles.com/Cadoles/emissary/internal/spec"
const NameGateway spec.Name = "gateway.emissary.cadoles.com"
type ID string
type Spec struct {
Revision int `json:"revision"`
Gateways map[ID]GatewayEntry `json:"gateways"`
}
type GatewayEntry struct {
Address string `json:"address"`
Target string `json:"target"`
}
func (s *Spec) SpecName() spec.Name {
return NameGateway
}
func (s *Spec) SpecRevision() int {
return s.Revision
}
func (s *Spec) SpecData() map[string]any {
return map[string]any{
"gateways": s.Gateways,
}
}
func NewSpec() *Spec {
return &Spec{
2023-03-13 10:44:58 +01:00
Revision: -1,
Gateways: make(map[ID]GatewayEntry),
}
}
var _ spec.Spec = &Spec{}