Debian Codegraph @

github/enterprise_audit_log.go

raw
1 // Copyright 2021 The go-github AUTHORS. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file.
5
6 package github
7
8 import (
9 "context"
10 "fmt"
11 )
12
13 // GetAuditLog gets the audit-log entries for an organization.
14 //
15 // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/audit-log#get-the-audit-log-for-an-enterprise
16 //
17 //meta:operation GET /enterprises/{enterprise}/audit-log
18 func (s *EnterpriseService) GetAuditLog(ctx context.Context, enterprise string, opts *GetAuditLogOptions) ([]*AuditEntry, *Response, error) {
19 u := fmt.Sprintf("enterprises/%v/audit-log", enterprise)
20 u, err := addOptions(u, opts)
21 if err != nil {
22 return nil, nil, err
23 }
24
25 req, err := s.client.NewRequest("GET", u, nil)
26 if err != nil {
27 return nil, nil, err
28 }
29
30 var auditEntries []*AuditEntry
31 resp, err := s.client.Do(ctx, req, &auditEntries)
32 if err != nil {
33 return nil, resp, err
34 }
35
36 return auditEntries, resp, nil
37 }