Skip to content

feat: Add support for enterprise audit log streaming API#4035

Open
amreshh wants to merge 6 commits intogoogle:masterfrom
amreshh:master
Open

feat: Add support for enterprise audit log streaming API#4035
amreshh wants to merge 6 commits intogoogle:masterfrom
amreshh:master

Conversation

@amreshh
Copy link

@amreshh amreshh commented Feb 25, 2026

This PR implements the enterprise audit logs api (https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin/audit-log?apiVersion=2022-11-28)

This includes:

  • enterprise_audit_log_stream.go: Implements crud operations for the audit log streaming endpoint
  • enterprise_audit_log_stream_test.go: Unit tests for audit_log_stream.go

Besides the api implementation, I also added examples/auditlogstream/main.go run a simple real world test for creating a audit log stream towards Azure Blob Storage.

Closes #3663

@google-cla
Copy link

google-cla bot commented Feb 25, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@amreshh amreshh force-pushed the master branch 2 times, most recently from 4881578 to c903947 Compare February 25, 2026 10:43
@gmlewis gmlewis added NeedsReview PR is awaiting a review before merging. waiting for signed CLA labels Feb 25, 2026
@codecov
Copy link

codecov bot commented Feb 25, 2026

Codecov Report

❌ Patch coverage is 36.55914% with 118 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.53%. Comparing base (a70ac77) to head (72a5150).

Files with missing lines Patch % Lines
example/auditlogstream/main.go 0.00% 90 Missing ⚠️
github/enterprise_audit_log_stream.go 70.83% 28 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4035      +/-   ##
==========================================
- Coverage   94.08%   93.53%   -0.56%     
==========================================
  Files         207      209       +2     
  Lines       19217    19403     +186     
==========================================
+ Hits        18081    18149      +68     
- Misses        938     1056     +118     
  Partials      198      198              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@amreshh amreshh force-pushed the master branch 2 times, most recently from 584acab to b4904a1 Compare February 26, 2026 10:08
Signed-off-by: amreshh <20923769+amreshh@users.noreply.github.com>
Copy link
Contributor

@alexandear alexandear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to tidy up the PR's description? See https://github.com/google/go-github/blob/master/CONTRIBUTING.md#tips for tips.

The verification plan is not complete. You need to run ./script/lint.sh and ./script/test.sh according to https://github.com/google/go-github/blob/master/CONTRIBUTING.md#submitting-a-patch

amreshh and others added 2 commits February 26, 2026 16:29
- fixed linter issues where api docs were not correct in the comments
for audit log streams
Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @amreshh!
One minor nit and a question, otherwise LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.

cc: @alexandear

Comment on lines +31 to +32
// AuditLogStreamVendorConfig is a marker interface for vendor-specific audit log
// stream configurations.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This interface immediately looked odd to me because you are not exporting the one interface method, however below it looks like this was absolutely intensional, and therefore should be noted in the comment.
But then I'm left wondering - would it be beneficial for a user of this client library to provide their own method? I don't know.

In the meantime, how about this?

Suggested change
// AuditLogStreamVendorConfig is a marker interface for vendor-specific audit log
// stream configurations.
// AuditLogStreamVendorConfig is a sealed marker interface for vendor-specific audit log
// stream configurations. Only this package can define implementations.

Copy link
Author

@amreshh amreshh Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gmlewis: Yes that one interface is sealed on purpose, I thought to do it this way to catch any invalid vendor configs early on, and mimic the api strictly to what they support.
I could also export it but still you are dependent on what the GitHub api provides, so any other input would still result in an error from the api which needs to be handled.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, perfect... then I think we should document this fact somehow. If you want to come up with your own wording, that is fine by me.

KeyID *string `json:"key_id,omitempty"`
}

// Implement the marker interface for all vendor config types.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Implement the marker interface for all vendor config types.
// Implement the sealed marker interface for all vendor config types.

@gmlewis
Copy link
Collaborator

gmlewis commented Feb 26, 2026

Also, @amreshh - if you could add unit tests to cover all the new New* methods, that would be great:

codecov-4035

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

Labels

NeedsReview PR is awaiting a review before merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for audit log stream APIs

3 participants