Skip to content

Commit

Permalink
🐛 Specify customer id for fetching user report usage. (#4443)
Browse files Browse the repository at this point in the history
Signed-off-by: Preslav <[email protected]>
  • Loading branch information
preslavgerchev authored Jul 30, 2024
1 parent 7ae5a9d commit d7e8127
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions providers/google-workspace/resources/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (g *mqlGoogleworkspaceUser) usageReport() (*mqlGoogleworkspaceReportUsage,
now := time.Now()
tries := 10
for tries > 0 {
report, err := fetchUsageReport(reportsService, primaryEmail, now)
report, err := fetchUsageReport(reportsService, primaryEmail, conn.CustomerID(), now)
if err != nil && shouldCheckEarlierDateForReport(err) {
now = now.Add(-day)
tries--
Expand All @@ -138,8 +138,8 @@ func (g *mqlGoogleworkspaceUser) usageReport() (*mqlGoogleworkspaceReportUsage,
return nil, errors.New("could not fetch usage report for user, earliest tried date: " + now.Format(time.DateOnly))
}

func fetchUsageReport(svc *reports.Service, email string, date time.Time) (*reports.UsageReports, error) {
report, err := svc.UserUsageReport.Get(email, date.Format(time.DateOnly)).Do()
func fetchUsageReport(svc *reports.Service, email string, customerId string, date time.Time) (*reports.UsageReports, error) {
report, err := svc.UserUsageReport.Get(email, date.Format(time.DateOnly)).CustomerId(customerId).Do()
if err != nil {
return nil, err
}
Expand Down

0 comments on commit d7e8127

Please sign in to comment.