1// Copyright 2019 Google LLC.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// Code generated file. DO NOT EDIT.
6
7// Package admin provides access to the Admin Reports API.
8//
9// For product documentation, see: https://developers.google.com/admin-sdk/reports/
10//
11// Creating a client
12//
13// Usage example:
14//
15//   import "google.golang.org/api/admin/reports/v1"
16//   ...
17//   ctx := context.Background()
18//   adminService, err := admin.NewService(ctx)
19//
20// In this example, Google Application Default Credentials are used for authentication.
21//
22// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
23//
24// Other authentication options
25//
26// By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
27//
28//   adminService, err := admin.NewService(ctx, option.WithScopes(admin.AdminReportsUsageReadonlyScope))
29//
30// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
31//
32//   adminService, err := admin.NewService(ctx, option.WithAPIKey("AIza..."))
33//
34// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
35//
36//   config := &oauth2.Config{...}
37//   // ...
38//   token, err := config.Exchange(ctx, ...)
39//   adminService, err := admin.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
40//
41// See https://godoc.org/google.golang.org/api/option/ for details on options.
42package admin // import "google.golang.org/api/admin/reports/v1"
43
44import (
45	"bytes"
46	"context"
47	"encoding/json"
48	"errors"
49	"fmt"
50	"io"
51	"net/http"
52	"net/url"
53	"strconv"
54	"strings"
55
56	gensupport "google.golang.org/api/gensupport"
57	googleapi "google.golang.org/api/googleapi"
58	option "google.golang.org/api/option"
59	htransport "google.golang.org/api/transport/http"
60)
61
62// Always reference these packages, just in case the auto-generated code
63// below doesn't.
64var _ = bytes.NewBuffer
65var _ = strconv.Itoa
66var _ = fmt.Sprintf
67var _ = json.NewDecoder
68var _ = io.Copy
69var _ = url.Parse
70var _ = gensupport.MarshalJSON
71var _ = googleapi.Version
72var _ = errors.New
73var _ = strings.Replace
74var _ = context.Canceled
75
76const apiId = "admin:reports_v1"
77const apiName = "admin"
78const apiVersion = "reports_v1"
79const basePath = "https://www.googleapis.com/admin/reports/v1/"
80
81// OAuth2 scopes used by this API.
82const (
83	// View audit reports for your G Suite domain
84	AdminReportsAuditReadonlyScope = "https://www.googleapis.com/auth/admin.reports.audit.readonly"
85
86	// View usage reports for your G Suite domain
87	AdminReportsUsageReadonlyScope = "https://www.googleapis.com/auth/admin.reports.usage.readonly"
88)
89
90// NewService creates a new Service.
91func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
92	scopesOption := option.WithScopes(
93		"https://www.googleapis.com/auth/admin.reports.audit.readonly",
94		"https://www.googleapis.com/auth/admin.reports.usage.readonly",
95	)
96	// NOTE: prepend, so we don't override user-specified scopes.
97	opts = append([]option.ClientOption{scopesOption}, opts...)
98	client, endpoint, err := htransport.NewClient(ctx, opts...)
99	if err != nil {
100		return nil, err
101	}
102	s, err := New(client)
103	if err != nil {
104		return nil, err
105	}
106	if endpoint != "" {
107		s.BasePath = endpoint
108	}
109	return s, nil
110}
111
112// New creates a new Service. It uses the provided http.Client for requests.
113//
114// Deprecated: please use NewService instead.
115// To provide a custom HTTP client, use option.WithHTTPClient.
116// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
117func New(client *http.Client) (*Service, error) {
118	if client == nil {
119		return nil, errors.New("client is nil")
120	}
121	s := &Service{client: client, BasePath: basePath}
122	s.Activities = NewActivitiesService(s)
123	s.Channels = NewChannelsService(s)
124	s.CustomerUsageReports = NewCustomerUsageReportsService(s)
125	s.EntityUsageReports = NewEntityUsageReportsService(s)
126	s.UserUsageReport = NewUserUsageReportService(s)
127	return s, nil
128}
129
130type Service struct {
131	client    *http.Client
132	BasePath  string // API endpoint base URL
133	UserAgent string // optional additional User-Agent fragment
134
135	Activities *ActivitiesService
136
137	Channels *ChannelsService
138
139	CustomerUsageReports *CustomerUsageReportsService
140
141	EntityUsageReports *EntityUsageReportsService
142
143	UserUsageReport *UserUsageReportService
144}
145
146func (s *Service) userAgent() string {
147	if s.UserAgent == "" {
148		return googleapi.UserAgent
149	}
150	return googleapi.UserAgent + " " + s.UserAgent
151}
152
153func NewActivitiesService(s *Service) *ActivitiesService {
154	rs := &ActivitiesService{s: s}
155	return rs
156}
157
158type ActivitiesService struct {
159	s *Service
160}
161
162func NewChannelsService(s *Service) *ChannelsService {
163	rs := &ChannelsService{s: s}
164	return rs
165}
166
167type ChannelsService struct {
168	s *Service
169}
170
171func NewCustomerUsageReportsService(s *Service) *CustomerUsageReportsService {
172	rs := &CustomerUsageReportsService{s: s}
173	return rs
174}
175
176type CustomerUsageReportsService struct {
177	s *Service
178}
179
180func NewEntityUsageReportsService(s *Service) *EntityUsageReportsService {
181	rs := &EntityUsageReportsService{s: s}
182	return rs
183}
184
185type EntityUsageReportsService struct {
186	s *Service
187}
188
189func NewUserUsageReportService(s *Service) *UserUsageReportService {
190	rs := &UserUsageReportService{s: s}
191	return rs
192}
193
194type UserUsageReportService struct {
195	s *Service
196}
197
198// Activities: JSON template for a collection of activites.
199type Activities struct {
200	// Etag: ETag of the resource.
201	Etag string `json:"etag,omitempty"`
202
203	// Items: Each record in read response.
204	Items []*Activity `json:"items,omitempty"`
205
206	// Kind: Kind of list response this is.
207	Kind string `json:"kind,omitempty"`
208
209	// NextPageToken: Token for retrieving the next page
210	NextPageToken string `json:"nextPageToken,omitempty"`
211
212	// ServerResponse contains the HTTP response code and headers from the
213	// server.
214	googleapi.ServerResponse `json:"-"`
215
216	// ForceSendFields is a list of field names (e.g. "Etag") to
217	// unconditionally include in API requests. By default, fields with
218	// empty values are omitted from API requests. However, any non-pointer,
219	// non-interface field appearing in ForceSendFields will be sent to the
220	// server regardless of whether the field is empty or not. This may be
221	// used to include empty fields in Patch requests.
222	ForceSendFields []string `json:"-"`
223
224	// NullFields is a list of field names (e.g. "Etag") to include in API
225	// requests with the JSON null value. By default, fields with empty
226	// values are omitted from API requests. However, any field with an
227	// empty value appearing in NullFields will be sent to the server as
228	// null. It is an error if a field in this list has a non-empty value.
229	// This may be used to include null fields in Patch requests.
230	NullFields []string `json:"-"`
231}
232
233func (s *Activities) MarshalJSON() ([]byte, error) {
234	type NoMethod Activities
235	raw := NoMethod(*s)
236	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
237}
238
239// Activity: JSON template for the activity resource.
240type Activity struct {
241	// Actor: User doing the action.
242	Actor *ActivityActor `json:"actor,omitempty"`
243
244	// Etag: ETag of the entry.
245	Etag string `json:"etag,omitempty"`
246
247	// Events: Activity events.
248	Events []*ActivityEvents `json:"events,omitempty"`
249
250	// Id: Unique identifier for each activity record.
251	Id *ActivityId `json:"id,omitempty"`
252
253	// IpAddress: IP Address of the user doing the action.
254	IpAddress string `json:"ipAddress,omitempty"`
255
256	// Kind: Kind of resource this is.
257	Kind string `json:"kind,omitempty"`
258
259	// OwnerDomain: Domain of source customer.
260	OwnerDomain string `json:"ownerDomain,omitempty"`
261
262	// ForceSendFields is a list of field names (e.g. "Actor") to
263	// unconditionally include in API requests. By default, fields with
264	// empty values are omitted from API requests. However, any non-pointer,
265	// non-interface field appearing in ForceSendFields will be sent to the
266	// server regardless of whether the field is empty or not. This may be
267	// used to include empty fields in Patch requests.
268	ForceSendFields []string `json:"-"`
269
270	// NullFields is a list of field names (e.g. "Actor") to include in API
271	// requests with the JSON null value. By default, fields with empty
272	// values are omitted from API requests. However, any field with an
273	// empty value appearing in NullFields will be sent to the server as
274	// null. It is an error if a field in this list has a non-empty value.
275	// This may be used to include null fields in Patch requests.
276	NullFields []string `json:"-"`
277}
278
279func (s *Activity) MarshalJSON() ([]byte, error) {
280	type NoMethod Activity
281	raw := NoMethod(*s)
282	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
283}
284
285// ActivityActor: User doing the action.
286type ActivityActor struct {
287	// CallerType: User or OAuth 2LO request.
288	CallerType string `json:"callerType,omitempty"`
289
290	// Email: Email address of the user.
291	Email string `json:"email,omitempty"`
292
293	// Key: For OAuth 2LO API requests, consumer_key of the requestor.
294	Key string `json:"key,omitempty"`
295
296	// ProfileId: Obfuscated user id of the user.
297	ProfileId string `json:"profileId,omitempty"`
298
299	// ForceSendFields is a list of field names (e.g. "CallerType") to
300	// unconditionally include in API requests. By default, fields with
301	// empty values are omitted from API requests. However, any non-pointer,
302	// non-interface field appearing in ForceSendFields will be sent to the
303	// server regardless of whether the field is empty or not. This may be
304	// used to include empty fields in Patch requests.
305	ForceSendFields []string `json:"-"`
306
307	// NullFields is a list of field names (e.g. "CallerType") to include in
308	// API requests with the JSON null value. By default, fields with empty
309	// values are omitted from API requests. However, any field with an
310	// empty value appearing in NullFields will be sent to the server as
311	// null. It is an error if a field in this list has a non-empty value.
312	// This may be used to include null fields in Patch requests.
313	NullFields []string `json:"-"`
314}
315
316func (s *ActivityActor) MarshalJSON() ([]byte, error) {
317	type NoMethod ActivityActor
318	raw := NoMethod(*s)
319	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
320}
321
322type ActivityEvents struct {
323	// Name: Name of event.
324	Name string `json:"name,omitempty"`
325
326	// Parameters: Parameter value pairs for various applications.
327	Parameters []*ActivityEventsParameters `json:"parameters,omitempty"`
328
329	// Type: Type of event.
330	Type string `json:"type,omitempty"`
331
332	// ForceSendFields is a list of field names (e.g. "Name") to
333	// unconditionally include in API requests. By default, fields with
334	// empty values are omitted from API requests. However, any non-pointer,
335	// non-interface field appearing in ForceSendFields will be sent to the
336	// server regardless of whether the field is empty or not. This may be
337	// used to include empty fields in Patch requests.
338	ForceSendFields []string `json:"-"`
339
340	// NullFields is a list of field names (e.g. "Name") to include in API
341	// requests with the JSON null value. By default, fields with empty
342	// values are omitted from API requests. However, any field with an
343	// empty value appearing in NullFields will be sent to the server as
344	// null. It is an error if a field in this list has a non-empty value.
345	// This may be used to include null fields in Patch requests.
346	NullFields []string `json:"-"`
347}
348
349func (s *ActivityEvents) MarshalJSON() ([]byte, error) {
350	type NoMethod ActivityEvents
351	raw := NoMethod(*s)
352	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
353}
354
355type ActivityEventsParameters struct {
356	// BoolValue: Boolean value of the parameter.
357	BoolValue bool `json:"boolValue,omitempty"`
358
359	// IntValue: Integral value of the parameter.
360	IntValue int64 `json:"intValue,omitempty,string"`
361
362	// MessageValue: Nested value of the parameter.
363	MessageValue *ActivityEventsParametersMessageValue `json:"messageValue,omitempty"`
364
365	// MultiIntValue: Multi-int value of the parameter.
366	MultiIntValue googleapi.Int64s `json:"multiIntValue,omitempty"`
367
368	// MultiMessageValue: Nested values of the parameter.
369	MultiMessageValue []*ActivityEventsParametersMultiMessageValue `json:"multiMessageValue,omitempty"`
370
371	// MultiValue: Multi-string value of the parameter.
372	MultiValue []string `json:"multiValue,omitempty"`
373
374	// Name: The name of the parameter.
375	Name string `json:"name,omitempty"`
376
377	// Value: String value of the parameter.
378	Value string `json:"value,omitempty"`
379
380	// ForceSendFields is a list of field names (e.g. "BoolValue") to
381	// unconditionally include in API requests. By default, fields with
382	// empty values are omitted from API requests. However, any non-pointer,
383	// non-interface field appearing in ForceSendFields will be sent to the
384	// server regardless of whether the field is empty or not. This may be
385	// used to include empty fields in Patch requests.
386	ForceSendFields []string `json:"-"`
387
388	// NullFields is a list of field names (e.g. "BoolValue") to include in
389	// API requests with the JSON null value. By default, fields with empty
390	// values are omitted from API requests. However, any field with an
391	// empty value appearing in NullFields will be sent to the server as
392	// null. It is an error if a field in this list has a non-empty value.
393	// This may be used to include null fields in Patch requests.
394	NullFields []string `json:"-"`
395}
396
397func (s *ActivityEventsParameters) MarshalJSON() ([]byte, error) {
398	type NoMethod ActivityEventsParameters
399	raw := NoMethod(*s)
400	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
401}
402
403// ActivityEventsParametersMessageValue: Nested value of the parameter.
404type ActivityEventsParametersMessageValue struct {
405	// Parameter: Looping to get parameter values.
406	Parameter []*NestedParameter `json:"parameter,omitempty"`
407
408	// ForceSendFields is a list of field names (e.g. "Parameter") to
409	// unconditionally include in API requests. By default, fields with
410	// empty values are omitted from API requests. However, any non-pointer,
411	// non-interface field appearing in ForceSendFields will be sent to the
412	// server regardless of whether the field is empty or not. This may be
413	// used to include empty fields in Patch requests.
414	ForceSendFields []string `json:"-"`
415
416	// NullFields is a list of field names (e.g. "Parameter") to include in
417	// API requests with the JSON null value. By default, fields with empty
418	// values are omitted from API requests. However, any field with an
419	// empty value appearing in NullFields will be sent to the server as
420	// null. It is an error if a field in this list has a non-empty value.
421	// This may be used to include null fields in Patch requests.
422	NullFields []string `json:"-"`
423}
424
425func (s *ActivityEventsParametersMessageValue) MarshalJSON() ([]byte, error) {
426	type NoMethod ActivityEventsParametersMessageValue
427	raw := NoMethod(*s)
428	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
429}
430
431type ActivityEventsParametersMultiMessageValue struct {
432	// Parameter: Parameter value.
433	Parameter []*NestedParameter `json:"parameter,omitempty"`
434
435	// ForceSendFields is a list of field names (e.g. "Parameter") to
436	// unconditionally include in API requests. By default, fields with
437	// empty values are omitted from API requests. However, any non-pointer,
438	// non-interface field appearing in ForceSendFields will be sent to the
439	// server regardless of whether the field is empty or not. This may be
440	// used to include empty fields in Patch requests.
441	ForceSendFields []string `json:"-"`
442
443	// NullFields is a list of field names (e.g. "Parameter") to include in
444	// API requests with the JSON null value. By default, fields with empty
445	// values are omitted from API requests. However, any field with an
446	// empty value appearing in NullFields will be sent to the server as
447	// null. It is an error if a field in this list has a non-empty value.
448	// This may be used to include null fields in Patch requests.
449	NullFields []string `json:"-"`
450}
451
452func (s *ActivityEventsParametersMultiMessageValue) MarshalJSON() ([]byte, error) {
453	type NoMethod ActivityEventsParametersMultiMessageValue
454	raw := NoMethod(*s)
455	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
456}
457
458// ActivityId: Unique identifier for each activity record.
459type ActivityId struct {
460	// ApplicationName: Application name to which the event belongs.
461	ApplicationName string `json:"applicationName,omitempty"`
462
463	// CustomerId: Obfuscated customer ID of the source customer.
464	CustomerId string `json:"customerId,omitempty"`
465
466	// Time: Time of occurrence of the activity.
467	Time string `json:"time,omitempty"`
468
469	// UniqueQualifier: Unique qualifier if multiple events have the same
470	// time.
471	UniqueQualifier int64 `json:"uniqueQualifier,omitempty,string"`
472
473	// ForceSendFields is a list of field names (e.g. "ApplicationName") to
474	// unconditionally include in API requests. By default, fields with
475	// empty values are omitted from API requests. However, any non-pointer,
476	// non-interface field appearing in ForceSendFields will be sent to the
477	// server regardless of whether the field is empty or not. This may be
478	// used to include empty fields in Patch requests.
479	ForceSendFields []string `json:"-"`
480
481	// NullFields is a list of field names (e.g. "ApplicationName") to
482	// include in API requests with the JSON null value. By default, fields
483	// with empty values are omitted from API requests. However, any field
484	// with an empty value appearing in NullFields will be sent to the
485	// server as null. It is an error if a field in this list has a
486	// non-empty value. This may be used to include null fields in Patch
487	// requests.
488	NullFields []string `json:"-"`
489}
490
491func (s *ActivityId) MarshalJSON() ([]byte, error) {
492	type NoMethod ActivityId
493	raw := NoMethod(*s)
494	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
495}
496
497// Channel: An notification channel used to watch for resource changes.
498type Channel struct {
499	// Address: The address where notifications are delivered for this
500	// channel.
501	Address string `json:"address,omitempty"`
502
503	// Expiration: Date and time of notification channel expiration,
504	// expressed as a Unix timestamp, in milliseconds. Optional.
505	Expiration int64 `json:"expiration,omitempty,string"`
506
507	// Id: A UUID or similar unique string that identifies this channel.
508	Id string `json:"id,omitempty"`
509
510	// Kind: Identifies this as a notification channel used to watch for
511	// changes to a resource. Value: the fixed string "api#channel".
512	Kind string `json:"kind,omitempty"`
513
514	// Params: Additional parameters controlling delivery channel behavior.
515	// Optional.
516	Params map[string]string `json:"params,omitempty"`
517
518	// Payload: A Boolean value to indicate whether payload is wanted.
519	// Optional.
520	Payload bool `json:"payload,omitempty"`
521
522	// ResourceId: An opaque ID that identifies the resource being watched
523	// on this channel. Stable across different API versions.
524	ResourceId string `json:"resourceId,omitempty"`
525
526	// ResourceUri: A version-specific identifier for the watched resource.
527	ResourceUri string `json:"resourceUri,omitempty"`
528
529	// Token: An arbitrary string delivered to the target address with each
530	// notification delivered over this channel. Optional.
531	Token string `json:"token,omitempty"`
532
533	// Type: The type of delivery mechanism used for this channel.
534	Type string `json:"type,omitempty"`
535
536	// ServerResponse contains the HTTP response code and headers from the
537	// server.
538	googleapi.ServerResponse `json:"-"`
539
540	// ForceSendFields is a list of field names (e.g. "Address") to
541	// unconditionally include in API requests. By default, fields with
542	// empty values are omitted from API requests. However, any non-pointer,
543	// non-interface field appearing in ForceSendFields will be sent to the
544	// server regardless of whether the field is empty or not. This may be
545	// used to include empty fields in Patch requests.
546	ForceSendFields []string `json:"-"`
547
548	// NullFields is a list of field names (e.g. "Address") to include in
549	// API requests with the JSON null value. By default, fields with empty
550	// values are omitted from API requests. However, any field with an
551	// empty value appearing in NullFields will be sent to the server as
552	// null. It is an error if a field in this list has a non-empty value.
553	// This may be used to include null fields in Patch requests.
554	NullFields []string `json:"-"`
555}
556
557func (s *Channel) MarshalJSON() ([]byte, error) {
558	type NoMethod Channel
559	raw := NoMethod(*s)
560	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
561}
562
563// NestedParameter: JSON template for a parameter used in various
564// reports.
565type NestedParameter struct {
566	// BoolValue: Boolean value of the parameter.
567	BoolValue bool `json:"boolValue,omitempty"`
568
569	// IntValue: Integral value of the parameter.
570	IntValue int64 `json:"intValue,omitempty,string"`
571
572	// MultiBoolValue: Multiple boolean values of the parameter.
573	MultiBoolValue []bool `json:"multiBoolValue,omitempty"`
574
575	// MultiIntValue: Multiple integral values of the parameter.
576	MultiIntValue googleapi.Int64s `json:"multiIntValue,omitempty"`
577
578	// MultiValue: Multiple string values of the parameter.
579	MultiValue []string `json:"multiValue,omitempty"`
580
581	// Name: The name of the parameter.
582	Name string `json:"name,omitempty"`
583
584	// Value: String value of the parameter.
585	Value string `json:"value,omitempty"`
586
587	// ForceSendFields is a list of field names (e.g. "BoolValue") to
588	// unconditionally include in API requests. By default, fields with
589	// empty values are omitted from API requests. However, any non-pointer,
590	// non-interface field appearing in ForceSendFields will be sent to the
591	// server regardless of whether the field is empty or not. This may be
592	// used to include empty fields in Patch requests.
593	ForceSendFields []string `json:"-"`
594
595	// NullFields is a list of field names (e.g. "BoolValue") to include in
596	// API requests with the JSON null value. By default, fields with empty
597	// values are omitted from API requests. However, any field with an
598	// empty value appearing in NullFields will be sent to the server as
599	// null. It is an error if a field in this list has a non-empty value.
600	// This may be used to include null fields in Patch requests.
601	NullFields []string `json:"-"`
602}
603
604func (s *NestedParameter) MarshalJSON() ([]byte, error) {
605	type NoMethod NestedParameter
606	raw := NoMethod(*s)
607	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
608}
609
610// UsageReport: JSON template for a usage report.
611type UsageReport struct {
612	// Date: The date to which the record belongs.
613	Date string `json:"date,omitempty"`
614
615	// Entity: Information about the type of the item.
616	Entity *UsageReportEntity `json:"entity,omitempty"`
617
618	// Etag: ETag of the resource.
619	Etag string `json:"etag,omitempty"`
620
621	// Kind: The kind of object.
622	Kind string `json:"kind,omitempty"`
623
624	// Parameters: Parameter value pairs for various applications.
625	Parameters []*UsageReportParameters `json:"parameters,omitempty"`
626
627	// ForceSendFields is a list of field names (e.g. "Date") to
628	// unconditionally include in API requests. By default, fields with
629	// empty values are omitted from API requests. However, any non-pointer,
630	// non-interface field appearing in ForceSendFields will be sent to the
631	// server regardless of whether the field is empty or not. This may be
632	// used to include empty fields in Patch requests.
633	ForceSendFields []string `json:"-"`
634
635	// NullFields is a list of field names (e.g. "Date") to include in API
636	// requests with the JSON null value. By default, fields with empty
637	// values are omitted from API requests. However, any field with an
638	// empty value appearing in NullFields will be sent to the server as
639	// null. It is an error if a field in this list has a non-empty value.
640	// This may be used to include null fields in Patch requests.
641	NullFields []string `json:"-"`
642}
643
644func (s *UsageReport) MarshalJSON() ([]byte, error) {
645	type NoMethod UsageReport
646	raw := NoMethod(*s)
647	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
648}
649
650// UsageReportEntity: Information about the type of the item.
651type UsageReportEntity struct {
652	// CustomerId: Obfuscated customer id for the record.
653	CustomerId string `json:"customerId,omitempty"`
654
655	// EntityId: Object key. Only relevant if entity.type = "OBJECT" Note:
656	// external-facing name of report is "Entities" rather than "Objects".
657	EntityId string `json:"entityId,omitempty"`
658
659	// ProfileId: Obfuscated user id for the record.
660	ProfileId string `json:"profileId,omitempty"`
661
662	// Type: The type of item, can be customer, user, or entity (aka.
663	// object).
664	Type string `json:"type,omitempty"`
665
666	// UserEmail: user's email. Only relevant if entity.type = "USER"
667	UserEmail string `json:"userEmail,omitempty"`
668
669	// ForceSendFields is a list of field names (e.g. "CustomerId") to
670	// unconditionally include in API requests. By default, fields with
671	// empty values are omitted from API requests. However, any non-pointer,
672	// non-interface field appearing in ForceSendFields will be sent to the
673	// server regardless of whether the field is empty or not. This may be
674	// used to include empty fields in Patch requests.
675	ForceSendFields []string `json:"-"`
676
677	// NullFields is a list of field names (e.g. "CustomerId") to include in
678	// API requests with the JSON null value. By default, fields with empty
679	// values are omitted from API requests. However, any field with an
680	// empty value appearing in NullFields will be sent to the server as
681	// null. It is an error if a field in this list has a non-empty value.
682	// This may be used to include null fields in Patch requests.
683	NullFields []string `json:"-"`
684}
685
686func (s *UsageReportEntity) MarshalJSON() ([]byte, error) {
687	type NoMethod UsageReportEntity
688	raw := NoMethod(*s)
689	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
690}
691
692type UsageReportParameters struct {
693	// BoolValue: Boolean value of the parameter.
694	BoolValue bool `json:"boolValue,omitempty"`
695
696	// DatetimeValue: RFC 3339 formatted value of the parameter.
697	DatetimeValue string `json:"datetimeValue,omitempty"`
698
699	// IntValue: Integral value of the parameter.
700	IntValue int64 `json:"intValue,omitempty,string"`
701
702	// MsgValue: Nested message value of the parameter.
703	MsgValue []googleapi.RawMessage `json:"msgValue,omitempty"`
704
705	// Name: The name of the parameter.
706	Name string `json:"name,omitempty"`
707
708	// StringValue: String value of the parameter.
709	StringValue string `json:"stringValue,omitempty"`
710
711	// ForceSendFields is a list of field names (e.g. "BoolValue") to
712	// unconditionally include in API requests. By default, fields with
713	// empty values are omitted from API requests. However, any non-pointer,
714	// non-interface field appearing in ForceSendFields will be sent to the
715	// server regardless of whether the field is empty or not. This may be
716	// used to include empty fields in Patch requests.
717	ForceSendFields []string `json:"-"`
718
719	// NullFields is a list of field names (e.g. "BoolValue") to include in
720	// API requests with the JSON null value. By default, fields with empty
721	// values are omitted from API requests. However, any field with an
722	// empty value appearing in NullFields will be sent to the server as
723	// null. It is an error if a field in this list has a non-empty value.
724	// This may be used to include null fields in Patch requests.
725	NullFields []string `json:"-"`
726}
727
728func (s *UsageReportParameters) MarshalJSON() ([]byte, error) {
729	type NoMethod UsageReportParameters
730	raw := NoMethod(*s)
731	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
732}
733
734// UsageReports: JSON template for a collection of usage reports.
735type UsageReports struct {
736	// Etag: ETag of the resource.
737	Etag string `json:"etag,omitempty"`
738
739	// Kind: The kind of object.
740	Kind string `json:"kind,omitempty"`
741
742	// NextPageToken: Token for retrieving the next page
743	NextPageToken string `json:"nextPageToken,omitempty"`
744
745	// UsageReports: Various application parameter records.
746	UsageReports []*UsageReport `json:"usageReports,omitempty"`
747
748	// Warnings: Warnings if any.
749	Warnings []*UsageReportsWarnings `json:"warnings,omitempty"`
750
751	// ServerResponse contains the HTTP response code and headers from the
752	// server.
753	googleapi.ServerResponse `json:"-"`
754
755	// ForceSendFields is a list of field names (e.g. "Etag") to
756	// unconditionally include in API requests. By default, fields with
757	// empty values are omitted from API requests. However, any non-pointer,
758	// non-interface field appearing in ForceSendFields will be sent to the
759	// server regardless of whether the field is empty or not. This may be
760	// used to include empty fields in Patch requests.
761	ForceSendFields []string `json:"-"`
762
763	// NullFields is a list of field names (e.g. "Etag") to include in API
764	// requests with the JSON null value. By default, fields with empty
765	// values are omitted from API requests. However, any field with an
766	// empty value appearing in NullFields will be sent to the server as
767	// null. It is an error if a field in this list has a non-empty value.
768	// This may be used to include null fields in Patch requests.
769	NullFields []string `json:"-"`
770}
771
772func (s *UsageReports) MarshalJSON() ([]byte, error) {
773	type NoMethod UsageReports
774	raw := NoMethod(*s)
775	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
776}
777
778type UsageReportsWarnings struct {
779	// Code: Machine readable code / warning type.
780	Code string `json:"code,omitempty"`
781
782	// Data: Key-Value pairs to give detailed information on the warning.
783	Data []*UsageReportsWarningsData `json:"data,omitempty"`
784
785	// Message: Human readable message for the warning.
786	Message string `json:"message,omitempty"`
787
788	// ForceSendFields is a list of field names (e.g. "Code") to
789	// unconditionally include in API requests. By default, fields with
790	// empty values are omitted from API requests. However, any non-pointer,
791	// non-interface field appearing in ForceSendFields will be sent to the
792	// server regardless of whether the field is empty or not. This may be
793	// used to include empty fields in Patch requests.
794	ForceSendFields []string `json:"-"`
795
796	// NullFields is a list of field names (e.g. "Code") to include in API
797	// requests with the JSON null value. By default, fields with empty
798	// values are omitted from API requests. However, any field with an
799	// empty value appearing in NullFields will be sent to the server as
800	// null. It is an error if a field in this list has a non-empty value.
801	// This may be used to include null fields in Patch requests.
802	NullFields []string `json:"-"`
803}
804
805func (s *UsageReportsWarnings) MarshalJSON() ([]byte, error) {
806	type NoMethod UsageReportsWarnings
807	raw := NoMethod(*s)
808	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
809}
810
811type UsageReportsWarningsData struct {
812	// Key: Key associated with a key-value pair to give detailed
813	// information on the warning.
814	Key string `json:"key,omitempty"`
815
816	// Value: Value associated with a key-value pair to give detailed
817	// information on the warning.
818	Value string `json:"value,omitempty"`
819
820	// ForceSendFields is a list of field names (e.g. "Key") to
821	// unconditionally include in API requests. By default, fields with
822	// empty values are omitted from API requests. However, any non-pointer,
823	// non-interface field appearing in ForceSendFields will be sent to the
824	// server regardless of whether the field is empty or not. This may be
825	// used to include empty fields in Patch requests.
826	ForceSendFields []string `json:"-"`
827
828	// NullFields is a list of field names (e.g. "Key") to include in API
829	// requests with the JSON null value. By default, fields with empty
830	// values are omitted from API requests. However, any field with an
831	// empty value appearing in NullFields will be sent to the server as
832	// null. It is an error if a field in this list has a non-empty value.
833	// This may be used to include null fields in Patch requests.
834	NullFields []string `json:"-"`
835}
836
837func (s *UsageReportsWarningsData) MarshalJSON() ([]byte, error) {
838	type NoMethod UsageReportsWarningsData
839	raw := NoMethod(*s)
840	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
841}
842
843// method id "reports.activities.list":
844
845type ActivitiesListCall struct {
846	s               *Service
847	userKey         string
848	applicationName string
849	urlParams_      gensupport.URLParams
850	ifNoneMatch_    string
851	ctx_            context.Context
852	header_         http.Header
853}
854
855// List: Retrieves a list of activities for a specific customer and
856// application.
857func (r *ActivitiesService) List(userKey string, applicationName string) *ActivitiesListCall {
858	c := &ActivitiesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
859	c.userKey = userKey
860	c.applicationName = applicationName
861	return c
862}
863
864// ActorIpAddress sets the optional parameter "actorIpAddress": IP
865// Address of host where the event was performed. Supports both IPv4 and
866// IPv6 addresses.
867func (c *ActivitiesListCall) ActorIpAddress(actorIpAddress string) *ActivitiesListCall {
868	c.urlParams_.Set("actorIpAddress", actorIpAddress)
869	return c
870}
871
872// CustomerId sets the optional parameter "customerId": Represents the
873// customer for which the data is to be fetched.
874func (c *ActivitiesListCall) CustomerId(customerId string) *ActivitiesListCall {
875	c.urlParams_.Set("customerId", customerId)
876	return c
877}
878
879// EndTime sets the optional parameter "endTime": Return events which
880// occurred at or before this time.
881func (c *ActivitiesListCall) EndTime(endTime string) *ActivitiesListCall {
882	c.urlParams_.Set("endTime", endTime)
883	return c
884}
885
886// EventName sets the optional parameter "eventName": Name of the event
887// being queried.
888func (c *ActivitiesListCall) EventName(eventName string) *ActivitiesListCall {
889	c.urlParams_.Set("eventName", eventName)
890	return c
891}
892
893// Filters sets the optional parameter "filters": Event parameters in
894// the form [parameter1 name][operator][parameter1 value],[parameter2
895// name][operator][parameter2 value],...
896func (c *ActivitiesListCall) Filters(filters string) *ActivitiesListCall {
897	c.urlParams_.Set("filters", filters)
898	return c
899}
900
901// MaxResults sets the optional parameter "maxResults": Number of
902// activity records to be shown in each page.
903func (c *ActivitiesListCall) MaxResults(maxResults int64) *ActivitiesListCall {
904	c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
905	return c
906}
907
908// OrgUnitID sets the optional parameter "orgUnitID": the organizational
909// unit's(OU) ID to filter activities from users belonging to a specific
910// OU or one of its sub-OU(s)
911func (c *ActivitiesListCall) OrgUnitID(orgUnitID string) *ActivitiesListCall {
912	c.urlParams_.Set("orgUnitID", orgUnitID)
913	return c
914}
915
916// PageToken sets the optional parameter "pageToken": Token to specify
917// next page.
918func (c *ActivitiesListCall) PageToken(pageToken string) *ActivitiesListCall {
919	c.urlParams_.Set("pageToken", pageToken)
920	return c
921}
922
923// StartTime sets the optional parameter "startTime": Return events
924// which occurred at or after this time.
925func (c *ActivitiesListCall) StartTime(startTime string) *ActivitiesListCall {
926	c.urlParams_.Set("startTime", startTime)
927	return c
928}
929
930// Fields allows partial responses to be retrieved. See
931// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
932// for more information.
933func (c *ActivitiesListCall) Fields(s ...googleapi.Field) *ActivitiesListCall {
934	c.urlParams_.Set("fields", googleapi.CombineFields(s))
935	return c
936}
937
938// IfNoneMatch sets the optional parameter which makes the operation
939// fail if the object's ETag matches the given value. This is useful for
940// getting updates only after the object has changed since the last
941// request. Use googleapi.IsNotModified to check whether the response
942// error from Do is the result of In-None-Match.
943func (c *ActivitiesListCall) IfNoneMatch(entityTag string) *ActivitiesListCall {
944	c.ifNoneMatch_ = entityTag
945	return c
946}
947
948// Context sets the context to be used in this call's Do method. Any
949// pending HTTP request will be aborted if the provided context is
950// canceled.
951func (c *ActivitiesListCall) Context(ctx context.Context) *ActivitiesListCall {
952	c.ctx_ = ctx
953	return c
954}
955
956// Header returns an http.Header that can be modified by the caller to
957// add HTTP headers to the request.
958func (c *ActivitiesListCall) Header() http.Header {
959	if c.header_ == nil {
960		c.header_ = make(http.Header)
961	}
962	return c.header_
963}
964
965func (c *ActivitiesListCall) doRequest(alt string) (*http.Response, error) {
966	reqHeaders := make(http.Header)
967	for k, v := range c.header_ {
968		reqHeaders[k] = v
969	}
970	reqHeaders.Set("User-Agent", c.s.userAgent())
971	if c.ifNoneMatch_ != "" {
972		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
973	}
974	var body io.Reader = nil
975	c.urlParams_.Set("alt", alt)
976	c.urlParams_.Set("prettyPrint", "false")
977	urls := googleapi.ResolveRelative(c.s.BasePath, "activity/users/{userKey}/applications/{applicationName}")
978	urls += "?" + c.urlParams_.Encode()
979	req, err := http.NewRequest("GET", urls, body)
980	if err != nil {
981		return nil, err
982	}
983	req.Header = reqHeaders
984	googleapi.Expand(req.URL, map[string]string{
985		"userKey":         c.userKey,
986		"applicationName": c.applicationName,
987	})
988	return gensupport.SendRequest(c.ctx_, c.s.client, req)
989}
990
991// Do executes the "reports.activities.list" call.
992// Exactly one of *Activities or error will be non-nil. Any non-2xx
993// status code is an error. Response headers are in either
994// *Activities.ServerResponse.Header or (if a response was returned at
995// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
996// to check whether the returned error was because
997// http.StatusNotModified was returned.
998func (c *ActivitiesListCall) Do(opts ...googleapi.CallOption) (*Activities, error) {
999	gensupport.SetOptions(c.urlParams_, opts...)
1000	res, err := c.doRequest("json")
1001	if res != nil && res.StatusCode == http.StatusNotModified {
1002		if res.Body != nil {
1003			res.Body.Close()
1004		}
1005		return nil, &googleapi.Error{
1006			Code:   res.StatusCode,
1007			Header: res.Header,
1008		}
1009	}
1010	if err != nil {
1011		return nil, err
1012	}
1013	defer googleapi.CloseBody(res)
1014	if err := googleapi.CheckResponse(res); err != nil {
1015		return nil, err
1016	}
1017	ret := &Activities{
1018		ServerResponse: googleapi.ServerResponse{
1019			Header:         res.Header,
1020			HTTPStatusCode: res.StatusCode,
1021		},
1022	}
1023	target := &ret
1024	if err := gensupport.DecodeResponse(target, res); err != nil {
1025		return nil, err
1026	}
1027	return ret, nil
1028	// {
1029	//   "description": "Retrieves a list of activities for a specific customer and application.",
1030	//   "httpMethod": "GET",
1031	//   "id": "reports.activities.list",
1032	//   "parameterOrder": [
1033	//     "userKey",
1034	//     "applicationName"
1035	//   ],
1036	//   "parameters": {
1037	//     "actorIpAddress": {
1038	//       "description": "IP Address of host where the event was performed. Supports both IPv4 and IPv6 addresses.",
1039	//       "location": "query",
1040	//       "type": "string"
1041	//     },
1042	//     "applicationName": {
1043	//       "description": "Application name for which the events are to be retrieved.",
1044	//       "location": "path",
1045	//       "pattern": "(admin)|(calendar)|(drive)|(login)|(mobile)|(token)|(groups)|(saml)|(chat)|(gplus)|(rules)|(jamboard)|(meet)|(user_accounts)|(access_transparency)|(groups_enterprise)",
1046	//       "required": true,
1047	//       "type": "string"
1048	//     },
1049	//     "customerId": {
1050	//       "description": "Represents the customer for which the data is to be fetched.",
1051	//       "location": "query",
1052	//       "pattern": "C.+",
1053	//       "type": "string"
1054	//     },
1055	//     "endTime": {
1056	//       "description": "Return events which occurred at or before this time.",
1057	//       "location": "query",
1058	//       "pattern": "(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d):(\\d\\d)(?:\\.(\\d+))?(?:(Z)|([-+])(\\d\\d):(\\d\\d))",
1059	//       "type": "string"
1060	//     },
1061	//     "eventName": {
1062	//       "description": "Name of the event being queried.",
1063	//       "location": "query",
1064	//       "type": "string"
1065	//     },
1066	//     "filters": {
1067	//       "description": "Event parameters in the form [parameter1 name][operator][parameter1 value],[parameter2 name][operator][parameter2 value],...",
1068	//       "location": "query",
1069	//       "pattern": "(.+[\u003c,\u003c=,==,\u003e=,\u003e,\u003c\u003e].+,)*(.+[\u003c,\u003c=,==,\u003e=,\u003e,\u003c\u003e].+)",
1070	//       "type": "string"
1071	//     },
1072	//     "maxResults": {
1073	//       "description": "Number of activity records to be shown in each page.",
1074	//       "format": "int32",
1075	//       "location": "query",
1076	//       "maximum": "1000",
1077	//       "minimum": "1",
1078	//       "type": "integer"
1079	//     },
1080	//     "orgUnitID": {
1081	//       "default": "",
1082	//       "description": "the organizational unit's(OU) ID to filter activities from users belonging to a specific OU or one of its sub-OU(s)",
1083	//       "location": "query",
1084	//       "pattern": "(id:[a-z0-9]+)",
1085	//       "type": "string"
1086	//     },
1087	//     "pageToken": {
1088	//       "description": "Token to specify next page.",
1089	//       "location": "query",
1090	//       "type": "string"
1091	//     },
1092	//     "startTime": {
1093	//       "description": "Return events which occurred at or after this time.",
1094	//       "location": "query",
1095	//       "pattern": "(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d):(\\d\\d)(?:\\.(\\d+))?(?:(Z)|([-+])(\\d\\d):(\\d\\d))",
1096	//       "type": "string"
1097	//     },
1098	//     "userKey": {
1099	//       "description": "Represents the profile id or the user email for which the data should be filtered. When 'all' is specified as the userKey, it returns usageReports for all users.",
1100	//       "location": "path",
1101	//       "required": true,
1102	//       "type": "string"
1103	//     }
1104	//   },
1105	//   "path": "activity/users/{userKey}/applications/{applicationName}",
1106	//   "response": {
1107	//     "$ref": "Activities"
1108	//   },
1109	//   "scopes": [
1110	//     "https://www.googleapis.com/auth/admin.reports.audit.readonly"
1111	//   ],
1112	//   "supportsSubscription": true
1113	// }
1114
1115}
1116
1117// Pages invokes f for each page of results.
1118// A non-nil error returned from f will halt the iteration.
1119// The provided context supersedes any context provided to the Context method.
1120func (c *ActivitiesListCall) Pages(ctx context.Context, f func(*Activities) error) error {
1121	c.ctx_ = ctx
1122	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
1123	for {
1124		x, err := c.Do()
1125		if err != nil {
1126			return err
1127		}
1128		if err := f(x); err != nil {
1129			return err
1130		}
1131		if x.NextPageToken == "" {
1132			return nil
1133		}
1134		c.PageToken(x.NextPageToken)
1135	}
1136}
1137
1138// method id "reports.activities.watch":
1139
1140type ActivitiesWatchCall struct {
1141	s               *Service
1142	userKey         string
1143	applicationName string
1144	channel         *Channel
1145	urlParams_      gensupport.URLParams
1146	ctx_            context.Context
1147	header_         http.Header
1148}
1149
1150// Watch: Push changes to activities
1151func (r *ActivitiesService) Watch(userKey string, applicationName string, channel *Channel) *ActivitiesWatchCall {
1152	c := &ActivitiesWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1153	c.userKey = userKey
1154	c.applicationName = applicationName
1155	c.channel = channel
1156	return c
1157}
1158
1159// ActorIpAddress sets the optional parameter "actorIpAddress": IP
1160// Address of host where the event was performed. Supports both IPv4 and
1161// IPv6 addresses.
1162func (c *ActivitiesWatchCall) ActorIpAddress(actorIpAddress string) *ActivitiesWatchCall {
1163	c.urlParams_.Set("actorIpAddress", actorIpAddress)
1164	return c
1165}
1166
1167// CustomerId sets the optional parameter "customerId": Represents the
1168// customer for which the data is to be fetched.
1169func (c *ActivitiesWatchCall) CustomerId(customerId string) *ActivitiesWatchCall {
1170	c.urlParams_.Set("customerId", customerId)
1171	return c
1172}
1173
1174// EndTime sets the optional parameter "endTime": Return events which
1175// occurred at or before this time.
1176func (c *ActivitiesWatchCall) EndTime(endTime string) *ActivitiesWatchCall {
1177	c.urlParams_.Set("endTime", endTime)
1178	return c
1179}
1180
1181// EventName sets the optional parameter "eventName": Name of the event
1182// being queried.
1183func (c *ActivitiesWatchCall) EventName(eventName string) *ActivitiesWatchCall {
1184	c.urlParams_.Set("eventName", eventName)
1185	return c
1186}
1187
1188// Filters sets the optional parameter "filters": Event parameters in
1189// the form [parameter1 name][operator][parameter1 value],[parameter2
1190// name][operator][parameter2 value],...
1191func (c *ActivitiesWatchCall) Filters(filters string) *ActivitiesWatchCall {
1192	c.urlParams_.Set("filters", filters)
1193	return c
1194}
1195
1196// MaxResults sets the optional parameter "maxResults": Number of
1197// activity records to be shown in each page.
1198func (c *ActivitiesWatchCall) MaxResults(maxResults int64) *ActivitiesWatchCall {
1199	c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
1200	return c
1201}
1202
1203// OrgUnitID sets the optional parameter "orgUnitID": the organizational
1204// unit's(OU) ID to filter activities from users belonging to a specific
1205// OU or one of its sub-OU(s)
1206func (c *ActivitiesWatchCall) OrgUnitID(orgUnitID string) *ActivitiesWatchCall {
1207	c.urlParams_.Set("orgUnitID", orgUnitID)
1208	return c
1209}
1210
1211// PageToken sets the optional parameter "pageToken": Token to specify
1212// next page.
1213func (c *ActivitiesWatchCall) PageToken(pageToken string) *ActivitiesWatchCall {
1214	c.urlParams_.Set("pageToken", pageToken)
1215	return c
1216}
1217
1218// StartTime sets the optional parameter "startTime": Return events
1219// which occurred at or after this time.
1220func (c *ActivitiesWatchCall) StartTime(startTime string) *ActivitiesWatchCall {
1221	c.urlParams_.Set("startTime", startTime)
1222	return c
1223}
1224
1225// Fields allows partial responses to be retrieved. See
1226// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1227// for more information.
1228func (c *ActivitiesWatchCall) Fields(s ...googleapi.Field) *ActivitiesWatchCall {
1229	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1230	return c
1231}
1232
1233// Context sets the context to be used in this call's Do method. Any
1234// pending HTTP request will be aborted if the provided context is
1235// canceled.
1236func (c *ActivitiesWatchCall) Context(ctx context.Context) *ActivitiesWatchCall {
1237	c.ctx_ = ctx
1238	return c
1239}
1240
1241// Header returns an http.Header that can be modified by the caller to
1242// add HTTP headers to the request.
1243func (c *ActivitiesWatchCall) Header() http.Header {
1244	if c.header_ == nil {
1245		c.header_ = make(http.Header)
1246	}
1247	return c.header_
1248}
1249
1250func (c *ActivitiesWatchCall) doRequest(alt string) (*http.Response, error) {
1251	reqHeaders := make(http.Header)
1252	for k, v := range c.header_ {
1253		reqHeaders[k] = v
1254	}
1255	reqHeaders.Set("User-Agent", c.s.userAgent())
1256	var body io.Reader = nil
1257	body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
1258	if err != nil {
1259		return nil, err
1260	}
1261	reqHeaders.Set("Content-Type", "application/json")
1262	c.urlParams_.Set("alt", alt)
1263	c.urlParams_.Set("prettyPrint", "false")
1264	urls := googleapi.ResolveRelative(c.s.BasePath, "activity/users/{userKey}/applications/{applicationName}/watch")
1265	urls += "?" + c.urlParams_.Encode()
1266	req, err := http.NewRequest("POST", urls, body)
1267	if err != nil {
1268		return nil, err
1269	}
1270	req.Header = reqHeaders
1271	googleapi.Expand(req.URL, map[string]string{
1272		"userKey":         c.userKey,
1273		"applicationName": c.applicationName,
1274	})
1275	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1276}
1277
1278// Do executes the "reports.activities.watch" call.
1279// Exactly one of *Channel or error will be non-nil. Any non-2xx status
1280// code is an error. Response headers are in either
1281// *Channel.ServerResponse.Header or (if a response was returned at all)
1282// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
1283// check whether the returned error was because http.StatusNotModified
1284// was returned.
1285func (c *ActivitiesWatchCall) Do(opts ...googleapi.CallOption) (*Channel, error) {
1286	gensupport.SetOptions(c.urlParams_, opts...)
1287	res, err := c.doRequest("json")
1288	if res != nil && res.StatusCode == http.StatusNotModified {
1289		if res.Body != nil {
1290			res.Body.Close()
1291		}
1292		return nil, &googleapi.Error{
1293			Code:   res.StatusCode,
1294			Header: res.Header,
1295		}
1296	}
1297	if err != nil {
1298		return nil, err
1299	}
1300	defer googleapi.CloseBody(res)
1301	if err := googleapi.CheckResponse(res); err != nil {
1302		return nil, err
1303	}
1304	ret := &Channel{
1305		ServerResponse: googleapi.ServerResponse{
1306			Header:         res.Header,
1307			HTTPStatusCode: res.StatusCode,
1308		},
1309	}
1310	target := &ret
1311	if err := gensupport.DecodeResponse(target, res); err != nil {
1312		return nil, err
1313	}
1314	return ret, nil
1315	// {
1316	//   "description": "Push changes to activities",
1317	//   "httpMethod": "POST",
1318	//   "id": "reports.activities.watch",
1319	//   "parameterOrder": [
1320	//     "userKey",
1321	//     "applicationName"
1322	//   ],
1323	//   "parameters": {
1324	//     "actorIpAddress": {
1325	//       "description": "IP Address of host where the event was performed. Supports both IPv4 and IPv6 addresses.",
1326	//       "location": "query",
1327	//       "type": "string"
1328	//     },
1329	//     "applicationName": {
1330	//       "description": "Application name for which the events are to be retrieved.",
1331	//       "location": "path",
1332	//       "pattern": "(admin)|(calendar)|(drive)|(login)|(mobile)|(token)|(groups)|(saml)|(chat)|(gplus)|(rules)|(jamboard)|(meet)|(user_accounts)|(access_transparency)|(groups_enterprise)",
1333	//       "required": true,
1334	//       "type": "string"
1335	//     },
1336	//     "customerId": {
1337	//       "description": "Represents the customer for which the data is to be fetched.",
1338	//       "location": "query",
1339	//       "pattern": "C.+",
1340	//       "type": "string"
1341	//     },
1342	//     "endTime": {
1343	//       "description": "Return events which occurred at or before this time.",
1344	//       "location": "query",
1345	//       "pattern": "(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d):(\\d\\d)(?:\\.(\\d+))?(?:(Z)|([-+])(\\d\\d):(\\d\\d))",
1346	//       "type": "string"
1347	//     },
1348	//     "eventName": {
1349	//       "description": "Name of the event being queried.",
1350	//       "location": "query",
1351	//       "type": "string"
1352	//     },
1353	//     "filters": {
1354	//       "description": "Event parameters in the form [parameter1 name][operator][parameter1 value],[parameter2 name][operator][parameter2 value],...",
1355	//       "location": "query",
1356	//       "pattern": "(.+[\u003c,\u003c=,==,\u003e=,\u003e,\u003c\u003e].+,)*(.+[\u003c,\u003c=,==,\u003e=,\u003e,\u003c\u003e].+)",
1357	//       "type": "string"
1358	//     },
1359	//     "maxResults": {
1360	//       "description": "Number of activity records to be shown in each page.",
1361	//       "format": "int32",
1362	//       "location": "query",
1363	//       "maximum": "1000",
1364	//       "minimum": "1",
1365	//       "type": "integer"
1366	//     },
1367	//     "orgUnitID": {
1368	//       "default": "",
1369	//       "description": "the organizational unit's(OU) ID to filter activities from users belonging to a specific OU or one of its sub-OU(s)",
1370	//       "location": "query",
1371	//       "pattern": "(id:[a-z0-9]+)",
1372	//       "type": "string"
1373	//     },
1374	//     "pageToken": {
1375	//       "description": "Token to specify next page.",
1376	//       "location": "query",
1377	//       "type": "string"
1378	//     },
1379	//     "startTime": {
1380	//       "description": "Return events which occurred at or after this time.",
1381	//       "location": "query",
1382	//       "pattern": "(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d):(\\d\\d)(?:\\.(\\d+))?(?:(Z)|([-+])(\\d\\d):(\\d\\d))",
1383	//       "type": "string"
1384	//     },
1385	//     "userKey": {
1386	//       "description": "Represents the profile id or the user email for which the data should be filtered. When 'all' is specified as the userKey, it returns usageReports for all users.",
1387	//       "location": "path",
1388	//       "required": true,
1389	//       "type": "string"
1390	//     }
1391	//   },
1392	//   "path": "activity/users/{userKey}/applications/{applicationName}/watch",
1393	//   "request": {
1394	//     "$ref": "Channel",
1395	//     "parameterName": "resource"
1396	//   },
1397	//   "response": {
1398	//     "$ref": "Channel"
1399	//   },
1400	//   "scopes": [
1401	//     "https://www.googleapis.com/auth/admin.reports.audit.readonly"
1402	//   ],
1403	//   "supportsSubscription": true
1404	// }
1405
1406}
1407
1408// method id "admin.channels.stop":
1409
1410type ChannelsStopCall struct {
1411	s          *Service
1412	channel    *Channel
1413	urlParams_ gensupport.URLParams
1414	ctx_       context.Context
1415	header_    http.Header
1416}
1417
1418// Stop: Stop watching resources through this channel
1419func (r *ChannelsService) Stop(channel *Channel) *ChannelsStopCall {
1420	c := &ChannelsStopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1421	c.channel = channel
1422	return c
1423}
1424
1425// Fields allows partial responses to be retrieved. See
1426// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1427// for more information.
1428func (c *ChannelsStopCall) Fields(s ...googleapi.Field) *ChannelsStopCall {
1429	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1430	return c
1431}
1432
1433// Context sets the context to be used in this call's Do method. Any
1434// pending HTTP request will be aborted if the provided context is
1435// canceled.
1436func (c *ChannelsStopCall) Context(ctx context.Context) *ChannelsStopCall {
1437	c.ctx_ = ctx
1438	return c
1439}
1440
1441// Header returns an http.Header that can be modified by the caller to
1442// add HTTP headers to the request.
1443func (c *ChannelsStopCall) Header() http.Header {
1444	if c.header_ == nil {
1445		c.header_ = make(http.Header)
1446	}
1447	return c.header_
1448}
1449
1450func (c *ChannelsStopCall) doRequest(alt string) (*http.Response, error) {
1451	reqHeaders := make(http.Header)
1452	for k, v := range c.header_ {
1453		reqHeaders[k] = v
1454	}
1455	reqHeaders.Set("User-Agent", c.s.userAgent())
1456	var body io.Reader = nil
1457	body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
1458	if err != nil {
1459		return nil, err
1460	}
1461	reqHeaders.Set("Content-Type", "application/json")
1462	c.urlParams_.Set("alt", alt)
1463	c.urlParams_.Set("prettyPrint", "false")
1464	urls := googleapi.ResolveRelative(c.s.BasePath, "/admin/reports_v1/channels/stop")
1465	urls += "?" + c.urlParams_.Encode()
1466	req, err := http.NewRequest("POST", urls, body)
1467	if err != nil {
1468		return nil, err
1469	}
1470	req.Header = reqHeaders
1471	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1472}
1473
1474// Do executes the "admin.channels.stop" call.
1475func (c *ChannelsStopCall) Do(opts ...googleapi.CallOption) error {
1476	gensupport.SetOptions(c.urlParams_, opts...)
1477	res, err := c.doRequest("json")
1478	if err != nil {
1479		return err
1480	}
1481	defer googleapi.CloseBody(res)
1482	if err := googleapi.CheckResponse(res); err != nil {
1483		return err
1484	}
1485	return nil
1486	// {
1487	//   "description": "Stop watching resources through this channel",
1488	//   "httpMethod": "POST",
1489	//   "id": "admin.channels.stop",
1490	//   "path": "/admin/reports_v1/channels/stop",
1491	//   "request": {
1492	//     "$ref": "Channel",
1493	//     "parameterName": "resource"
1494	//   },
1495	//   "scopes": [
1496	//     "https://www.googleapis.com/auth/admin.reports.audit.readonly"
1497	//   ]
1498	// }
1499
1500}
1501
1502// method id "reports.customerUsageReports.get":
1503
1504type CustomerUsageReportsGetCall struct {
1505	s            *Service
1506	date         string
1507	urlParams_   gensupport.URLParams
1508	ifNoneMatch_ string
1509	ctx_         context.Context
1510	header_      http.Header
1511}
1512
1513// Get: Retrieves a report which is a collection of properties /
1514// statistics for a specific customer.
1515func (r *CustomerUsageReportsService) Get(date string) *CustomerUsageReportsGetCall {
1516	c := &CustomerUsageReportsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1517	c.date = date
1518	return c
1519}
1520
1521// CustomerId sets the optional parameter "customerId": Represents the
1522// customer for which the data is to be fetched.
1523func (c *CustomerUsageReportsGetCall) CustomerId(customerId string) *CustomerUsageReportsGetCall {
1524	c.urlParams_.Set("customerId", customerId)
1525	return c
1526}
1527
1528// PageToken sets the optional parameter "pageToken": Token to specify
1529// next page.
1530func (c *CustomerUsageReportsGetCall) PageToken(pageToken string) *CustomerUsageReportsGetCall {
1531	c.urlParams_.Set("pageToken", pageToken)
1532	return c
1533}
1534
1535// Parameters sets the optional parameter "parameters": Represents the
1536// application name, parameter name pairs to fetch in csv as
1537// app_name1:param_name1, app_name2:param_name2.
1538func (c *CustomerUsageReportsGetCall) Parameters(parameters string) *CustomerUsageReportsGetCall {
1539	c.urlParams_.Set("parameters", parameters)
1540	return c
1541}
1542
1543// Fields allows partial responses to be retrieved. See
1544// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1545// for more information.
1546func (c *CustomerUsageReportsGetCall) Fields(s ...googleapi.Field) *CustomerUsageReportsGetCall {
1547	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1548	return c
1549}
1550
1551// IfNoneMatch sets the optional parameter which makes the operation
1552// fail if the object's ETag matches the given value. This is useful for
1553// getting updates only after the object has changed since the last
1554// request. Use googleapi.IsNotModified to check whether the response
1555// error from Do is the result of In-None-Match.
1556func (c *CustomerUsageReportsGetCall) IfNoneMatch(entityTag string) *CustomerUsageReportsGetCall {
1557	c.ifNoneMatch_ = entityTag
1558	return c
1559}
1560
1561// Context sets the context to be used in this call's Do method. Any
1562// pending HTTP request will be aborted if the provided context is
1563// canceled.
1564func (c *CustomerUsageReportsGetCall) Context(ctx context.Context) *CustomerUsageReportsGetCall {
1565	c.ctx_ = ctx
1566	return c
1567}
1568
1569// Header returns an http.Header that can be modified by the caller to
1570// add HTTP headers to the request.
1571func (c *CustomerUsageReportsGetCall) Header() http.Header {
1572	if c.header_ == nil {
1573		c.header_ = make(http.Header)
1574	}
1575	return c.header_
1576}
1577
1578func (c *CustomerUsageReportsGetCall) doRequest(alt string) (*http.Response, error) {
1579	reqHeaders := make(http.Header)
1580	for k, v := range c.header_ {
1581		reqHeaders[k] = v
1582	}
1583	reqHeaders.Set("User-Agent", c.s.userAgent())
1584	if c.ifNoneMatch_ != "" {
1585		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1586	}
1587	var body io.Reader = nil
1588	c.urlParams_.Set("alt", alt)
1589	c.urlParams_.Set("prettyPrint", "false")
1590	urls := googleapi.ResolveRelative(c.s.BasePath, "usage/dates/{date}")
1591	urls += "?" + c.urlParams_.Encode()
1592	req, err := http.NewRequest("GET", urls, body)
1593	if err != nil {
1594		return nil, err
1595	}
1596	req.Header = reqHeaders
1597	googleapi.Expand(req.URL, map[string]string{
1598		"date": c.date,
1599	})
1600	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1601}
1602
1603// Do executes the "reports.customerUsageReports.get" call.
1604// Exactly one of *UsageReports or error will be non-nil. Any non-2xx
1605// status code is an error. Response headers are in either
1606// *UsageReports.ServerResponse.Header or (if a response was returned at
1607// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
1608// to check whether the returned error was because
1609// http.StatusNotModified was returned.
1610func (c *CustomerUsageReportsGetCall) Do(opts ...googleapi.CallOption) (*UsageReports, error) {
1611	gensupport.SetOptions(c.urlParams_, opts...)
1612	res, err := c.doRequest("json")
1613	if res != nil && res.StatusCode == http.StatusNotModified {
1614		if res.Body != nil {
1615			res.Body.Close()
1616		}
1617		return nil, &googleapi.Error{
1618			Code:   res.StatusCode,
1619			Header: res.Header,
1620		}
1621	}
1622	if err != nil {
1623		return nil, err
1624	}
1625	defer googleapi.CloseBody(res)
1626	if err := googleapi.CheckResponse(res); err != nil {
1627		return nil, err
1628	}
1629	ret := &UsageReports{
1630		ServerResponse: googleapi.ServerResponse{
1631			Header:         res.Header,
1632			HTTPStatusCode: res.StatusCode,
1633		},
1634	}
1635	target := &ret
1636	if err := gensupport.DecodeResponse(target, res); err != nil {
1637		return nil, err
1638	}
1639	return ret, nil
1640	// {
1641	//   "description": "Retrieves a report which is a collection of properties / statistics for a specific customer.",
1642	//   "httpMethod": "GET",
1643	//   "id": "reports.customerUsageReports.get",
1644	//   "parameterOrder": [
1645	//     "date"
1646	//   ],
1647	//   "parameters": {
1648	//     "customerId": {
1649	//       "description": "Represents the customer for which the data is to be fetched.",
1650	//       "location": "query",
1651	//       "pattern": "C.+",
1652	//       "type": "string"
1653	//     },
1654	//     "date": {
1655	//       "description": "Represents the date in yyyy-mm-dd format for which the data is to be fetched.",
1656	//       "location": "path",
1657	//       "pattern": "(\\d){4}-(\\d){2}-(\\d){2}",
1658	//       "required": true,
1659	//       "type": "string"
1660	//     },
1661	//     "pageToken": {
1662	//       "description": "Token to specify next page.",
1663	//       "location": "query",
1664	//       "type": "string"
1665	//     },
1666	//     "parameters": {
1667	//       "description": "Represents the application name, parameter name pairs to fetch in csv as app_name1:param_name1, app_name2:param_name2.",
1668	//       "location": "query",
1669	//       "pattern": "(((accounts)|(app_maker)|(apps_scripts)|(classroom)|(cros)|(gmail)|(calendar)|(docs)|(gplus)|(sites)|(device_management)|(drive)|(meet)):[^,]+,)*(((accounts)|(app_maker)|(apps_scripts)|(classroom)|(cros)|(gmail)|(calendar)|(docs)|(gplus)|(sites)|(device_management)|(drive)|(meet)):[^,]+)",
1670	//       "type": "string"
1671	//     }
1672	//   },
1673	//   "path": "usage/dates/{date}",
1674	//   "response": {
1675	//     "$ref": "UsageReports"
1676	//   },
1677	//   "scopes": [
1678	//     "https://www.googleapis.com/auth/admin.reports.usage.readonly"
1679	//   ]
1680	// }
1681
1682}
1683
1684// Pages invokes f for each page of results.
1685// A non-nil error returned from f will halt the iteration.
1686// The provided context supersedes any context provided to the Context method.
1687func (c *CustomerUsageReportsGetCall) Pages(ctx context.Context, f func(*UsageReports) error) error {
1688	c.ctx_ = ctx
1689	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
1690	for {
1691		x, err := c.Do()
1692		if err != nil {
1693			return err
1694		}
1695		if err := f(x); err != nil {
1696			return err
1697		}
1698		if x.NextPageToken == "" {
1699			return nil
1700		}
1701		c.PageToken(x.NextPageToken)
1702	}
1703}
1704
1705// method id "reports.entityUsageReports.get":
1706
1707type EntityUsageReportsGetCall struct {
1708	s            *Service
1709	entityType   string
1710	entityKey    string
1711	date         string
1712	urlParams_   gensupport.URLParams
1713	ifNoneMatch_ string
1714	ctx_         context.Context
1715	header_      http.Header
1716}
1717
1718// Get: Retrieves a report which is a collection of properties /
1719// statistics for a set of objects.
1720func (r *EntityUsageReportsService) Get(entityType string, entityKey string, date string) *EntityUsageReportsGetCall {
1721	c := &EntityUsageReportsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1722	c.entityType = entityType
1723	c.entityKey = entityKey
1724	c.date = date
1725	return c
1726}
1727
1728// CustomerId sets the optional parameter "customerId": Represents the
1729// customer for which the data is to be fetched.
1730func (c *EntityUsageReportsGetCall) CustomerId(customerId string) *EntityUsageReportsGetCall {
1731	c.urlParams_.Set("customerId", customerId)
1732	return c
1733}
1734
1735// Filters sets the optional parameter "filters": Represents the set of
1736// filters including parameter operator value.
1737func (c *EntityUsageReportsGetCall) Filters(filters string) *EntityUsageReportsGetCall {
1738	c.urlParams_.Set("filters", filters)
1739	return c
1740}
1741
1742// MaxResults sets the optional parameter "maxResults": Maximum number
1743// of results to return. Maximum allowed is 1000
1744func (c *EntityUsageReportsGetCall) MaxResults(maxResults int64) *EntityUsageReportsGetCall {
1745	c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
1746	return c
1747}
1748
1749// PageToken sets the optional parameter "pageToken": Token to specify
1750// next page.
1751func (c *EntityUsageReportsGetCall) PageToken(pageToken string) *EntityUsageReportsGetCall {
1752	c.urlParams_.Set("pageToken", pageToken)
1753	return c
1754}
1755
1756// Parameters sets the optional parameter "parameters": Represents the
1757// application name, parameter name pairs to fetch in csv as
1758// app_name1:param_name1, app_name2:param_name2.
1759func (c *EntityUsageReportsGetCall) Parameters(parameters string) *EntityUsageReportsGetCall {
1760	c.urlParams_.Set("parameters", parameters)
1761	return c
1762}
1763
1764// Fields allows partial responses to be retrieved. See
1765// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1766// for more information.
1767func (c *EntityUsageReportsGetCall) Fields(s ...googleapi.Field) *EntityUsageReportsGetCall {
1768	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1769	return c
1770}
1771
1772// IfNoneMatch sets the optional parameter which makes the operation
1773// fail if the object's ETag matches the given value. This is useful for
1774// getting updates only after the object has changed since the last
1775// request. Use googleapi.IsNotModified to check whether the response
1776// error from Do is the result of In-None-Match.
1777func (c *EntityUsageReportsGetCall) IfNoneMatch(entityTag string) *EntityUsageReportsGetCall {
1778	c.ifNoneMatch_ = entityTag
1779	return c
1780}
1781
1782// Context sets the context to be used in this call's Do method. Any
1783// pending HTTP request will be aborted if the provided context is
1784// canceled.
1785func (c *EntityUsageReportsGetCall) Context(ctx context.Context) *EntityUsageReportsGetCall {
1786	c.ctx_ = ctx
1787	return c
1788}
1789
1790// Header returns an http.Header that can be modified by the caller to
1791// add HTTP headers to the request.
1792func (c *EntityUsageReportsGetCall) Header() http.Header {
1793	if c.header_ == nil {
1794		c.header_ = make(http.Header)
1795	}
1796	return c.header_
1797}
1798
1799func (c *EntityUsageReportsGetCall) doRequest(alt string) (*http.Response, error) {
1800	reqHeaders := make(http.Header)
1801	for k, v := range c.header_ {
1802		reqHeaders[k] = v
1803	}
1804	reqHeaders.Set("User-Agent", c.s.userAgent())
1805	if c.ifNoneMatch_ != "" {
1806		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1807	}
1808	var body io.Reader = nil
1809	c.urlParams_.Set("alt", alt)
1810	c.urlParams_.Set("prettyPrint", "false")
1811	urls := googleapi.ResolveRelative(c.s.BasePath, "usage/{entityType}/{entityKey}/dates/{date}")
1812	urls += "?" + c.urlParams_.Encode()
1813	req, err := http.NewRequest("GET", urls, body)
1814	if err != nil {
1815		return nil, err
1816	}
1817	req.Header = reqHeaders
1818	googleapi.Expand(req.URL, map[string]string{
1819		"entityType": c.entityType,
1820		"entityKey":  c.entityKey,
1821		"date":       c.date,
1822	})
1823	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1824}
1825
1826// Do executes the "reports.entityUsageReports.get" call.
1827// Exactly one of *UsageReports or error will be non-nil. Any non-2xx
1828// status code is an error. Response headers are in either
1829// *UsageReports.ServerResponse.Header or (if a response was returned at
1830// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
1831// to check whether the returned error was because
1832// http.StatusNotModified was returned.
1833func (c *EntityUsageReportsGetCall) Do(opts ...googleapi.CallOption) (*UsageReports, error) {
1834	gensupport.SetOptions(c.urlParams_, opts...)
1835	res, err := c.doRequest("json")
1836	if res != nil && res.StatusCode == http.StatusNotModified {
1837		if res.Body != nil {
1838			res.Body.Close()
1839		}
1840		return nil, &googleapi.Error{
1841			Code:   res.StatusCode,
1842			Header: res.Header,
1843		}
1844	}
1845	if err != nil {
1846		return nil, err
1847	}
1848	defer googleapi.CloseBody(res)
1849	if err := googleapi.CheckResponse(res); err != nil {
1850		return nil, err
1851	}
1852	ret := &UsageReports{
1853		ServerResponse: googleapi.ServerResponse{
1854			Header:         res.Header,
1855			HTTPStatusCode: res.StatusCode,
1856		},
1857	}
1858	target := &ret
1859	if err := gensupport.DecodeResponse(target, res); err != nil {
1860		return nil, err
1861	}
1862	return ret, nil
1863	// {
1864	//   "description": "Retrieves a report which is a collection of properties / statistics for a set of objects.",
1865	//   "httpMethod": "GET",
1866	//   "id": "reports.entityUsageReports.get",
1867	//   "parameterOrder": [
1868	//     "entityType",
1869	//     "entityKey",
1870	//     "date"
1871	//   ],
1872	//   "parameters": {
1873	//     "customerId": {
1874	//       "description": "Represents the customer for which the data is to be fetched.",
1875	//       "location": "query",
1876	//       "pattern": "C.+",
1877	//       "type": "string"
1878	//     },
1879	//     "date": {
1880	//       "description": "Represents the date in yyyy-mm-dd format for which the data is to be fetched.",
1881	//       "location": "path",
1882	//       "pattern": "(\\d){4}-(\\d){2}-(\\d){2}",
1883	//       "required": true,
1884	//       "type": "string"
1885	//     },
1886	//     "entityKey": {
1887	//       "description": "Represents the key of object for which the data should be filtered.",
1888	//       "location": "path",
1889	//       "required": true,
1890	//       "type": "string"
1891	//     },
1892	//     "entityType": {
1893	//       "description": "Type of object. Should be one of - gplus_communities.",
1894	//       "location": "path",
1895	//       "pattern": "(gplus_communities)",
1896	//       "required": true,
1897	//       "type": "string"
1898	//     },
1899	//     "filters": {
1900	//       "description": "Represents the set of filters including parameter operator value.",
1901	//       "location": "query",
1902	//       "pattern": "(((gplus)):[a-z0-9_]+[\u003c,\u003c=,==,\u003e=,\u003e,!=][^,]+,)*(((gplus)):[a-z0-9_]+[\u003c,\u003c=,==,\u003e=,\u003e,!=][^,]+)",
1903	//       "type": "string"
1904	//     },
1905	//     "maxResults": {
1906	//       "description": "Maximum number of results to return. Maximum allowed is 1000",
1907	//       "format": "uint32",
1908	//       "location": "query",
1909	//       "maximum": "1000",
1910	//       "type": "integer"
1911	//     },
1912	//     "pageToken": {
1913	//       "description": "Token to specify next page.",
1914	//       "location": "query",
1915	//       "type": "string"
1916	//     },
1917	//     "parameters": {
1918	//       "description": "Represents the application name, parameter name pairs to fetch in csv as app_name1:param_name1, app_name2:param_name2.",
1919	//       "location": "query",
1920	//       "pattern": "(((gplus)):[^,]+,)*(((gplus)):[^,]+)",
1921	//       "type": "string"
1922	//     }
1923	//   },
1924	//   "path": "usage/{entityType}/{entityKey}/dates/{date}",
1925	//   "response": {
1926	//     "$ref": "UsageReports"
1927	//   },
1928	//   "scopes": [
1929	//     "https://www.googleapis.com/auth/admin.reports.usage.readonly"
1930	//   ]
1931	// }
1932
1933}
1934
1935// Pages invokes f for each page of results.
1936// A non-nil error returned from f will halt the iteration.
1937// The provided context supersedes any context provided to the Context method.
1938func (c *EntityUsageReportsGetCall) Pages(ctx context.Context, f func(*UsageReports) error) error {
1939	c.ctx_ = ctx
1940	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
1941	for {
1942		x, err := c.Do()
1943		if err != nil {
1944			return err
1945		}
1946		if err := f(x); err != nil {
1947			return err
1948		}
1949		if x.NextPageToken == "" {
1950			return nil
1951		}
1952		c.PageToken(x.NextPageToken)
1953	}
1954}
1955
1956// method id "reports.userUsageReport.get":
1957
1958type UserUsageReportGetCall struct {
1959	s            *Service
1960	userKey      string
1961	date         string
1962	urlParams_   gensupport.URLParams
1963	ifNoneMatch_ string
1964	ctx_         context.Context
1965	header_      http.Header
1966}
1967
1968// Get: Retrieves a report which is a collection of properties /
1969// statistics for a set of users.
1970func (r *UserUsageReportService) Get(userKey string, date string) *UserUsageReportGetCall {
1971	c := &UserUsageReportGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1972	c.userKey = userKey
1973	c.date = date
1974	return c
1975}
1976
1977// CustomerId sets the optional parameter "customerId": Represents the
1978// customer for which the data is to be fetched.
1979func (c *UserUsageReportGetCall) CustomerId(customerId string) *UserUsageReportGetCall {
1980	c.urlParams_.Set("customerId", customerId)
1981	return c
1982}
1983
1984// Filters sets the optional parameter "filters": Represents the set of
1985// filters including parameter operator value.
1986func (c *UserUsageReportGetCall) Filters(filters string) *UserUsageReportGetCall {
1987	c.urlParams_.Set("filters", filters)
1988	return c
1989}
1990
1991// MaxResults sets the optional parameter "maxResults": Maximum number
1992// of results to return. Maximum allowed is 1000
1993func (c *UserUsageReportGetCall) MaxResults(maxResults int64) *UserUsageReportGetCall {
1994	c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
1995	return c
1996}
1997
1998// OrgUnitID sets the optional parameter "orgUnitID": the organizational
1999// unit's ID to filter usage parameters from users belonging to a
2000// specific OU or one of its sub-OU(s).
2001func (c *UserUsageReportGetCall) OrgUnitID(orgUnitID string) *UserUsageReportGetCall {
2002	c.urlParams_.Set("orgUnitID", orgUnitID)
2003	return c
2004}
2005
2006// PageToken sets the optional parameter "pageToken": Token to specify
2007// next page.
2008func (c *UserUsageReportGetCall) PageToken(pageToken string) *UserUsageReportGetCall {
2009	c.urlParams_.Set("pageToken", pageToken)
2010	return c
2011}
2012
2013// Parameters sets the optional parameter "parameters": Represents the
2014// application name, parameter name pairs to fetch in csv as
2015// app_name1:param_name1, app_name2:param_name2.
2016func (c *UserUsageReportGetCall) Parameters(parameters string) *UserUsageReportGetCall {
2017	c.urlParams_.Set("parameters", parameters)
2018	return c
2019}
2020
2021// Fields allows partial responses to be retrieved. See
2022// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2023// for more information.
2024func (c *UserUsageReportGetCall) Fields(s ...googleapi.Field) *UserUsageReportGetCall {
2025	c.urlParams_.Set("fields", googleapi.CombineFields(s))
2026	return c
2027}
2028
2029// IfNoneMatch sets the optional parameter which makes the operation
2030// fail if the object's ETag matches the given value. This is useful for
2031// getting updates only after the object has changed since the last
2032// request. Use googleapi.IsNotModified to check whether the response
2033// error from Do is the result of In-None-Match.
2034func (c *UserUsageReportGetCall) IfNoneMatch(entityTag string) *UserUsageReportGetCall {
2035	c.ifNoneMatch_ = entityTag
2036	return c
2037}
2038
2039// Context sets the context to be used in this call's Do method. Any
2040// pending HTTP request will be aborted if the provided context is
2041// canceled.
2042func (c *UserUsageReportGetCall) Context(ctx context.Context) *UserUsageReportGetCall {
2043	c.ctx_ = ctx
2044	return c
2045}
2046
2047// Header returns an http.Header that can be modified by the caller to
2048// add HTTP headers to the request.
2049func (c *UserUsageReportGetCall) Header() http.Header {
2050	if c.header_ == nil {
2051		c.header_ = make(http.Header)
2052	}
2053	return c.header_
2054}
2055
2056func (c *UserUsageReportGetCall) doRequest(alt string) (*http.Response, error) {
2057	reqHeaders := make(http.Header)
2058	for k, v := range c.header_ {
2059		reqHeaders[k] = v
2060	}
2061	reqHeaders.Set("User-Agent", c.s.userAgent())
2062	if c.ifNoneMatch_ != "" {
2063		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2064	}
2065	var body io.Reader = nil
2066	c.urlParams_.Set("alt", alt)
2067	c.urlParams_.Set("prettyPrint", "false")
2068	urls := googleapi.ResolveRelative(c.s.BasePath, "usage/users/{userKey}/dates/{date}")
2069	urls += "?" + c.urlParams_.Encode()
2070	req, err := http.NewRequest("GET", urls, body)
2071	if err != nil {
2072		return nil, err
2073	}
2074	req.Header = reqHeaders
2075	googleapi.Expand(req.URL, map[string]string{
2076		"userKey": c.userKey,
2077		"date":    c.date,
2078	})
2079	return gensupport.SendRequest(c.ctx_, c.s.client, req)
2080}
2081
2082// Do executes the "reports.userUsageReport.get" call.
2083// Exactly one of *UsageReports or error will be non-nil. Any non-2xx
2084// status code is an error. Response headers are in either
2085// *UsageReports.ServerResponse.Header or (if a response was returned at
2086// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
2087// to check whether the returned error was because
2088// http.StatusNotModified was returned.
2089func (c *UserUsageReportGetCall) Do(opts ...googleapi.CallOption) (*UsageReports, error) {
2090	gensupport.SetOptions(c.urlParams_, opts...)
2091	res, err := c.doRequest("json")
2092	if res != nil && res.StatusCode == http.StatusNotModified {
2093		if res.Body != nil {
2094			res.Body.Close()
2095		}
2096		return nil, &googleapi.Error{
2097			Code:   res.StatusCode,
2098			Header: res.Header,
2099		}
2100	}
2101	if err != nil {
2102		return nil, err
2103	}
2104	defer googleapi.CloseBody(res)
2105	if err := googleapi.CheckResponse(res); err != nil {
2106		return nil, err
2107	}
2108	ret := &UsageReports{
2109		ServerResponse: googleapi.ServerResponse{
2110			Header:         res.Header,
2111			HTTPStatusCode: res.StatusCode,
2112		},
2113	}
2114	target := &ret
2115	if err := gensupport.DecodeResponse(target, res); err != nil {
2116		return nil, err
2117	}
2118	return ret, nil
2119	// {
2120	//   "description": "Retrieves a report which is a collection of properties / statistics for a set of users.",
2121	//   "httpMethod": "GET",
2122	//   "id": "reports.userUsageReport.get",
2123	//   "parameterOrder": [
2124	//     "userKey",
2125	//     "date"
2126	//   ],
2127	//   "parameters": {
2128	//     "customerId": {
2129	//       "description": "Represents the customer for which the data is to be fetched.",
2130	//       "location": "query",
2131	//       "pattern": "C.+",
2132	//       "type": "string"
2133	//     },
2134	//     "date": {
2135	//       "description": "Represents the date in yyyy-mm-dd format for which the data is to be fetched.",
2136	//       "location": "path",
2137	//       "pattern": "(\\d){4}-(\\d){2}-(\\d){2}",
2138	//       "required": true,
2139	//       "type": "string"
2140	//     },
2141	//     "filters": {
2142	//       "description": "Represents the set of filters including parameter operator value.",
2143	//       "location": "query",
2144	//       "pattern": "(((accounts)|(classroom)|(cros)|(gmail)|(calendar)|(docs)|(gplus)|(sites)|(device_management)|(drive)):[a-z0-9_]+[\u003c,\u003c=,==,\u003e=,\u003e,!=][^,]+,)*(((accounts)|(classroom)|(cros)|(gmail)|(calendar)|(docs)|(gplus)|(sites)|(device_management)|(drive)):[a-z0-9_]+[\u003c,\u003c=,==,\u003e=,\u003e,!=][^,]+)",
2145	//       "type": "string"
2146	//     },
2147	//     "maxResults": {
2148	//       "description": "Maximum number of results to return. Maximum allowed is 1000",
2149	//       "format": "uint32",
2150	//       "location": "query",
2151	//       "maximum": "1000",
2152	//       "type": "integer"
2153	//     },
2154	//     "orgUnitID": {
2155	//       "default": "",
2156	//       "description": "the organizational unit's ID to filter usage parameters from users belonging to a specific OU or one of its sub-OU(s).",
2157	//       "location": "query",
2158	//       "pattern": "(id:[a-z0-9]+)",
2159	//       "type": "string"
2160	//     },
2161	//     "pageToken": {
2162	//       "description": "Token to specify next page.",
2163	//       "location": "query",
2164	//       "type": "string"
2165	//     },
2166	//     "parameters": {
2167	//       "description": "Represents the application name, parameter name pairs to fetch in csv as app_name1:param_name1, app_name2:param_name2.",
2168	//       "location": "query",
2169	//       "pattern": "(((accounts)|(classroom)|(cros)|(gmail)|(calendar)|(docs)|(gplus)|(sites)|(device_management)|(drive)):[^,]+,)*(((accounts)|(classroom)|(cros)|(gmail)|(calendar)|(docs)|(gplus)|(sites)|(device_management)|(drive)):[^,]+)",
2170	//       "type": "string"
2171	//     },
2172	//     "userKey": {
2173	//       "description": "Represents the profile id or the user email for which the data should be filtered.",
2174	//       "location": "path",
2175	//       "required": true,
2176	//       "type": "string"
2177	//     }
2178	//   },
2179	//   "path": "usage/users/{userKey}/dates/{date}",
2180	//   "response": {
2181	//     "$ref": "UsageReports"
2182	//   },
2183	//   "scopes": [
2184	//     "https://www.googleapis.com/auth/admin.reports.usage.readonly"
2185	//   ]
2186	// }
2187
2188}
2189
2190// Pages invokes f for each page of results.
2191// A non-nil error returned from f will halt the iteration.
2192// The provided context supersedes any context provided to the Context method.
2193func (c *UserUsageReportGetCall) Pages(ctx context.Context, f func(*UsageReports) error) error {
2194	c.ctx_ = ctx
2195	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
2196	for {
2197		x, err := c.Do()
2198		if err != nil {
2199			return err
2200		}
2201		if err := f(x); err != nil {
2202			return err
2203		}
2204		if x.NextPageToken == "" {
2205			return nil
2206		}
2207		c.PageToken(x.NextPageToken)
2208	}
2209}
2210