Skip to content

fix(events): align V1 posting with OpenAPI#665

Open
Teko012 wants to merge 5 commits into
DataDog:mainfrom
Teko012:align-v1-with-openapi
Open

fix(events): align V1 posting with OpenAPI#665
Teko012 wants to merge 5 commits into
DataDog:mainfrom
Teko012:align-v1-with-openapi

Conversation

@Teko012

@Teko012 Teko012 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes pup events post and generic pup api -X POST v1/events authentication to match the Datadog V1 Events API. The create-event endpoint now accepts DD_API_KEY without requiring DD_APP_KEY, rejects unsupported bearer-only authentication before sending a request, and emits only DD-API-KEY.

The event-post command also aligns with the pinned V1 OpenAPI specification by supporting every documented request field, all seven alert types, and the documented aggregation-key, text-length, and event-age limits. Existing dogshell-compatible aliases and --handle behavior remain available.

Motivation

PR #654 added dogshell-compatible event posting, but the command inherited Pup's general authentication validation, which requires both an API key and an application key. The generated V1 create_event operation requires only apiKeyAuth, so valid API-key-only configurations were rejected before the request could be sent.

This follow-up brings both typed and raw event posting in line with the endpoint security requirement and current request schema without changing authentication for event list, search, or get operations.

Additional Notes

  • API-key-only routing is limited to the exact POST /api/v1/events path.
  • Generic API routing derives the auth path from the parsed URL, so query strings and fragments cannot bypass endpoint-specific requirements.
  • Other OAuth-excluded endpoints continue to require both DD_API_KEY and DD_APP_KEY.
  • Canonical --device-name and --source-type-name flags retain the legacy --device, --type, and underscore-style aliases.
  • Blank title/message rejection, stdin normalization, local-host defaults, and --no_host behavior remain unchanged.
  • The full test suite passes 1,570 tests.
  • cargo clippy --tests -- -D warnings and cargo fmt --all --check pass.

Checklist

  • The code change follows the project conventions (see CONTRIBUTING.md)
  • Tests have been added/updated
  • Documentation remains accurate
  • All CI checks pass
  • Code coverage is maintained or improved

Related Issues

Follow-up to #654.

Teko012 and others added 5 commits July 21, 2026 02:25
Allow typed and raw event posting with an API key alone while rejecting
OAuth-only configurations, including raw endpoints with query strings or
fragments. Preserve read authentication and legacy CLI behavior while
supporting documented request fields, enum values, and limits.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Allow typed and raw event posting with an API key alone while rejecting
OAuth-only configurations, including raw endpoints with query strings or
fragments. Preserve read authentication and legacy CLI behavior while
supporting documented request fields, enum values, and limits.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Allow typed and raw event posting with an API key alone while rejecting
OAuth-only configurations, including raw endpoints with query strings or
fragments. Preserve read authentication and legacy CLI behavior while
supporting documented request fields, enum values, and limits.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Allow typed and raw event posting with an API key alone while rejecting
OAuth-only configurations, including raw endpoints with query strings or
fragments. Preserve read authentication and legacy CLI behavior while
supporting documented request fields, enum values, and limits.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Allow typed and raw event posting with an API key alone while rejecting
OAuth-only configurations, including raw endpoints with query strings or
fragments. Preserve read authentication and legacy CLI behavior while
supporting documented request fields, enum values, and limits.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@Teko012
Teko012 requested a review from a team as a code owner July 21, 2026 00:32
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