fleet/server
Scott Gress 647612345c
Deprecate URLs with "team" and "query" terminology (#40520)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Resolves #40519

# Details

This PR adds a new system for registering deprecated URLs separately
from the main URLs (i.e. not clogging up `handler.go` with a bunch of
`.WithAltPaths()` or similar. It uses a registry that's shared between
all the different endpointer, which is then iterated over and a new
handler is created for the deprecated endpoint which stores info about
the deprecation (the old and new URLs) in the context. A new middleware
looks for that context info and, if found, logs a deprecation warning
(if the topic is enabled).

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

- [ ] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files)
for more information.
no need for a changelog as we are not logging the warnings by default

## Testing

- [X] Added/updated automated tests
- [X] QA'd all new/changed functionality manually

* Verified that going to `/teams` with
`--logging_enable_topics=deprecated-field-names` got me this log:
```
deprecated_path=/api/_version_/fleet/teams deprecation_warning="API `/api/_version_/fleet/teams` is deprecated, use `/api/_version_/fleet/fleets` instead
```
* Going to `/fleets` with that flag enabled resulted in no deprecation
log
* Going to `/teams` _without_ the flag enabled resulted in no
deprecation log
2026-02-25 22:20:35 -06:00
..
acl/activityacl Move NewActivity to activity bounded context (#39521) 2026-02-25 14:11:03 -06:00
activity Move NewActivity to activity bounded context (#39521) 2026-02-25 14:11:03 -06:00
archtest Refactor endpoint_utils for modularization (#36484) 2025-12-31 09:12:00 -06:00
authz Fixed client-side errors being incorrectly reported as server errors in OTEL telemetry (#40051) 2026-02-19 16:06:00 -06:00
aws_common Feat 1817 add iam auth to mysql and redis (#32488) 2025-09-04 10:08:47 -05:00
bindata Allow users to be readded if they were ever removed (#1945) 2021-09-07 13:33:40 -03:00
config Add ability to enable/disable logs by topic (#40126) 2026-02-20 17:22:50 -06:00
contexts Move NewActivity to activity bounded context (#39521) 2026-02-25 14:11:03 -06:00
cron Updating cron and calendar to slog method signatures. (#40446) 2026-02-24 16:51:15 -06:00
datastore Log response body in PostJSONWithTimeout error case (#40509) 2026-02-25 15:35:29 -06:00
dev_mode Only allow FLEET_DEV_* env vars when --dev is passed, allow overriding configs one at a time in dev (#38652) 2026-01-27 14:32:56 -06:00
errorstore Incremental migration to slog (#40120) 2026-02-19 15:35:35 -06:00
fleet Log response body in PostJSONWithTimeout error case (#40509) 2026-02-25 15:35:29 -06:00
goose Use UTC timestamps for DB migrations (#36228) 2025-11-24 15:49:10 -06:00
health Changes needed before gokit/log to slog transition. (#39527) 2026-02-11 10:08:33 -06:00
launcher Changes needed before gokit/log to slog transition. (#39527) 2026-02-11 10:08:33 -06:00
live_query Incremental migration to slog (#40120) 2026-02-19 15:35:35 -06:00
logging Log response body in PostJSONWithTimeout error case (#40509) 2026-02-25 15:35:29 -06:00
mail [Bug fix] Unclear error message: Update users email via API (#36579) 2025-12-02 10:52:31 -06:00
mdm Move NewActivity to activity bounded context (#39521) 2026-02-25 14:11:03 -06:00
mock Move NewActivity to activity bounded context (#39521) 2026-02-25 14:11:03 -06:00
platform Deprecate URLs with "team" and "query" terminology (#40520) 2026-02-25 22:20:35 -06:00
policies Migrating maintained apps, failing policies, and webhooks to slog. (#40149) 2026-02-23 08:50:40 -06:00
ptr Clean up android app config data layer, fix no-team persist bug (#37740) 2025-12-30 09:35:41 -06:00
pubsub Incremental migration to slog (#40120) 2026-02-19 15:35:35 -06:00
service Deprecate URLs with "team" and "query" terminology (#40520) 2026-02-25 22:20:35 -06:00
shellquote Updating golangci-lint to 1.61.0 (#22973) 2024-10-18 12:38:26 -05:00
sso End-user authentication for Window/Linux setup experience: backend (#34835) 2025-10-31 11:16:42 -05:00
test Move NewActivity to activity bounded context (#39521) 2026-02-25 14:11:03 -06:00
variables DCSW: Support all IDP variables in Windows config profiles (#34707) 2025-10-24 10:10:58 -03:00
version Move external dependency fleetdm/kolide-kit to monorepo (#15861) 2024-01-02 18:22:52 -03:00
vulnerabilities Migrating vulnerabilities pkgs to slog. (#40106) 2026-02-20 15:36:38 -06:00
webhooks Log response body in PostJSONWithTimeout error case (#40509) 2026-02-25 15:35:29 -06:00
websocket Enable errcheck linter for golangci-lint (#8899) 2022-12-05 16:50:49 -06:00
worker Migrating server/worker and related code to slog (#40205) 2026-02-23 13:18:07 -06:00
utils.go Log response body in PostJSONWithTimeout error case (#40509) 2026-02-25 15:35:29 -06:00
utils_test.go feature: target profiles by labels (#16202) 2024-01-26 11:00:58 -05:00