Skip to content

feat(tag-policies): add tag-policies command#604

Merged
jack-edmonds-dd merged 6 commits into
mainfrom
jack-edmonds-dd/tag-policies
Jun 18, 2026
Merged

feat(tag-policies): add tag-policies command#604
jack-edmonds-dd merged 6 commits into
mainfrom
jack-edmonds-dd/tag-policies

Conversation

@jack-edmonds-dd

@jack-edmonds-dd jack-edmonds-dd commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds the pup tag-policies command, which wraps the Datadog Tag Policies v2 API. Tag policies let teams enforce required tag keys and allowed values across Datadog resources, and expose a compliance score to measure adherence.

Changes

  • src/commands/tag_policies.rs — new command module with list, get, create, update, delete, and score functions, plus full positive/negative unit test coverage
  • src/commands/mod.rs — registers tag_policies module
  • src/main.rs — adds TagPolicies variant to the Commands enum and TagPoliciesActions subcommand enum; wires up dispatch in main_inner
  • src/client.rs — adds 6 tag-policy operations to UNSTABLE_OPS; removes 7 stabilized ops (5 Incident Services, 2 Fleet Automation); updates test_unstable_ops_count to 170

Usage

pup tag-policies list [--include-disabled] [--include-deleted] [--include-score] [--filter-source <logs|spans|metrics|rum|feed>]
pup tag-policies get <policy-id> [--include-score]
pup tag-policies create --file policy.json
pup tag-policies update <policy-id> --file policy.json
pup tag-policies delete <policy-id> [--hard-delete]
pup tag-policies score <policy-id> [--ts-start <ms>] [--ts-end <ms>]

Testing

  • 12 unit tests covering happy path and error cases for all 6 subcommands
  • cargo test, cargo clippy -- -D warnings, cargo fmt --check all pass

🤖 Generated with Claude Code

@jack-edmonds-dd jack-edmonds-dd requested a review from a team as a code owner June 18, 2026 16:04
@datadog-datadog-prod-us1

This comment has been minimized.

platinummonkey
platinummonkey previously approved these changes Jun 18, 2026
@jack-edmonds-dd jack-edmonds-dd changed the title Jack edmonds dd/tag policies feat(tag-policies): add tag-policies command Jun 18, 2026
jack-edmonds-dd and others added 5 commits June 18, 2026 13:39
Implements the tag-policies API surface added in SDK 0.32.0:
- list: list all tag policies with optional filters (disabled, deleted, source, score)
- get: fetch a single policy by ID
- create: create from JSON file
- update: update by ID from JSON file
- delete: delete by ID (supports --hard-delete)
- score: fetch per-policy compliance score with optional time window

All 6 operations registered in UNSTABLE_OPS. 12 unit tests, all passing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
tag-policies must precede tags alphabetically to pass the
top-level command sort order test.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements the Model Lab API surface added in SDK 0.32.0:

Projects:
  - list: list projects with optional filter/tags/sort/pagination
  - get: fetch a project by ID
  - star / unstar: mark projects as starred
  - artifacts: list project artifacts
  - facet-keys / facet-values: explore project facets

Runs:
  - list: list runs with rich filtering (project, status, tags, params, parent)
  - get: fetch a run by ID
  - delete: delete a run
  - pin / unpin: pin runs for easy access
  - artifacts: list run artifacts with optional path prefix filter
  - facet-keys / facet-values: explore run facets

All 16 operations registered in UNSTABLE_OPS. 18 unit tests, all passing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Config gained a jq field in PR #590 but one test initializer in
config.rs was missed, causing clippy --all-targets to fail.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jack-edmonds-dd jack-edmonds-dd force-pushed the jack-edmonds-dd/tag-policies branch from 9784bc3 to fc042d6 Compare June 18, 2026 17:42
@jack-edmonds-dd jack-edmonds-dd merged commit d99f88b into main Jun 18, 2026
6 checks passed
@jack-edmonds-dd jack-edmonds-dd deleted the jack-edmonds-dd/tag-policies branch June 18, 2026 20:22
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.

2 participants