f-88: api: ressource /floating-ips, refus et affichage sur la VM #88

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-10-29 21:48:12 +01:00
commit fdabd943f2
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
15 changed files with 942 additions and 12 deletions

View file

@ -198,6 +198,13 @@ func (c StopVMCommand) Prepare(db *badger.DB, _ *configuration.Config) error {
if !state.CanDelete(current) {
return fmt.Errorf("vm %q cannot be stopped while %s", c.Name, current)
}
floating, err := floatingIPOf(db, c.Name)
if err != nil {
return err
}
if floating != "" {
return fmt.Errorf("floating ip %q must be deleted before deleting vm %q", floating, c.Name)
}
return state.Set(db, c.Key(), state.Deleting)
}