Skip to content

feat(events): add event posting - #654

Merged
platinummonkey merged 12 commits into
DataDog:mainfrom
Teko012:add-event-post
Jul 19, 2026
Merged

feat(events): add event posting#654
platinummonkey merged 12 commits into
DataDog:mainfrom
Teko012:add-event-post

Conversation

@Teko012

@Teko012 Teko012 commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds pup events post with feature parity for the dogshell event post command. The new command maps all supported post fields to the Datadog V1 Events API, supports messages from either an argument or stdin, defaults to the local hostname, and allows --no_host to suppress host association.

Motivation

Pup could list, search, and retrieve events but could not create them. This change enables existing dogshell users to migrate event-posting workflows to pup without losing supported fields or behavior.

Additional Notes

  • Dogshell underscore-style flags such as --no_host, --aggregation_key, and --alert_type are accepted alongside clap's hyphenated forms.
  • Alert type and priority values are validated by clap before sending a request.
  • The focused event suite passes 13 tests, including payload matching, API errors, invalid arguments, stdin input, local-host defaults, and --no_host overrides.
  • cargo clippy --tests -- -D warnings and cargo fmt --check pass.

Checklist

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

Related Issues

N/A


Generated with GitHub Copilot

Teko012 and others added 3 commits July 18, 2026 02:33
Add an events post command with the same inputs and behavior as dogshell.
- Map all dogshell post options to the Datadog V1 event API
- Support stdin messages, local-host defaults, and no-host overrides
- Add positive and negative tests for payloads, parsing, and errors

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add an events post command with the same inputs and behavior as dogshell.
- Map all dogshell post options to the Datadog V1 event API
- Support stdin messages, local-host defaults, and no-host overrides
- Add positive and negative tests for payloads, parsing, and errors

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add an events post command with the same inputs and behavior as dogshell.
- Map all dogshell post options to the Datadog V1 event API
- Support stdin messages, local-host defaults, and no-host overrides
- Add positive and negative tests for payloads, parsing, and errors

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@Teko012
Teko012 requested a review from a team as a code owner July 18, 2026 00:41
Teko012 and others added 9 commits July 18, 2026 16:06
Add an events post command with the same inputs and behavior as dogshell.
- Map all dogshell post options to the Datadog V1 event API
- Support stdin messages, local-host defaults, and no-host overrides
- Add positive and negative tests for payloads, parsing, and errors

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add an events post command with the same inputs and behavior as dogshell.
- Map all dogshell post options to the Datadog V1 event API
- Support stdin messages, local-host defaults, and no-host overrides
- Add positive and negative tests for payloads, parsing, and errors

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add an events post command with the same inputs and behavior as dogshell.
- Map all dogshell post options to the Datadog V1 event API
- Support stdin messages, local-host defaults, and no-host overrides
- Add positive and negative tests for payloads, parsing, and errors

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add an events post command with the same inputs and behavior as dogshell.
- Map all dogshell post options to the Datadog V1 event API
- Support stdin messages, local-host defaults, and no-host overrides
- Add positive and negative tests for payloads, parsing, and errors

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add an events post command with the same inputs and behavior as dogshell.
- Map all dogshell post options to the Datadog V1 event API
- Support stdin messages, local-host defaults, and no-host overrides
- Add positive and negative tests for payloads, parsing, and errors

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add an events post command with the same inputs and behavior as dogshell.
- Map all dogshell post options to the Datadog V1 event API
- Support stdin messages, local-host defaults, and no-host overrides
- Add positive and negative tests for payloads, parsing, and errors

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add an events post command with the same inputs and behavior as dogshell.
- Map all dogshell post options to the Datadog V1 event API
- Support stdin messages, local-host defaults, and no-host overrides
- Add positive and negative tests for payloads, parsing, and errors

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add an events post command with the same inputs and behavior as dogshell.
- Map all dogshell post options to the Datadog V1 event API
- Support stdin messages, local-host defaults, and no-host overrides
- Add positive and negative tests for payloads, parsing, and errors

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@platinummonkey
platinummonkey merged commit 1fcead9 into DataDog:main Jul 19, 2026
6 checks passed
@Teko012
Teko012 deleted the add-event-post branch July 19, 2026 07:52
rachelyangdog pushed a commit to rachelyangdog/pup that referenced this pull request Jul 20, 2026
openapi-transformer's pup generator copies client.rs/util.rs byte-for-byte
from a bundled snapshot on every regeneration, but only make_api!/
make_api_no_auth! and util::read_json_file are actually generator-relevant.
Everything else was pup's own hand-written command logic that just happened
to live in those files, so a routine feature PR (DataDog#654, event posting) got
silently reverted the next time the client was regenerated (pup#651).

Split both files along the generator/hand-written boundary, mirroring how
main.rs/generated.rs already separate hand-written and generated code:

- client.rs keeps only what make_api!/make_api_no_auth! need:
  BearerAuthMiddleware/UserAgentMiddleware, make_dd_config/make_dd_client,
  the two macros, UNSTABLE_OPS.
- New raw_client.rs holds the rest: HttpError/HttpResponse, AuthType/
  get_auth_type, the OAuth-exclusion table + apply_auth, parse_response_json,
  and every raw_* HTTP helper used by ~16 hand-written commands for
  endpoints not covered by the typed SDK.
- util.rs keeps only read_json_file. New util_ext.rs holds time/duration
  parsing, the monitor-diff helpers, parse_compute_raw, and percent_encode.

Pure move: identical function bodies/signatures, only import paths changed.
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