Introduce internal/dispatcher package with a Command interface and typed commands (CreateVPC, DeleteVPC, CreateSubnet, DeleteSubnet). The API handlers now call dispatcher.Dispatch() instead of enqueuing closures directly, decoupling transport (HTTP today, MQTT tomorrow) from execution. Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
26 lines
492 B
Go
26 lines
492 B
Go
package dispatcher
|
|
|
|
import "github.com/dgraph-io/badger/v4"
|
|
|
|
type CreateSubnetCommand struct {
|
|
Name string
|
|
VPC string
|
|
VxlanID int
|
|
LocalIP string
|
|
GatewayIP string
|
|
CIDR string
|
|
}
|
|
|
|
func (c CreateSubnetCommand) Execute(db *badger.DB) error {
|
|
// TODO: brancher internal/subnet/create.go
|
|
return nil
|
|
}
|
|
|
|
type DeleteSubnetCommand struct {
|
|
Name string
|
|
}
|
|
|
|
func (c DeleteSubnetCommand) Execute(db *badger.DB) error {
|
|
// TODO: brancher internal/subnet/delete.go
|
|
return nil
|
|
}
|