Add the /commands path to handle a set of commands

Entirely synchronous now but allows for the "move" command
This commit is contained in:
Marc Di Luzio 2020-06-03 18:40:19 +01:00
parent e5d5d123a6
commit e2857d7506
5 changed files with 169 additions and 19 deletions

View file

@ -71,3 +71,12 @@ func (a *Accountant) AssignPrimary(account uuid.UUID, instance uuid.UUID) error
return nil
}
// GetPrimary gets the primary instance for the account
func (a *Accountant) GetPrimary(account uuid.UUID) (uuid.UUID, error) {
// Find the account matching the ID
if this, ok := a.Accounts[account]; ok {
return this.Primary, nil
}
return uuid.UUID{}, fmt.Errorf("no account found for id: %s", account)
}