Skip to content

Add on-call pages list command#641

Draft
nadimchakra wants to merge 1 commit into
DataDog:mainfrom
nadimchakra:on-call-pages-list
Draft

Add on-call pages list command#641
nadimchakra wants to merge 1 commit into
DataDog:mainfrom
nadimchakra:on-call-pages-list

Conversation

@nadimchakra

Copy link
Copy Markdown

Summary

Adds on-call pages list, filling the gap where pup could only create or get <page_id> an on-call page — there was no way to list pages for a team or responder. Filters by team handle server-side (filter=team:<handle>) and by responder user id client-side.

Notable Changes

  • src/commands/on_call.rs: pages_list(cfg, team, responder, page_size) via client::raw_get (same pattern as pages_get), plus a page_has_responder helper for the client-side responder filter.
  • src/main.rs: List variant on OnCallPagesActions with --team, --responder, --page-size; wired into routing. Verb-based classification makes it read-only.
  • docs/COMMANDS.md: on-call row updated to pages (list, get, create).
  • Tests: happy path, error path, and responder-match/reject/missing-field cases.

Implementation notes

  • Uses the unstable/on-call/pages endpoint deliberately: datadog-api-client exposes no list binding, and the stable GET /api/v2/on-call/pages returns an empty 200 (content-length: 0) even with a filter. See the companion issue for the API-side gap.
  • --responder is applied client-side because the endpoint has no responder facet (responders:, responder:, user:, target: all return zero results).
  • on_call_read is already in default_scopes() / read_only_scopes(), so no auth change is needed.

Known limitations (inherited from the endpoint)

  • No server-side sort, no working pagination (page[number]/page[offset] ignored — always oldest-first, page 1), no in-query time filter. page[size] caps at 1000, so teams with >1000 total pages can't retrieve recent ones via this command. These are API-side and tracked in the companion issue.

Draft: opened to let CI validate the build — I couldn't compile locally (corporate crates.io mirror was missing russh 0.61.1).

🤖 Generated with Claude Code

pup could only create or get-an-on-call-page-by-id; there was no way to
list pages for a team or responder. This adds `on-call pages list`,
filling that gap.

Filtering is by team handle server-side (`filter=team:<handle>`) and by
responder user id client-side, since the API exposes no responder facet.
Uses `client::raw_get` against the unstable endpoint because
`datadog-api-client` has no list binding and the stable
`/api/v2/on-call/pages` GET returns an empty collection.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@nadimchakra

Copy link
Copy Markdown
Author

Companion issue documenting the API-side gap and the unstable/on-call/pages endpoint limitations: #642

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant