github.com/google/go-github/v49@v49.1.0/github/enterprise_audit_log.go (about) 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/en/rest/enterprise-admin/audit-log#get-the-audit-log-for-an-enterprise 16 func (s *EnterpriseService) GetAuditLog(ctx context.Context, enterprise string, opts *GetAuditLogOptions) ([]*AuditEntry, *Response, error) { 17 u := fmt.Sprintf("enterprises/%v/audit-log", enterprise) 18 u, err := addOptions(u, opts) 19 if err != nil { 20 return nil, nil, err 21 } 22 23 req, err := s.client.NewRequest("GET", u, nil) 24 if err != nil { 25 return nil, nil, err 26 } 27 28 var auditEntries []*AuditEntry 29 resp, err := s.client.Do(ctx, req, &auditEntries) 30 if err != nil { 31 return nil, resp, err 32 } 33 34 return auditEntries, resp, nil 35 }