feat: add generic queue and subscription retirement

This commit is contained in:
2026-09-27 14:39:49 +08:00
parent d54bdd9847
commit c9e877c3f7
53 changed files with 1013 additions and 88 deletions

View File

@@ -47,12 +47,24 @@ func RegisterEventSubscriptions(server *http.Server, s *events.Service) {
}))
mux.HandleFunc("POST /v1/subscriptions/{command}", wrap(func(r *http.Request, t auth.Token) (any, int, error) {
id, command, ok := strings.Cut(r.PathValue("command"), ":")
if !ok || command != "configure" {
if !ok || (command != "configure" && command != "retire") {
return nil, 0, fault.NotFound
}
if err := noEventQuery(r); err != nil {
return nil, 0, err
}
if command == "retire" {
var in events.RetireInput
if err := decodeEventBody(r, &in); err != nil {
return nil, 0, err
}
key, err := idempotencyKey(r)
if err != nil {
return nil, 0, err
}
out, err := s.Retire(r.Context(), t, core.ID(id), key, in)
return out, 200, err
}
var in events.ControlInput
if err := decodeEventBody(r, &in); err != nil {
return nil, 0, err