Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

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

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

Conversation

@amreshh
Copy link

@amreshh amreshh commented Feb 25, 2026

Pull Request Description: Add Support for Enterprise Audit Log Streaming API

Closes #3663

Summary

This PR adds support for the GitHub Enterprise audit log streaming REST API,
allowing users to programmatically manage audit log stream configurations for
enterprises. This includes retrieving the public encryption key, listing,
retrieving, creating, updating, and deleting stream configurations across all
supported vendors.

Changes

Data Structures

  • Added AuditLogStream struct to represent a stream configuration returned by the API.
  • Added AuditLogStreamConfig struct for creating and updating streams.
  • Added AuditLogStreamKey struct for the public encryption key.
  • Added AuditLogStreamVendorConfig marker interface for compile-time type
    safety on vendor-specific configurations.
  • Added vendor-specific config structs: AzureBlobConfig, AzureHubConfig,
    AmazonS3OIDCConfig, AmazonS3AccessKeysConfig, SplunkConfig, HecConfig,
    GoogleCloudConfig, and DatadogConfig.
  • Added New*StreamConfig constructor helpers for all 8 vendors.

Audit Log Streaming ([EnterpriseService])

Added the following methods to [EnterpriseService]:

  • [GetAuditLogStreamKey]: GET /enterprises/{enterprise}/audit-log/stream-key
  • [ListAuditLogStreams]: GET /enterprises/{enterprise}/audit-log/streams
  • [GetAuditLogStream]: GET /enterprises/{enterprise}/audit-log/streams/{stream_id}
  • [CreateAuditLogStream]: POST /enterprises/{enterprise}/audit-log/streams
  • [UpdateAuditLogStream]: PATCH /enterprises/{enterprise}/audit-log/streams/{stream_id}
  • [DeleteAuditLogStream]: DELETE /enterprises/{enterprise}/audit-log/streams/{stream_id}

Verification Plan

Automated Tests

  • Added github/enterprise_audit_log_streaming_test.go with unit tests for all
    methods and constructor helpers.

All tests passed:

go test -v ./github -run 'TestEnterpriseService_.*AuditLogStream'

Examples

  • Added example/auditlogstream/ — creates and deletes an Azure Blob Storage stream.

Example reads GITHUB_API_URL and GITHUB_AUTH_TOKEN from the environment
and handles sealed-box encryption of credentials using the key returned by GetAuditLogStreamKey.

@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 (27db7f9) to head (948070d).

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
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

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