mirror of
https://github.com/speatzle/nfsense.git
synced 2025-05-11 19:08:20 +00:00
Add Create and Update Interface Backend
This commit is contained in:
parent
9568adbd8e
commit
f1d7f63079
1 changed files with 30 additions and 0 deletions
|
@ -18,6 +18,36 @@ func (f *Network) GetInterfaces(ctx context.Context, params struct{}) (GetInterf
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CreateInterfaceParameters struct {
|
||||||
|
Name string
|
||||||
|
Interface definitions.Interface
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *Network) CreateInterface(ctx context.Context, params CreateInterfaceParameters) (struct{}, error) {
|
||||||
|
_, ok := f.Conf.Network.Interfaces[params.Name]
|
||||||
|
if ok {
|
||||||
|
return struct{}{}, fmt.Errorf("Interface already Exists")
|
||||||
|
}
|
||||||
|
|
||||||
|
f.Conf.Network.Interfaces[params.Name] = params.Interface
|
||||||
|
return struct{}{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type UpdateInterfaceParameters struct {
|
||||||
|
Name string
|
||||||
|
Interface definitions.Interface
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *Network) UpdateInterface(ctx context.Context, params CreateInterfaceParameters) (struct{}, error) {
|
||||||
|
_, ok := f.Conf.Network.Interfaces[params.Name]
|
||||||
|
if !ok {
|
||||||
|
return struct{}{}, fmt.Errorf("Interface does not Exist")
|
||||||
|
}
|
||||||
|
|
||||||
|
f.Conf.Network.Interfaces[params.Name] = params.Interface
|
||||||
|
return struct{}{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
type DeleteInterfaceParameters struct {
|
type DeleteInterfaceParameters struct {
|
||||||
Name string
|
Name string
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue