1// Copyright 2021 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 SDK API. 8// 9// For product documentation, see: http://developers.google.com/admin-sdk/ 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 googleapi "google.golang.org/api/googleapi" 57 gensupport "google.golang.org/api/internal/gensupport" 58 option "google.golang.org/api/option" 59 internaloption "google.golang.org/api/option/internaloption" 60 htransport "google.golang.org/api/transport/http" 61) 62 63// Always reference these packages, just in case the auto-generated code 64// below doesn't. 65var _ = bytes.NewBuffer 66var _ = strconv.Itoa 67var _ = fmt.Sprintf 68var _ = json.NewDecoder 69var _ = io.Copy 70var _ = url.Parse 71var _ = gensupport.MarshalJSON 72var _ = googleapi.Version 73var _ = errors.New 74var _ = strings.Replace 75var _ = context.Canceled 76var _ = internaloption.WithDefaultEndpoint 77 78const apiId = "admin:reports_v1" 79const apiName = "admin" 80const apiVersion = "reports_v1" 81const basePath = "https://admin.googleapis.com/" 82const mtlsBasePath = "https://admin.mtls.googleapis.com/" 83 84// OAuth2 scopes used by this API. 85const ( 86 // View audit reports for your G Suite domain 87 AdminReportsAuditReadonlyScope = "https://www.googleapis.com/auth/admin.reports.audit.readonly" 88 89 // View usage reports for your G Suite domain 90 AdminReportsUsageReadonlyScope = "https://www.googleapis.com/auth/admin.reports.usage.readonly" 91) 92 93// NewService creates a new Service. 94func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 95 scopesOption := option.WithScopes( 96 "https://www.googleapis.com/auth/admin.reports.audit.readonly", 97 "https://www.googleapis.com/auth/admin.reports.usage.readonly", 98 ) 99 // NOTE: prepend, so we don't override user-specified scopes. 100 opts = append([]option.ClientOption{scopesOption}, opts...) 101 opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) 102 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath)) 103 client, endpoint, err := htransport.NewClient(ctx, opts...) 104 if err != nil { 105 return nil, err 106 } 107 s, err := New(client) 108 if err != nil { 109 return nil, err 110 } 111 if endpoint != "" { 112 s.BasePath = endpoint 113 } 114 return s, nil 115} 116 117// New creates a new Service. It uses the provided http.Client for requests. 118// 119// Deprecated: please use NewService instead. 120// To provide a custom HTTP client, use option.WithHTTPClient. 121// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 122func New(client *http.Client) (*Service, error) { 123 if client == nil { 124 return nil, errors.New("client is nil") 125 } 126 s := &Service{client: client, BasePath: basePath} 127 s.Activities = NewActivitiesService(s) 128 s.Channels = NewChannelsService(s) 129 s.CustomerUsageReports = NewCustomerUsageReportsService(s) 130 s.EntityUsageReports = NewEntityUsageReportsService(s) 131 s.UserUsageReport = NewUserUsageReportService(s) 132 return s, nil 133} 134 135type Service struct { 136 client *http.Client 137 BasePath string // API endpoint base URL 138 UserAgent string // optional additional User-Agent fragment 139 140 Activities *ActivitiesService 141 142 Channels *ChannelsService 143 144 CustomerUsageReports *CustomerUsageReportsService 145 146 EntityUsageReports *EntityUsageReportsService 147 148 UserUsageReport *UserUsageReportService 149} 150 151func (s *Service) userAgent() string { 152 if s.UserAgent == "" { 153 return googleapi.UserAgent 154 } 155 return googleapi.UserAgent + " " + s.UserAgent 156} 157 158func NewActivitiesService(s *Service) *ActivitiesService { 159 rs := &ActivitiesService{s: s} 160 return rs 161} 162 163type ActivitiesService struct { 164 s *Service 165} 166 167func NewChannelsService(s *Service) *ChannelsService { 168 rs := &ChannelsService{s: s} 169 return rs 170} 171 172type ChannelsService struct { 173 s *Service 174} 175 176func NewCustomerUsageReportsService(s *Service) *CustomerUsageReportsService { 177 rs := &CustomerUsageReportsService{s: s} 178 return rs 179} 180 181type CustomerUsageReportsService struct { 182 s *Service 183} 184 185func NewEntityUsageReportsService(s *Service) *EntityUsageReportsService { 186 rs := &EntityUsageReportsService{s: s} 187 return rs 188} 189 190type EntityUsageReportsService struct { 191 s *Service 192} 193 194func NewUserUsageReportService(s *Service) *UserUsageReportService { 195 rs := &UserUsageReportService{s: s} 196 return rs 197} 198 199type UserUsageReportService struct { 200 s *Service 201} 202 203// Activities: JSON template for a collection of activities. 204type Activities struct { 205 // Etag: ETag of the resource. 206 Etag string `json:"etag,omitempty"` 207 208 // Items: Each activity record in the response. 209 Items []*Activity `json:"items,omitempty"` 210 211 // Kind: The type of API resource. For an activity report, the value is 212 // `reports#activities`. 213 Kind string `json:"kind,omitempty"` 214 215 // NextPageToken: Token for retrieving the follow-on next page of the 216 // report. The `nextPageToken` value is used in the request's 217 // `pageToken` query string. 218 NextPageToken string `json:"nextPageToken,omitempty"` 219 220 // ServerResponse contains the HTTP response code and headers from the 221 // server. 222 googleapi.ServerResponse `json:"-"` 223 224 // ForceSendFields is a list of field names (e.g. "Etag") to 225 // unconditionally include in API requests. By default, fields with 226 // empty values are omitted from API requests. However, any non-pointer, 227 // non-interface field appearing in ForceSendFields will be sent to the 228 // server regardless of whether the field is empty or not. This may be 229 // used to include empty fields in Patch requests. 230 ForceSendFields []string `json:"-"` 231 232 // NullFields is a list of field names (e.g. "Etag") to include in API 233 // requests with the JSON null value. By default, fields with empty 234 // values are omitted from API requests. However, any field with an 235 // empty value appearing in NullFields will be sent to the server as 236 // null. It is an error if a field in this list has a non-empty value. 237 // This may be used to include null fields in Patch requests. 238 NullFields []string `json:"-"` 239} 240 241func (s *Activities) MarshalJSON() ([]byte, error) { 242 type NoMethod Activities 243 raw := NoMethod(*s) 244 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 245} 246 247// Activity: JSON template for the activity resource. 248type Activity struct { 249 // Actor: User doing the action. 250 Actor *ActivityActor `json:"actor,omitempty"` 251 252 // Etag: ETag of the entry. 253 Etag string `json:"etag,omitempty"` 254 255 // Events: Activity events in the report. 256 Events []*ActivityEvents `json:"events,omitempty"` 257 258 // Id: Unique identifier for each activity record. 259 Id *ActivityId `json:"id,omitempty"` 260 261 // IpAddress: IP address of the user doing the action. This is the 262 // Internet Protocol (IP) address of the user when logging into Google 263 // Workspace, which may or may not reflect the user's physical location. 264 // For example, the IP address can be the user's proxy server's address 265 // or a virtual private network (VPN) address. The API supports IPv4 and 266 // IPv6. 267 IpAddress string `json:"ipAddress,omitempty"` 268 269 // Kind: The type of API resource. For an activity report, the value is 270 // `audit#activity`. 271 Kind string `json:"kind,omitempty"` 272 273 // OwnerDomain: This is the domain that is affected by the report's 274 // event. For example domain of Admin console or the Drive application's 275 // document owner. 276 OwnerDomain string `json:"ownerDomain,omitempty"` 277 278 // ForceSendFields is a list of field names (e.g. "Actor") to 279 // unconditionally include in API requests. By default, fields with 280 // empty values are omitted from API requests. However, any non-pointer, 281 // non-interface field appearing in ForceSendFields will be sent to the 282 // server regardless of whether the field is empty or not. This may be 283 // used to include empty fields in Patch requests. 284 ForceSendFields []string `json:"-"` 285 286 // NullFields is a list of field names (e.g. "Actor") to include in API 287 // requests with the JSON null value. By default, fields with empty 288 // values are omitted from API requests. However, any field with an 289 // empty value appearing in NullFields will be sent to the server as 290 // null. It is an error if a field in this list has a non-empty value. 291 // This may be used to include null fields in Patch requests. 292 NullFields []string `json:"-"` 293} 294 295func (s *Activity) MarshalJSON() ([]byte, error) { 296 type NoMethod Activity 297 raw := NoMethod(*s) 298 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 299} 300 301// ActivityActor: User doing the action. 302type ActivityActor struct { 303 // CallerType: The type of actor. 304 CallerType string `json:"callerType,omitempty"` 305 306 // Email: The primary email address of the actor. May be absent if there 307 // is no email address associated with the actor. 308 Email string `json:"email,omitempty"` 309 310 // Key: Only present when `callerType` is `KEY`. Can be the 311 // `consumer_key` of the requestor for OAuth 2LO API requests or an 312 // identifier for robot accounts. 313 Key string `json:"key,omitempty"` 314 315 // ProfileId: The unique Google Workspace profile ID of the actor. May 316 // be absent if the actor is not a Google Workspace user. 317 ProfileId string `json:"profileId,omitempty"` 318 319 // ForceSendFields is a list of field names (e.g. "CallerType") to 320 // unconditionally include in API requests. By default, fields with 321 // empty values are omitted from API requests. However, any non-pointer, 322 // non-interface field appearing in ForceSendFields will be sent to the 323 // server regardless of whether the field is empty or not. This may be 324 // used to include empty fields in Patch requests. 325 ForceSendFields []string `json:"-"` 326 327 // NullFields is a list of field names (e.g. "CallerType") to include in 328 // API requests with the JSON null value. By default, fields with empty 329 // values are omitted from API requests. However, any field with an 330 // empty value appearing in NullFields will be sent to the server as 331 // null. It is an error if a field in this list has a non-empty value. 332 // This may be used to include null fields in Patch requests. 333 NullFields []string `json:"-"` 334} 335 336func (s *ActivityActor) MarshalJSON() ([]byte, error) { 337 type NoMethod ActivityActor 338 raw := NoMethod(*s) 339 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 340} 341 342type ActivityEvents struct { 343 // Name: Name of the event. This is the specific name of the activity 344 // reported by the API. And each `eventName` is related to a specific 345 // Google Workspace service or feature which the API organizes into 346 // types of events. For `eventName` request parameters in general: - If 347 // no `eventName` is given, the report returns all possible instances of 348 // an `eventName`. - When you request an `eventName`, the API's response 349 // returns all activities which contain that `eventName`. It is possible 350 // that the returned activities will have other `eventName` properties 351 // in addition to the one requested. For more information about 352 // `eventName` properties, see the list of event names for various 353 // applications above in `applicationName`. 354 Name string `json:"name,omitempty"` 355 356 // Parameters: Parameter value pairs for various applications. For more 357 // information about `eventName` parameters, see the list of event names 358 // for various applications above in `applicationName`. 359 Parameters []*ActivityEventsParameters `json:"parameters,omitempty"` 360 361 // Type: Type of event. The Google Workspace service or feature that an 362 // administrator changes is identified in the `type` property which 363 // identifies an event using the `eventName` property. For a full list 364 // of the API's `type` categories, see the list of event names for 365 // various applications above in `applicationName`. 366 Type string `json:"type,omitempty"` 367 368 // ForceSendFields is a list of field names (e.g. "Name") to 369 // unconditionally include in API requests. By default, fields with 370 // empty values are omitted from API requests. However, any non-pointer, 371 // non-interface field appearing in ForceSendFields will be sent to the 372 // server regardless of whether the field is empty or not. This may be 373 // used to include empty fields in Patch requests. 374 ForceSendFields []string `json:"-"` 375 376 // NullFields is a list of field names (e.g. "Name") to include in API 377 // requests with the JSON null value. By default, fields with empty 378 // values are omitted from API requests. However, any field with an 379 // empty value appearing in NullFields will be sent to the server as 380 // null. It is an error if a field in this list has a non-empty value. 381 // This may be used to include null fields in Patch requests. 382 NullFields []string `json:"-"` 383} 384 385func (s *ActivityEvents) MarshalJSON() ([]byte, error) { 386 type NoMethod ActivityEvents 387 raw := NoMethod(*s) 388 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 389} 390 391type ActivityEventsParameters struct { 392 // BoolValue: Boolean value of the parameter. 393 BoolValue bool `json:"boolValue,omitempty"` 394 395 // IntValue: Integer value of the parameter. 396 IntValue int64 `json:"intValue,omitempty,string"` 397 398 // MessageValue: Nested parameter value pairs associated with this 399 // parameter. Complex value type for a parameter are returned as a list 400 // of parameter values. For example, the address parameter may have a 401 // value as `[{parameter: [{name: city, value: abc}]}]` 402 MessageValue *ActivityEventsParametersMessageValue `json:"messageValue,omitempty"` 403 404 // MultiIntValue: Integer values of the parameter. 405 MultiIntValue googleapi.Int64s `json:"multiIntValue,omitempty"` 406 407 // MultiMessageValue: List of `messageValue` objects. 408 MultiMessageValue []*ActivityEventsParametersMultiMessageValue `json:"multiMessageValue,omitempty"` 409 410 // MultiValue: String values of the parameter. 411 MultiValue []string `json:"multiValue,omitempty"` 412 413 // Name: The name of the parameter. 414 Name string `json:"name,omitempty"` 415 416 // Value: String value of the parameter. 417 Value string `json:"value,omitempty"` 418 419 // ForceSendFields is a list of field names (e.g. "BoolValue") to 420 // unconditionally include in API requests. By default, fields with 421 // empty values are omitted from API requests. However, any non-pointer, 422 // non-interface field appearing in ForceSendFields will be sent to the 423 // server regardless of whether the field is empty or not. This may be 424 // used to include empty fields in Patch requests. 425 ForceSendFields []string `json:"-"` 426 427 // NullFields is a list of field names (e.g. "BoolValue") to include in 428 // API requests with the JSON null value. By default, fields with empty 429 // values are omitted from API requests. However, any field with an 430 // empty value appearing in NullFields will be sent to the server as 431 // null. It is an error if a field in this list has a non-empty value. 432 // This may be used to include null fields in Patch requests. 433 NullFields []string `json:"-"` 434} 435 436func (s *ActivityEventsParameters) MarshalJSON() ([]byte, error) { 437 type NoMethod ActivityEventsParameters 438 raw := NoMethod(*s) 439 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 440} 441 442// ActivityEventsParametersMessageValue: Nested parameter value pairs 443// associated with this parameter. Complex value type for a parameter 444// are returned as a list of parameter values. For example, the address 445// parameter may have a value as `[{parameter: [{name: city, value: 446// abc}]}]` 447type ActivityEventsParametersMessageValue struct { 448 // Parameter: Parameter values 449 Parameter []*NestedParameter `json:"parameter,omitempty"` 450 451 // ForceSendFields is a list of field names (e.g. "Parameter") to 452 // unconditionally include in API requests. By default, fields with 453 // empty values are omitted from API requests. However, any non-pointer, 454 // non-interface field appearing in ForceSendFields will be sent to the 455 // server regardless of whether the field is empty or not. This may be 456 // used to include empty fields in Patch requests. 457 ForceSendFields []string `json:"-"` 458 459 // NullFields is a list of field names (e.g. "Parameter") to include in 460 // API requests with the JSON null value. By default, fields with empty 461 // values are omitted from API requests. However, any field with an 462 // empty value appearing in NullFields will be sent to the server as 463 // null. It is an error if a field in this list has a non-empty value. 464 // This may be used to include null fields in Patch requests. 465 NullFields []string `json:"-"` 466} 467 468func (s *ActivityEventsParametersMessageValue) MarshalJSON() ([]byte, error) { 469 type NoMethod ActivityEventsParametersMessageValue 470 raw := NoMethod(*s) 471 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 472} 473 474type ActivityEventsParametersMultiMessageValue struct { 475 // Parameter: Parameter values 476 Parameter []*NestedParameter `json:"parameter,omitempty"` 477 478 // ForceSendFields is a list of field names (e.g. "Parameter") to 479 // unconditionally include in API requests. By default, fields with 480 // empty values are omitted from API requests. However, any non-pointer, 481 // non-interface field appearing in ForceSendFields will be sent to the 482 // server regardless of whether the field is empty or not. This may be 483 // used to include empty fields in Patch requests. 484 ForceSendFields []string `json:"-"` 485 486 // NullFields is a list of field names (e.g. "Parameter") to include in 487 // API requests with the JSON null value. By default, fields with empty 488 // values are omitted from API requests. However, any field with an 489 // empty value appearing in NullFields will be sent to the server as 490 // null. It is an error if a field in this list has a non-empty value. 491 // This may be used to include null fields in Patch requests. 492 NullFields []string `json:"-"` 493} 494 495func (s *ActivityEventsParametersMultiMessageValue) MarshalJSON() ([]byte, error) { 496 type NoMethod ActivityEventsParametersMultiMessageValue 497 raw := NoMethod(*s) 498 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 499} 500 501// ActivityId: Unique identifier for each activity record. 502type ActivityId struct { 503 // ApplicationName: Application name to which the event belongs. For 504 // possible values see the list of applications above in 505 // `applicationName`. 506 ApplicationName string `json:"applicationName,omitempty"` 507 508 // CustomerId: The unique identifier for a Google Workspace account. 509 CustomerId string `json:"customerId,omitempty"` 510 511 // Time: Time of occurrence of the activity. This is in UNIX epoch time 512 // in seconds. 513 Time string `json:"time,omitempty"` 514 515 // UniqueQualifier: Unique qualifier if multiple events have the same 516 // time. 517 UniqueQualifier int64 `json:"uniqueQualifier,omitempty,string"` 518 519 // ForceSendFields is a list of field names (e.g. "ApplicationName") to 520 // unconditionally include in API requests. By default, fields with 521 // empty values are omitted from API requests. However, any non-pointer, 522 // non-interface field appearing in ForceSendFields will be sent to the 523 // server regardless of whether the field is empty or not. This may be 524 // used to include empty fields in Patch requests. 525 ForceSendFields []string `json:"-"` 526 527 // NullFields is a list of field names (e.g. "ApplicationName") to 528 // include in API requests with the JSON null value. By default, fields 529 // with empty values are omitted from API requests. However, any field 530 // with an empty value appearing in NullFields will be sent to the 531 // server as null. It is an error if a field in this list has a 532 // non-empty value. This may be used to include null fields in Patch 533 // requests. 534 NullFields []string `json:"-"` 535} 536 537func (s *ActivityId) MarshalJSON() ([]byte, error) { 538 type NoMethod ActivityId 539 raw := NoMethod(*s) 540 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 541} 542 543// Channel: A notification channel used to watch for resource changes. 544type Channel struct { 545 // Address: The address where notifications are delivered for this 546 // channel. 547 Address string `json:"address,omitempty"` 548 549 // Expiration: Date and time of notification channel expiration, 550 // expressed as a Unix timestamp, in milliseconds. Optional. 551 Expiration int64 `json:"expiration,omitempty,string"` 552 553 // Id: A UUID or similar unique string that identifies this channel. 554 Id string `json:"id,omitempty"` 555 556 // Kind: Identifies this as a notification channel used to watch for 557 // changes to a resource, which is "api#channel". 558 Kind string `json:"kind,omitempty"` 559 560 // Params: Additional parameters controlling delivery channel behavior. 561 // Optional. 562 Params map[string]string `json:"params,omitempty"` 563 564 // Payload: A Boolean value to indicate whether payload is wanted. 565 // Optional. 566 Payload bool `json:"payload,omitempty"` 567 568 // ResourceId: An opaque ID that identifies the resource being watched 569 // on this channel. Stable across different API versions. 570 ResourceId string `json:"resourceId,omitempty"` 571 572 // ResourceUri: A version-specific identifier for the watched resource. 573 ResourceUri string `json:"resourceUri,omitempty"` 574 575 // Token: An arbitrary string delivered to the target address with each 576 // notification delivered over this channel. Optional. 577 Token string `json:"token,omitempty"` 578 579 // Type: The type of delivery mechanism used for this channel. The value 580 // should be set to "web_hook". 581 Type string `json:"type,omitempty"` 582 583 // ServerResponse contains the HTTP response code and headers from the 584 // server. 585 googleapi.ServerResponse `json:"-"` 586 587 // ForceSendFields is a list of field names (e.g. "Address") 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. "Address") 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 *Channel) MarshalJSON() ([]byte, error) { 605 type NoMethod Channel 606 raw := NoMethod(*s) 607 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 608} 609 610// NestedParameter: JSON template for a parameter used in various 611// reports. 612type NestedParameter struct { 613 // BoolValue: Boolean value of the parameter. 614 BoolValue bool `json:"boolValue,omitempty"` 615 616 // IntValue: Integer value of the parameter. 617 IntValue int64 `json:"intValue,omitempty,string"` 618 619 // MultiBoolValue: Multiple boolean values of the parameter. 620 MultiBoolValue []bool `json:"multiBoolValue,omitempty"` 621 622 // MultiIntValue: Multiple integer values of the parameter. 623 MultiIntValue googleapi.Int64s `json:"multiIntValue,omitempty"` 624 625 // MultiValue: Multiple string values of the parameter. 626 MultiValue []string `json:"multiValue,omitempty"` 627 628 // Name: The name of the parameter. 629 Name string `json:"name,omitempty"` 630 631 // Value: String value of the parameter. 632 Value string `json:"value,omitempty"` 633 634 // ForceSendFields is a list of field names (e.g. "BoolValue") to 635 // unconditionally include in API requests. By default, fields with 636 // empty values are omitted from API requests. However, any non-pointer, 637 // non-interface field appearing in ForceSendFields will be sent to the 638 // server regardless of whether the field is empty or not. This may be 639 // used to include empty fields in Patch requests. 640 ForceSendFields []string `json:"-"` 641 642 // NullFields is a list of field names (e.g. "BoolValue") to include in 643 // API requests with the JSON null value. By default, fields with empty 644 // values are omitted from API requests. However, any field with an 645 // empty value appearing in NullFields will be sent to the server as 646 // null. It is an error if a field in this list has a non-empty value. 647 // This may be used to include null fields in Patch requests. 648 NullFields []string `json:"-"` 649} 650 651func (s *NestedParameter) MarshalJSON() ([]byte, error) { 652 type NoMethod NestedParameter 653 raw := NoMethod(*s) 654 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 655} 656 657// UsageReport: JSON template for a usage report. 658type UsageReport struct { 659 // Date: Output only. The date of the report request. 660 Date string `json:"date,omitempty"` 661 662 // Entity: Output only. Information about the type of the item. 663 Entity *UsageReportEntity `json:"entity,omitempty"` 664 665 // Etag: ETag of the resource. 666 Etag string `json:"etag,omitempty"` 667 668 // Kind: The type of API resource. For a usage report, the value is 669 // `admin#reports#usageReport`. 670 Kind string `json:"kind,omitempty"` 671 672 // Parameters: Output only. Parameter value pairs for various 673 // applications. For the Entity Usage Report parameters and values, see 674 // the Entity Usage parameters reference 675 // (/admin-sdk/reports/v1/reference/usage-ref-appendix-a/entities). 676 Parameters []*UsageReportParameters `json:"parameters,omitempty"` 677 678 // ForceSendFields is a list of field names (e.g. "Date") to 679 // unconditionally include in API requests. By default, fields with 680 // empty values are omitted from API requests. However, any non-pointer, 681 // non-interface field appearing in ForceSendFields will be sent to the 682 // server regardless of whether the field is empty or not. This may be 683 // used to include empty fields in Patch requests. 684 ForceSendFields []string `json:"-"` 685 686 // NullFields is a list of field names (e.g. "Date") to include in API 687 // requests with the JSON null value. By default, fields with empty 688 // values are omitted from API requests. However, any field with an 689 // empty value appearing in NullFields will be sent to the server as 690 // null. It is an error if a field in this list has a non-empty value. 691 // This may be used to include null fields in Patch requests. 692 NullFields []string `json:"-"` 693} 694 695func (s *UsageReport) MarshalJSON() ([]byte, error) { 696 type NoMethod UsageReport 697 raw := NoMethod(*s) 698 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 699} 700 701// UsageReportEntity: Output only. Information about the type of the 702// item. 703type UsageReportEntity struct { 704 // CustomerId: Output only. The unique identifier of the customer's 705 // account. 706 CustomerId string `json:"customerId,omitempty"` 707 708 // EntityId: Output only. Object key. Only relevant if entity.type = 709 // "OBJECT" Note: external-facing name of report is "Entities" rather 710 // than "Objects". 711 EntityId string `json:"entityId,omitempty"` 712 713 // ProfileId: Output only. The user's immutable Google Workspace profile 714 // identifier. 715 ProfileId string `json:"profileId,omitempty"` 716 717 // Type: Output only. The type of item. The value is `user`. 718 Type string `json:"type,omitempty"` 719 720 // UserEmail: Output only. The user's email address. Only relevant if 721 // entity.type = "USER" 722 UserEmail string `json:"userEmail,omitempty"` 723 724 // ForceSendFields is a list of field names (e.g. "CustomerId") to 725 // unconditionally include in API requests. By default, fields with 726 // empty values are omitted from API requests. However, any non-pointer, 727 // non-interface field appearing in ForceSendFields will be sent to the 728 // server regardless of whether the field is empty or not. This may be 729 // used to include empty fields in Patch requests. 730 ForceSendFields []string `json:"-"` 731 732 // NullFields is a list of field names (e.g. "CustomerId") to include in 733 // API requests with the JSON null value. By default, fields with empty 734 // values are omitted from API requests. However, any field with an 735 // empty value appearing in NullFields will be sent to the server as 736 // null. It is an error if a field in this list has a non-empty value. 737 // This may be used to include null fields in Patch requests. 738 NullFields []string `json:"-"` 739} 740 741func (s *UsageReportEntity) MarshalJSON() ([]byte, error) { 742 type NoMethod UsageReportEntity 743 raw := NoMethod(*s) 744 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 745} 746 747type UsageReportParameters struct { 748 // BoolValue: Output only. Boolean value of the parameter. 749 BoolValue bool `json:"boolValue,omitempty"` 750 751 // DatetimeValue: The RFC 3339 formatted value of the parameter, for 752 // example 2010-10-28T10:26:35.000Z. 753 DatetimeValue string `json:"datetimeValue,omitempty"` 754 755 // IntValue: Output only. Integer value of the parameter. 756 IntValue int64 `json:"intValue,omitempty,string"` 757 758 // MsgValue: Output only. Nested message value of the parameter. 759 MsgValue []googleapi.RawMessage `json:"msgValue,omitempty"` 760 761 // Name: The name of the parameter. For the User Usage Report parameter 762 // names, see the User Usage parameters reference. 763 Name string `json:"name,omitempty"` 764 765 // StringValue: Output only. String value of the parameter. 766 StringValue string `json:"stringValue,omitempty"` 767 768 // ForceSendFields is a list of field names (e.g. "BoolValue") to 769 // unconditionally include in API requests. By default, fields with 770 // empty values are omitted from API requests. However, any non-pointer, 771 // non-interface field appearing in ForceSendFields will be sent to the 772 // server regardless of whether the field is empty or not. This may be 773 // used to include empty fields in Patch requests. 774 ForceSendFields []string `json:"-"` 775 776 // NullFields is a list of field names (e.g. "BoolValue") to include in 777 // API requests with the JSON null value. By default, fields with empty 778 // values are omitted from API requests. However, any field with an 779 // empty value appearing in NullFields will be sent to the server as 780 // null. It is an error if a field in this list has a non-empty value. 781 // This may be used to include null fields in Patch requests. 782 NullFields []string `json:"-"` 783} 784 785func (s *UsageReportParameters) MarshalJSON() ([]byte, error) { 786 type NoMethod UsageReportParameters 787 raw := NoMethod(*s) 788 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 789} 790 791type UsageReports struct { 792 // Etag: ETag of the resource. 793 Etag string `json:"etag,omitempty"` 794 795 // Kind: The type of API resource. For a usage report, the value is 796 // `admin#reports#usageReports`. 797 Kind string `json:"kind,omitempty"` 798 799 // NextPageToken: Token to specify next page. A report with multiple 800 // pages has a `nextPageToken` property in the response. For your 801 // follow-on requests getting all of the report's pages, enter the 802 // `nextPageToken` value in the `pageToken` query string. 803 NextPageToken string `json:"nextPageToken,omitempty"` 804 805 // UsageReports: Various application parameter records. 806 UsageReports []*UsageReport `json:"usageReports,omitempty"` 807 808 // Warnings: Warnings, if any. 809 Warnings []*UsageReportsWarnings `json:"warnings,omitempty"` 810 811 // ServerResponse contains the HTTP response code and headers from the 812 // server. 813 googleapi.ServerResponse `json:"-"` 814 815 // ForceSendFields is a list of field names (e.g. "Etag") to 816 // unconditionally include in API requests. By default, fields with 817 // empty values are omitted from API requests. However, any non-pointer, 818 // non-interface field appearing in ForceSendFields will be sent to the 819 // server regardless of whether the field is empty or not. This may be 820 // used to include empty fields in Patch requests. 821 ForceSendFields []string `json:"-"` 822 823 // NullFields is a list of field names (e.g. "Etag") to include in API 824 // requests with the JSON null value. By default, fields with empty 825 // values are omitted from API requests. However, any field with an 826 // empty value appearing in NullFields will be sent to the server as 827 // null. It is an error if a field in this list has a non-empty value. 828 // This may be used to include null fields in Patch requests. 829 NullFields []string `json:"-"` 830} 831 832func (s *UsageReports) MarshalJSON() ([]byte, error) { 833 type NoMethod UsageReports 834 raw := NoMethod(*s) 835 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 836} 837 838type UsageReportsWarnings struct { 839 // Code: Machine readable code or warning type. The warning code value 840 // is `200`. 841 Code string `json:"code,omitempty"` 842 843 // Data: Key-value pairs to give detailed information on the warning. 844 Data []*UsageReportsWarningsData `json:"data,omitempty"` 845 846 // Message: The human readable messages for a warning are: - Data is not 847 // available warning - Sorry, data for date yyyy-mm-dd for application 848 // "application name" is not available. - Partial data is available 849 // warning - Data for date yyyy-mm-dd for application "application 850 // name" is not available right now, please try again after a few 851 // hours. 852 Message string `json:"message,omitempty"` 853 854 // ForceSendFields is a list of field names (e.g. "Code") to 855 // unconditionally include in API requests. By default, fields with 856 // empty values are omitted from API requests. However, any non-pointer, 857 // non-interface field appearing in ForceSendFields will be sent to the 858 // server regardless of whether the field is empty or not. This may be 859 // used to include empty fields in Patch requests. 860 ForceSendFields []string `json:"-"` 861 862 // NullFields is a list of field names (e.g. "Code") to include in API 863 // requests with the JSON null value. By default, fields with empty 864 // values are omitted from API requests. However, any field with an 865 // empty value appearing in NullFields will be sent to the server as 866 // null. It is an error if a field in this list has a non-empty value. 867 // This may be used to include null fields in Patch requests. 868 NullFields []string `json:"-"` 869} 870 871func (s *UsageReportsWarnings) MarshalJSON() ([]byte, error) { 872 type NoMethod UsageReportsWarnings 873 raw := NoMethod(*s) 874 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 875} 876 877type UsageReportsWarningsData struct { 878 // Key: Key associated with a key-value pair to give detailed 879 // information on the warning. 880 Key string `json:"key,omitempty"` 881 882 // Value: Value associated with a key-value pair to give detailed 883 // information on the warning. 884 Value string `json:"value,omitempty"` 885 886 // ForceSendFields is a list of field names (e.g. "Key") to 887 // unconditionally include in API requests. By default, fields with 888 // empty values are omitted from API requests. However, any non-pointer, 889 // non-interface field appearing in ForceSendFields will be sent to the 890 // server regardless of whether the field is empty or not. This may be 891 // used to include empty fields in Patch requests. 892 ForceSendFields []string `json:"-"` 893 894 // NullFields is a list of field names (e.g. "Key") to include in API 895 // requests with the JSON null value. By default, fields with empty 896 // values are omitted from API requests. However, any field with an 897 // empty value appearing in NullFields will be sent to the server as 898 // null. It is an error if a field in this list has a non-empty value. 899 // This may be used to include null fields in Patch requests. 900 NullFields []string `json:"-"` 901} 902 903func (s *UsageReportsWarningsData) MarshalJSON() ([]byte, error) { 904 type NoMethod UsageReportsWarningsData 905 raw := NoMethod(*s) 906 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 907} 908 909// method id "reports.activities.list": 910 911type ActivitiesListCall struct { 912 s *Service 913 userKey string 914 applicationName string 915 urlParams_ gensupport.URLParams 916 ifNoneMatch_ string 917 ctx_ context.Context 918 header_ http.Header 919} 920 921// List: Retrieves a list of activities for a specific customer's 922// account and application such as the Admin console application or the 923// Google Drive application. For more information, see the guides for 924// administrator and Google Drive activity reports. For more information 925// about the activity report's parameters, see the activity parameters 926// reference guides. 927// 928// - applicationName: Application name for which the events are to be 929// retrieved. 930// - userKey: Represents the profile ID or the user email for which the 931// data should be filtered. Can be `all` for all information, or 932// `userKey` for a user's unique Google Workspace profile ID or their 933// primary email address. 934func (r *ActivitiesService) List(userKey string, applicationName string) *ActivitiesListCall { 935 c := &ActivitiesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 936 c.userKey = userKey 937 c.applicationName = applicationName 938 return c 939} 940 941// ActorIpAddress sets the optional parameter "actorIpAddress": The 942// Internet Protocol (IP) Address of host where the event was performed. 943// This is an additional way to filter a report's summary using the IP 944// address of the user whose activity is being reported. This IP address 945// may or may not reflect the user's physical location. For example, the 946// IP address can be the user's proxy server's address or a virtual 947// private network (VPN) address. This parameter supports both IPv4 and 948// IPv6 address versions. 949func (c *ActivitiesListCall) ActorIpAddress(actorIpAddress string) *ActivitiesListCall { 950 c.urlParams_.Set("actorIpAddress", actorIpAddress) 951 return c 952} 953 954// CustomerId sets the optional parameter "customerId": The unique ID of 955// the customer to retrieve data for. 956func (c *ActivitiesListCall) CustomerId(customerId string) *ActivitiesListCall { 957 c.urlParams_.Set("customerId", customerId) 958 return c 959} 960 961// EndTime sets the optional parameter "endTime": Sets the end of the 962// range of time shown in the report. The date is in the RFC 3339 963// format, for example 2010-10-28T10:26:35.000Z. The default value is 964// the approximate time of the API request. An API report has three 965// basic time concepts: - *Date of the API's request for a report*: When 966// the API created and retrieved the report. - *Report's start time*: 967// The beginning of the timespan shown in the report. The `startTime` 968// must be before the `endTime` (if specified) and the current time when 969// the request is made, or the API returns an error. - *Report's end 970// time*: The end of the timespan shown in the report. For example, the 971// timespan of events summarized in a report can start in April and end 972// in May. The report itself can be requested in August. If the 973// `endTime` is not specified, the report returns all activities from 974// the `startTime` until the current time or the most recent 180 days if 975// the `startTime` is more than 180 days in the past. 976func (c *ActivitiesListCall) EndTime(endTime string) *ActivitiesListCall { 977 c.urlParams_.Set("endTime", endTime) 978 return c 979} 980 981// EventName sets the optional parameter "eventName": The name of the 982// event being queried by the API. Each `eventName` is related to a 983// specific Google Workspace service or feature which the API organizes 984// into types of events. An example is the Google Calendar events in the 985// Admin console application's reports. The Calendar Settings `type` 986// structure has all of the Calendar `eventName` activities reported by 987// the API. When an administrator changes a Calendar setting, the API 988// reports this activity in the Calendar Settings `type` and `eventName` 989// parameters. For more information about `eventName` query strings and 990// parameters, see the list of event names for various applications 991// above in `applicationName`. 992func (c *ActivitiesListCall) EventName(eventName string) *ActivitiesListCall { 993 c.urlParams_.Set("eventName", eventName) 994 return c 995} 996 997// Filters sets the optional parameter "filters": The `filters` query 998// string is a comma-separated list. The list is composed of event 999// parameters that are manipulated by relational operators. Event 1000// parameters are in the form `parameter1 name[parameter1 1001// value],parameter2 name[parameter2 value],...` These event parameters 1002// are associated with a specific `eventName`. An empty report is 1003// returned if the filtered request's parameter does not belong to the 1004// `eventName`. For more information about `eventName` parameters, see 1005// the list of event names for various applications above in 1006// `applicationName`. In the following Admin Activity example, the <> 1007// operator is URL-encoded in the request's query string (%3C%3E): 1008// GET...&eventName=CHANGE_CALENDAR_SETTING 1009// &filters=NEW_VALUE%3C%3EREAD_ONLY_ACCESS In the following Drive 1010// example, the list can be a view or edit event's `doc_id` parameter 1011// with a value that is manipulated by an 'equal to' (==) or 'not equal 1012// to' (<>) relational operator. In the first example, the report 1013// returns each edited document's `doc_id`. In the second example, the 1014// report returns each viewed document's `doc_id` that equals the value 1015// 12345 and does not return any viewed document's which have a `doc_id` 1016// value of 98765. The <> operator is URL-encoded in the request's query 1017// string (%3C%3E): GET...&eventName=edit&filters=doc_id 1018// GET...&eventName=view&filters=doc_id==12345,doc_id%3C%3E98765 The 1019// relational operators include: - `==` - 'equal to'. - `<>` - 'not 1020// equal to'. It is URL-encoded (%3C%3E). - `<` - 'less than'. It is 1021// URL-encoded (%3C). - `<=` - 'less than or equal to'. It is 1022// URL-encoded (%3C=). - `>` - 'greater than'. It is URL-encoded (%3E). 1023// - `>=` - 'greater than or equal to'. It is URL-encoded (%3E=). 1024// *Note:* The API doesn't accept multiple values of a parameter. If a 1025// particular parameter is supplied more than once in the API request, 1026// the API only accepts the last value of that request parameter. In 1027// addition, if an invalid request parameter is supplied in the API 1028// request, the API ignores that request parameter and returns the 1029// response corresponding to the remaining valid request parameters. If 1030// no parameters are requested, all parameters are returned. 1031func (c *ActivitiesListCall) Filters(filters string) *ActivitiesListCall { 1032 c.urlParams_.Set("filters", filters) 1033 return c 1034} 1035 1036// GroupIdFilter sets the optional parameter "groupIdFilter": Comma 1037// separated group ids (obfuscated) on which user activities are 1038// filtered, i.e, the response will contain activities for only those 1039// users that are a part of at least one of the group ids mentioned 1040// here. Format: "id:abc123,id:xyz456" 1041func (c *ActivitiesListCall) GroupIdFilter(groupIdFilter string) *ActivitiesListCall { 1042 c.urlParams_.Set("groupIdFilter", groupIdFilter) 1043 return c 1044} 1045 1046// MaxResults sets the optional parameter "maxResults": Determines how 1047// many activity records are shown on each response page. For example, 1048// if the request sets `maxResults=1` and the report has two activities, 1049// the report has two pages. The response's `nextPageToken` property has 1050// the token to the second page. The `maxResults` query string is 1051// optional in the request. The default value is 1000. 1052func (c *ActivitiesListCall) MaxResults(maxResults int64) *ActivitiesListCall { 1053 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 1054 return c 1055} 1056 1057// OrgUnitID sets the optional parameter "orgUnitID": ID of the 1058// organizational unit to report on. Activity records will be shown only 1059// for users who belong to the specified organizational unit. Data 1060// before Dec 17, 2018 doesn't appear in the filtered results. 1061func (c *ActivitiesListCall) OrgUnitID(orgUnitID string) *ActivitiesListCall { 1062 c.urlParams_.Set("orgUnitID", orgUnitID) 1063 return c 1064} 1065 1066// PageToken sets the optional parameter "pageToken": The token to 1067// specify next page. A report with multiple pages has a `nextPageToken` 1068// property in the response. In your follow-on request getting the next 1069// page of the report, enter the `nextPageToken` value in the 1070// `pageToken` query string. 1071func (c *ActivitiesListCall) PageToken(pageToken string) *ActivitiesListCall { 1072 c.urlParams_.Set("pageToken", pageToken) 1073 return c 1074} 1075 1076// StartTime sets the optional parameter "startTime": Sets the beginning 1077// of the range of time shown in the report. The date is in the RFC 3339 1078// format, for example 2010-10-28T10:26:35.000Z. The report returns all 1079// activities from `startTime` until `endTime`. The `startTime` must be 1080// before the `endTime` (if specified) and the current time when the 1081// request is made, or the API returns an error. 1082func (c *ActivitiesListCall) StartTime(startTime string) *ActivitiesListCall { 1083 c.urlParams_.Set("startTime", startTime) 1084 return c 1085} 1086 1087// Fields allows partial responses to be retrieved. See 1088// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1089// for more information. 1090func (c *ActivitiesListCall) Fields(s ...googleapi.Field) *ActivitiesListCall { 1091 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1092 return c 1093} 1094 1095// IfNoneMatch sets the optional parameter which makes the operation 1096// fail if the object's ETag matches the given value. This is useful for 1097// getting updates only after the object has changed since the last 1098// request. Use googleapi.IsNotModified to check whether the response 1099// error from Do is the result of In-None-Match. 1100func (c *ActivitiesListCall) IfNoneMatch(entityTag string) *ActivitiesListCall { 1101 c.ifNoneMatch_ = entityTag 1102 return c 1103} 1104 1105// Context sets the context to be used in this call's Do method. Any 1106// pending HTTP request will be aborted if the provided context is 1107// canceled. 1108func (c *ActivitiesListCall) Context(ctx context.Context) *ActivitiesListCall { 1109 c.ctx_ = ctx 1110 return c 1111} 1112 1113// Header returns an http.Header that can be modified by the caller to 1114// add HTTP headers to the request. 1115func (c *ActivitiesListCall) Header() http.Header { 1116 if c.header_ == nil { 1117 c.header_ = make(http.Header) 1118 } 1119 return c.header_ 1120} 1121 1122func (c *ActivitiesListCall) doRequest(alt string) (*http.Response, error) { 1123 reqHeaders := make(http.Header) 1124 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 1125 for k, v := range c.header_ { 1126 reqHeaders[k] = v 1127 } 1128 reqHeaders.Set("User-Agent", c.s.userAgent()) 1129 if c.ifNoneMatch_ != "" { 1130 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1131 } 1132 var body io.Reader = nil 1133 c.urlParams_.Set("alt", alt) 1134 c.urlParams_.Set("prettyPrint", "false") 1135 urls := googleapi.ResolveRelative(c.s.BasePath, "admin/reports/v1/activity/users/{userKey}/applications/{applicationName}") 1136 urls += "?" + c.urlParams_.Encode() 1137 req, err := http.NewRequest("GET", urls, body) 1138 if err != nil { 1139 return nil, err 1140 } 1141 req.Header = reqHeaders 1142 googleapi.Expand(req.URL, map[string]string{ 1143 "userKey": c.userKey, 1144 "applicationName": c.applicationName, 1145 }) 1146 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1147} 1148 1149// Do executes the "reports.activities.list" call. 1150// Exactly one of *Activities or error will be non-nil. Any non-2xx 1151// status code is an error. Response headers are in either 1152// *Activities.ServerResponse.Header or (if a response was returned at 1153// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1154// to check whether the returned error was because 1155// http.StatusNotModified was returned. 1156func (c *ActivitiesListCall) Do(opts ...googleapi.CallOption) (*Activities, error) { 1157 gensupport.SetOptions(c.urlParams_, opts...) 1158 res, err := c.doRequest("json") 1159 if res != nil && res.StatusCode == http.StatusNotModified { 1160 if res.Body != nil { 1161 res.Body.Close() 1162 } 1163 return nil, &googleapi.Error{ 1164 Code: res.StatusCode, 1165 Header: res.Header, 1166 } 1167 } 1168 if err != nil { 1169 return nil, err 1170 } 1171 defer googleapi.CloseBody(res) 1172 if err := googleapi.CheckResponse(res); err != nil { 1173 return nil, err 1174 } 1175 ret := &Activities{ 1176 ServerResponse: googleapi.ServerResponse{ 1177 Header: res.Header, 1178 HTTPStatusCode: res.StatusCode, 1179 }, 1180 } 1181 target := &ret 1182 if err := gensupport.DecodeResponse(target, res); err != nil { 1183 return nil, err 1184 } 1185 return ret, nil 1186 // { 1187 // "description": "Retrieves a list of activities for a specific customer's account and application such as the Admin console application or the Google Drive application. For more information, see the guides for administrator and Google Drive activity reports. For more information about the activity report's parameters, see the activity parameters reference guides. ", 1188 // "flatPath": "admin/reports/v1/activity/users/{userKey}/applications/{applicationName}", 1189 // "httpMethod": "GET", 1190 // "id": "reports.activities.list", 1191 // "parameterOrder": [ 1192 // "userKey", 1193 // "applicationName" 1194 // ], 1195 // "parameters": { 1196 // "actorIpAddress": { 1197 // "description": "The Internet Protocol (IP) Address of host where the event was performed. This is an additional way to filter a report's summary using the IP address of the user whose activity is being reported. This IP address may or may not reflect the user's physical location. For example, the IP address can be the user's proxy server's address or a virtual private network (VPN) address. This parameter supports both IPv4 and IPv6 address versions.", 1198 // "location": "query", 1199 // "type": "string" 1200 // }, 1201 // "applicationName": { 1202 // "description": "Application name for which the events are to be retrieved.", 1203 // "enum": [ 1204 // "access_transparency", 1205 // "admin", 1206 // "calendar", 1207 // "chat", 1208 // "drive", 1209 // "gcp", 1210 // "gplus", 1211 // "groups", 1212 // "groups_enterprise", 1213 // "jamboard", 1214 // "login", 1215 // "meet", 1216 // "mobile", 1217 // "rules", 1218 // "saml", 1219 // "token", 1220 // "user_accounts", 1221 // "context_aware_access", 1222 // "chrome", 1223 // "data_studio" 1224 // ], 1225 // "enumDescriptions": [ 1226 // "The Google Workspace Access Transparency activity reports return information about different types of Access Transparency activity events.", 1227 // "The Admin console application's activity reports return account information about different types of administrator activity events.", 1228 // "The Google Calendar application's activity reports return information about various Calendar activity events.", 1229 // "The Chat activity reports return information about various Chat activity events.", 1230 // "The Google Drive application's activity reports return information about various Google Drive activity events. The Drive activity report is only available for Google Workspace Business and Enterprise customers.", 1231 // "The Google Cloud Platform application's activity reports return information about various GCP activity events.", 1232 // "The Google+ application's activity reports return information about various Google+ activity events.", 1233 // "The Google Groups application's activity reports return information about various Groups activity events.", 1234 // "The Enterprise Groups activity reports return information about various Enterprise group activity events.", 1235 // "The Jamboard activity reports return information about various Jamboard activity events.", 1236 // "The Login application's activity reports return account information about different types of Login activity events.", 1237 // "The Meet Audit activity report return information about different types of Meet Audit activity events.", 1238 // "The Mobile Audit activity report return information about different types of Mobile Audit activity events.", 1239 // "The Rules activity report return information about different types of Rules activity events.", 1240 // "The SAML activity report return information about different types of SAML activity events.", 1241 // "The Token application's activity reports return account information about different types of Token activity events.", 1242 // "The User Accounts application's activity reports return account information about different types of User Accounts activity events.", 1243 // "The Context-aware access activity reports return information about users' access denied events due to Context-aware access rules.", 1244 // "The Chrome activity reports return information about unsafe events reported in the context of the WebProtect features of BeyondCorp.", 1245 // "The Data Studio activity reports return information about various types of Data Studio activity events." 1246 // ], 1247 // "location": "path", 1248 // "pattern": "(access_transparency)|(admin)|(calendar)|(chat)|(chrome)|(context_aware_access)|(data_studio)|(drive)|(gcp)|(gplus)|(groups)|(groups_enterprise)|(jamboard)|(login)|(meet)|(mobile)|(rules)|(saml)|(token)|(user_accounts)", 1249 // "required": true, 1250 // "type": "string" 1251 // }, 1252 // "customerId": { 1253 // "description": "The unique ID of the customer to retrieve data for.", 1254 // "location": "query", 1255 // "pattern": "C.+|my_customer", 1256 // "type": "string" 1257 // }, 1258 // "endTime": { 1259 // "description": "Sets the end of the range of time shown in the report. The date is in the RFC 3339 format, for example 2010-10-28T10:26:35.000Z. The default value is the approximate time of the API request. An API report has three basic time concepts: - *Date of the API's request for a report*: When the API created and retrieved the report. - *Report's start time*: The beginning of the timespan shown in the report. The `startTime` must be before the `endTime` (if specified) and the current time when the request is made, or the API returns an error. - *Report's end time*: The end of the timespan shown in the report. For example, the timespan of events summarized in a report can start in April and end in May. The report itself can be requested in August. If the `endTime` is not specified, the report returns all activities from the `startTime` until the current time or the most recent 180 days if the `startTime` is more than 180 days in the past.", 1260 // "location": "query", 1261 // "pattern": "(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d):(\\d\\d)(?:\\.(\\d+))?(?:(Z)|([-+])(\\d\\d):(\\d\\d))", 1262 // "type": "string" 1263 // }, 1264 // "eventName": { 1265 // "description": "The name of the event being queried by the API. Each `eventName` is related to a specific Google Workspace service or feature which the API organizes into types of events. An example is the Google Calendar events in the Admin console application's reports. The Calendar Settings `type` structure has all of the Calendar `eventName` activities reported by the API. When an administrator changes a Calendar setting, the API reports this activity in the Calendar Settings `type` and `eventName` parameters. For more information about `eventName` query strings and parameters, see the list of event names for various applications above in `applicationName`.", 1266 // "location": "query", 1267 // "type": "string" 1268 // }, 1269 // "filters": { 1270 // "description": "The `filters` query string is a comma-separated list. The list is composed of event parameters that are manipulated by relational operators. Event parameters are in the form `parameter1 name[parameter1 value],parameter2 name[parameter2 value],...` These event parameters are associated with a specific `eventName`. An empty report is returned if the filtered request's parameter does not belong to the `eventName`. For more information about `eventName` parameters, see the list of event names for various applications above in `applicationName`. In the following Admin Activity example, the \u003c\u003e operator is URL-encoded in the request's query string (%3C%3E): GET...\u0026eventName=CHANGE_CALENDAR_SETTING \u0026filters=NEW_VALUE%3C%3EREAD_ONLY_ACCESS In the following Drive example, the list can be a view or edit event's `doc_id` parameter with a value that is manipulated by an 'equal to' (==) or 'not equal to' (\u003c\u003e) relational operator. In the first example, the report returns each edited document's `doc_id`. In the second example, the report returns each viewed document's `doc_id` that equals the value 12345 and does not return any viewed document's which have a `doc_id` value of 98765. The \u003c\u003e operator is URL-encoded in the request's query string (%3C%3E): GET...\u0026eventName=edit\u0026filters=doc_id GET...\u0026eventName=view\u0026filters=doc_id==12345,doc_id%3C%3E98765 The relational operators include: - `==` - 'equal to'. - `\u003c\u003e` - 'not equal to'. It is URL-encoded (%3C%3E). - `\u003c` - 'less than'. It is URL-encoded (%3C). - `\u003c=` - 'less than or equal to'. It is URL-encoded (%3C=). - `\u003e` - 'greater than'. It is URL-encoded (%3E). - `\u003e=` - 'greater than or equal to'. It is URL-encoded (%3E=). *Note:* The API doesn't accept multiple values of a parameter. If a particular parameter is supplied more than once in the API request, the API only accepts the last value of that request parameter. In addition, if an invalid request parameter is supplied in the API request, the API ignores that request parameter and returns the response corresponding to the remaining valid request parameters. If no parameters are requested, all parameters are returned. ", 1271 // "location": "query", 1272 // "pattern": "(.+[\u003c,\u003c=,==,\u003e=,\u003e,\u003c\u003e].+,)*(.+[\u003c,\u003c=,==,\u003e=,\u003e,\u003c\u003e].+)", 1273 // "type": "string" 1274 // }, 1275 // "groupIdFilter": { 1276 // "description": "Comma separated group ids (obfuscated) on which user activities are filtered, i.e, the response will contain activities for only those users that are a part of at least one of the group ids mentioned here. Format: \"id:abc123,id:xyz456\"", 1277 // "location": "query", 1278 // "pattern": "(id:[a-z0-9]+(,id:[a-z0-9]+)*)", 1279 // "type": "string" 1280 // }, 1281 // "maxResults": { 1282 // "default": "1000", 1283 // "description": "Determines how many activity records are shown on each response page. For example, if the request sets `maxResults=1` and the report has two activities, the report has two pages. The response's `nextPageToken` property has the token to the second page. The `maxResults` query string is optional in the request. The default value is 1000.", 1284 // "format": "int32", 1285 // "location": "query", 1286 // "maximum": "1000", 1287 // "minimum": "1", 1288 // "type": "integer" 1289 // }, 1290 // "orgUnitID": { 1291 // "default": "", 1292 // "description": "ID of the organizational unit to report on. Activity records will be shown only for users who belong to the specified organizational unit. Data before Dec 17, 2018 doesn't appear in the filtered results.", 1293 // "location": "query", 1294 // "pattern": "(id:[a-z0-9]+)", 1295 // "type": "string" 1296 // }, 1297 // "pageToken": { 1298 // "description": "The token to specify next page. A report with multiple pages has a `nextPageToken` property in the response. In your follow-on request getting the next page of the report, enter the `nextPageToken` value in the `pageToken` query string.", 1299 // "location": "query", 1300 // "type": "string" 1301 // }, 1302 // "startTime": { 1303 // "description": "Sets the beginning of the range of time shown in the report. The date is in the RFC 3339 format, for example 2010-10-28T10:26:35.000Z. The report returns all activities from `startTime` until `endTime`. The `startTime` must be before the `endTime` (if specified) and the current time when the request is made, or the API returns an error.", 1304 // "location": "query", 1305 // "pattern": "(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d):(\\d\\d)(?:\\.(\\d+))?(?:(Z)|([-+])(\\d\\d):(\\d\\d))", 1306 // "type": "string" 1307 // }, 1308 // "userKey": { 1309 // "description": "Represents the profile ID or the user email for which the data should be filtered. Can be `all` for all information, or `userKey` for a user's unique Google Workspace profile ID or their primary email address.", 1310 // "location": "path", 1311 // "required": true, 1312 // "type": "string" 1313 // } 1314 // }, 1315 // "path": "admin/reports/v1/activity/users/{userKey}/applications/{applicationName}", 1316 // "response": { 1317 // "$ref": "Activities" 1318 // }, 1319 // "scopes": [ 1320 // "https://www.googleapis.com/auth/admin.reports.audit.readonly" 1321 // ] 1322 // } 1323 1324} 1325 1326// Pages invokes f for each page of results. 1327// A non-nil error returned from f will halt the iteration. 1328// The provided context supersedes any context provided to the Context method. 1329func (c *ActivitiesListCall) Pages(ctx context.Context, f func(*Activities) error) error { 1330 c.ctx_ = ctx 1331 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 1332 for { 1333 x, err := c.Do() 1334 if err != nil { 1335 return err 1336 } 1337 if err := f(x); err != nil { 1338 return err 1339 } 1340 if x.NextPageToken == "" { 1341 return nil 1342 } 1343 c.PageToken(x.NextPageToken) 1344 } 1345} 1346 1347// method id "reports.activities.watch": 1348 1349type ActivitiesWatchCall struct { 1350 s *Service 1351 userKey string 1352 applicationName string 1353 channel *Channel 1354 urlParams_ gensupport.URLParams 1355 ctx_ context.Context 1356 header_ http.Header 1357} 1358 1359// Watch: Start receiving notifications for account activities. For more 1360// information, see Receiving Push Notifications. 1361// 1362// - applicationName: Application name for which the events are to be 1363// retrieved. 1364// - userKey: Represents the profile ID or the user email for which the 1365// data should be filtered. Can be `all` for all information, or 1366// `userKey` for a user's unique Google Workspace profile ID or their 1367// primary email address. 1368func (r *ActivitiesService) Watch(userKey string, applicationName string, channel *Channel) *ActivitiesWatchCall { 1369 c := &ActivitiesWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1370 c.userKey = userKey 1371 c.applicationName = applicationName 1372 c.channel = channel 1373 return c 1374} 1375 1376// ActorIpAddress sets the optional parameter "actorIpAddress": The 1377// Internet Protocol (IP) Address of host where the event was performed. 1378// This is an additional way to filter a report's summary using the IP 1379// address of the user whose activity is being reported. This IP address 1380// may or may not reflect the user's physical location. For example, the 1381// IP address can be the user's proxy server's address or a virtual 1382// private network (VPN) address. This parameter supports both IPv4 and 1383// IPv6 address versions. 1384func (c *ActivitiesWatchCall) ActorIpAddress(actorIpAddress string) *ActivitiesWatchCall { 1385 c.urlParams_.Set("actorIpAddress", actorIpAddress) 1386 return c 1387} 1388 1389// CustomerId sets the optional parameter "customerId": The unique ID of 1390// the customer to retrieve data for. 1391func (c *ActivitiesWatchCall) CustomerId(customerId string) *ActivitiesWatchCall { 1392 c.urlParams_.Set("customerId", customerId) 1393 return c 1394} 1395 1396// EndTime sets the optional parameter "endTime": Sets the end of the 1397// range of time shown in the report. The date is in the RFC 3339 1398// format, for example 2010-10-28T10:26:35.000Z. The default value is 1399// the approximate time of the API request. An API report has three 1400// basic time concepts: - *Date of the API's request for a report*: When 1401// the API created and retrieved the report. - *Report's start time*: 1402// The beginning of the timespan shown in the report. The `startTime` 1403// must be before the `endTime` (if specified) and the current time when 1404// the request is made, or the API returns an error. - *Report's end 1405// time*: The end of the timespan shown in the report. For example, the 1406// timespan of events summarized in a report can start in April and end 1407// in May. The report itself can be requested in August. If the 1408// `endTime` is not specified, the report returns all activities from 1409// the `startTime` until the current time or the most recent 180 days if 1410// the `startTime` is more than 180 days in the past. 1411func (c *ActivitiesWatchCall) EndTime(endTime string) *ActivitiesWatchCall { 1412 c.urlParams_.Set("endTime", endTime) 1413 return c 1414} 1415 1416// EventName sets the optional parameter "eventName": The name of the 1417// event being queried by the API. Each `eventName` is related to a 1418// specific Google Workspace service or feature which the API organizes 1419// into types of events. An example is the Google Calendar events in the 1420// Admin console application's reports. The Calendar Settings `type` 1421// structure has all of the Calendar `eventName` activities reported by 1422// the API. When an administrator changes a Calendar setting, the API 1423// reports this activity in the Calendar Settings `type` and `eventName` 1424// parameters. For more information about `eventName` query strings and 1425// parameters, see the list of event names for various applications 1426// above in `applicationName`. 1427func (c *ActivitiesWatchCall) EventName(eventName string) *ActivitiesWatchCall { 1428 c.urlParams_.Set("eventName", eventName) 1429 return c 1430} 1431 1432// Filters sets the optional parameter "filters": The `filters` query 1433// string is a comma-separated list. The list is composed of event 1434// parameters that are manipulated by relational operators. Event 1435// parameters are in the form `parameter1 name[parameter1 1436// value],parameter2 name[parameter2 value],...` These event parameters 1437// are associated with a specific `eventName`. An empty report is 1438// returned if the filtered request's parameter does not belong to the 1439// `eventName`. For more information about `eventName` parameters, see 1440// the list of event names for various applications above in 1441// `applicationName`. In the following Admin Activity example, the <> 1442// operator is URL-encoded in the request's query string (%3C%3E): 1443// GET...&eventName=CHANGE_CALENDAR_SETTING 1444// &filters=NEW_VALUE%3C%3EREAD_ONLY_ACCESS In the following Drive 1445// example, the list can be a view or edit event's `doc_id` parameter 1446// with a value that is manipulated by an 'equal to' (==) or 'not equal 1447// to' (<>) relational operator. In the first example, the report 1448// returns each edited document's `doc_id`. In the second example, the 1449// report returns each viewed document's `doc_id` that equals the value 1450// 12345 and does not return any viewed document's which have a `doc_id` 1451// value of 98765. The <> operator is URL-encoded in the request's query 1452// string (%3C%3E): GET...&eventName=edit&filters=doc_id 1453// GET...&eventName=view&filters=doc_id==12345,doc_id%3C%3E98765 The 1454// relational operators include: - `==` - 'equal to'. - `<>` - 'not 1455// equal to'. It is URL-encoded (%3C%3E). - `<` - 'less than'. It is 1456// URL-encoded (%3C). - `<=` - 'less than or equal to'. It is 1457// URL-encoded (%3C=). - `>` - 'greater than'. It is URL-encoded (%3E). 1458// - `>=` - 'greater than or equal to'. It is URL-encoded (%3E=). 1459// *Note:* The API doesn't accept multiple values of a parameter. If a 1460// particular parameter is supplied more than once in the API request, 1461// the API only accepts the last value of that request parameter. In 1462// addition, if an invalid request parameter is supplied in the API 1463// request, the API ignores that request parameter and returns the 1464// response corresponding to the remaining valid request parameters. If 1465// no parameters are requested, all parameters are returned. 1466func (c *ActivitiesWatchCall) Filters(filters string) *ActivitiesWatchCall { 1467 c.urlParams_.Set("filters", filters) 1468 return c 1469} 1470 1471// GroupIdFilter sets the optional parameter "groupIdFilter": Comma 1472// separated group ids (obfuscated) on which user activities are 1473// filtered, i.e, the response will contain activities for only those 1474// users that are a part of at least one of the group ids mentioned 1475// here. Format: "id:abc123,id:xyz456" 1476func (c *ActivitiesWatchCall) GroupIdFilter(groupIdFilter string) *ActivitiesWatchCall { 1477 c.urlParams_.Set("groupIdFilter", groupIdFilter) 1478 return c 1479} 1480 1481// MaxResults sets the optional parameter "maxResults": Determines how 1482// many activity records are shown on each response page. For example, 1483// if the request sets `maxResults=1` and the report has two activities, 1484// the report has two pages. The response's `nextPageToken` property has 1485// the token to the second page. The `maxResults` query string is 1486// optional in the request. The default value is 1000. 1487func (c *ActivitiesWatchCall) MaxResults(maxResults int64) *ActivitiesWatchCall { 1488 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 1489 return c 1490} 1491 1492// OrgUnitID sets the optional parameter "orgUnitID": ID of the 1493// organizational unit to report on. Activity records will be shown only 1494// for users who belong to the specified organizational unit. Data 1495// before Dec 17, 2018 doesn't appear in the filtered results. 1496func (c *ActivitiesWatchCall) OrgUnitID(orgUnitID string) *ActivitiesWatchCall { 1497 c.urlParams_.Set("orgUnitID", orgUnitID) 1498 return c 1499} 1500 1501// PageToken sets the optional parameter "pageToken": The token to 1502// specify next page. A report with multiple pages has a `nextPageToken` 1503// property in the response. In your follow-on request getting the next 1504// page of the report, enter the `nextPageToken` value in the 1505// `pageToken` query string. 1506func (c *ActivitiesWatchCall) PageToken(pageToken string) *ActivitiesWatchCall { 1507 c.urlParams_.Set("pageToken", pageToken) 1508 return c 1509} 1510 1511// StartTime sets the optional parameter "startTime": Sets the beginning 1512// of the range of time shown in the report. The date is in the RFC 3339 1513// format, for example 2010-10-28T10:26:35.000Z. The report returns all 1514// activities from `startTime` until `endTime`. The `startTime` must be 1515// before the `endTime` (if specified) and the current time when the 1516// request is made, or the API returns an error. 1517func (c *ActivitiesWatchCall) StartTime(startTime string) *ActivitiesWatchCall { 1518 c.urlParams_.Set("startTime", startTime) 1519 return c 1520} 1521 1522// Fields allows partial responses to be retrieved. See 1523// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1524// for more information. 1525func (c *ActivitiesWatchCall) Fields(s ...googleapi.Field) *ActivitiesWatchCall { 1526 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1527 return c 1528} 1529 1530// Context sets the context to be used in this call's Do method. Any 1531// pending HTTP request will be aborted if the provided context is 1532// canceled. 1533func (c *ActivitiesWatchCall) Context(ctx context.Context) *ActivitiesWatchCall { 1534 c.ctx_ = ctx 1535 return c 1536} 1537 1538// Header returns an http.Header that can be modified by the caller to 1539// add HTTP headers to the request. 1540func (c *ActivitiesWatchCall) Header() http.Header { 1541 if c.header_ == nil { 1542 c.header_ = make(http.Header) 1543 } 1544 return c.header_ 1545} 1546 1547func (c *ActivitiesWatchCall) doRequest(alt string) (*http.Response, error) { 1548 reqHeaders := make(http.Header) 1549 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 1550 for k, v := range c.header_ { 1551 reqHeaders[k] = v 1552 } 1553 reqHeaders.Set("User-Agent", c.s.userAgent()) 1554 var body io.Reader = nil 1555 body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel) 1556 if err != nil { 1557 return nil, err 1558 } 1559 reqHeaders.Set("Content-Type", "application/json") 1560 c.urlParams_.Set("alt", alt) 1561 c.urlParams_.Set("prettyPrint", "false") 1562 urls := googleapi.ResolveRelative(c.s.BasePath, "admin/reports/v1/activity/users/{userKey}/applications/{applicationName}/watch") 1563 urls += "?" + c.urlParams_.Encode() 1564 req, err := http.NewRequest("POST", urls, body) 1565 if err != nil { 1566 return nil, err 1567 } 1568 req.Header = reqHeaders 1569 googleapi.Expand(req.URL, map[string]string{ 1570 "userKey": c.userKey, 1571 "applicationName": c.applicationName, 1572 }) 1573 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1574} 1575 1576// Do executes the "reports.activities.watch" call. 1577// Exactly one of *Channel or error will be non-nil. Any non-2xx status 1578// code is an error. Response headers are in either 1579// *Channel.ServerResponse.Header or (if a response was returned at all) 1580// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1581// check whether the returned error was because http.StatusNotModified 1582// was returned. 1583func (c *ActivitiesWatchCall) Do(opts ...googleapi.CallOption) (*Channel, error) { 1584 gensupport.SetOptions(c.urlParams_, opts...) 1585 res, err := c.doRequest("json") 1586 if res != nil && res.StatusCode == http.StatusNotModified { 1587 if res.Body != nil { 1588 res.Body.Close() 1589 } 1590 return nil, &googleapi.Error{ 1591 Code: res.StatusCode, 1592 Header: res.Header, 1593 } 1594 } 1595 if err != nil { 1596 return nil, err 1597 } 1598 defer googleapi.CloseBody(res) 1599 if err := googleapi.CheckResponse(res); err != nil { 1600 return nil, err 1601 } 1602 ret := &Channel{ 1603 ServerResponse: googleapi.ServerResponse{ 1604 Header: res.Header, 1605 HTTPStatusCode: res.StatusCode, 1606 }, 1607 } 1608 target := &ret 1609 if err := gensupport.DecodeResponse(target, res); err != nil { 1610 return nil, err 1611 } 1612 return ret, nil 1613 // { 1614 // "description": "Start receiving notifications for account activities. For more information, see Receiving Push Notifications.", 1615 // "flatPath": "admin/reports/v1/activity/users/{userKey}/applications/{applicationName}/watch", 1616 // "httpMethod": "POST", 1617 // "id": "reports.activities.watch", 1618 // "parameterOrder": [ 1619 // "userKey", 1620 // "applicationName" 1621 // ], 1622 // "parameters": { 1623 // "actorIpAddress": { 1624 // "description": "The Internet Protocol (IP) Address of host where the event was performed. This is an additional way to filter a report's summary using the IP address of the user whose activity is being reported. This IP address may or may not reflect the user's physical location. For example, the IP address can be the user's proxy server's address or a virtual private network (VPN) address. This parameter supports both IPv4 and IPv6 address versions.", 1625 // "location": "query", 1626 // "type": "string" 1627 // }, 1628 // "applicationName": { 1629 // "description": "Application name for which the events are to be retrieved.", 1630 // "enum": [ 1631 // "access_transparency", 1632 // "admin", 1633 // "calendar", 1634 // "chat", 1635 // "drive", 1636 // "gcp", 1637 // "gplus", 1638 // "groups", 1639 // "groups_enterprise", 1640 // "jamboard", 1641 // "login", 1642 // "meet", 1643 // "mobile", 1644 // "rules", 1645 // "saml", 1646 // "token", 1647 // "user_accounts", 1648 // "context_aware_access", 1649 // "chrome", 1650 // "data_studio" 1651 // ], 1652 // "enumDescriptions": [ 1653 // "The Google Workspace Access Transparency activity reports return information about different types of Access Transparency activity events.", 1654 // "The Admin console application's activity reports return account information about different types of administrator activity events.", 1655 // "The Google Calendar application's activity reports return information about various Calendar activity events.", 1656 // "The Chat activity reports return information about various Chat activity events.", 1657 // "The Google Drive application's activity reports return information about various Google Drive activity events. The Drive activity report is only available for Google Workspace Business and Google Workspace Enterprise customers.", 1658 // "The Google Cloud Platform application's activity reports return information about various GCP activity events.", 1659 // "The Google+ application's activity reports return information about various Google+ activity events.", 1660 // "The Google Groups application's activity reports return information about various Groups activity events.", 1661 // "The Enterprise Groups activity reports return information about various Enterprise group activity events.", 1662 // "The Jamboard activity reports return information about various Jamboard activity events.", 1663 // "The Login application's activity reports return account information about different types of Login activity events.", 1664 // "The Meet Audit activity report return information about different types of Meet Audit activity events.", 1665 // "The Mobile Audit activity report return information about different types of Mobile Audit activity events.", 1666 // "The Rules activity report return information about different types of Rules activity events.", 1667 // "The SAML activity report return information about different types of SAML activity events.", 1668 // "The Token application's activity reports return account information about different types of Token activity events.", 1669 // "The User Accounts application's activity reports return account information about different types of User Accounts activity events.", 1670 // "The Context-aware access activity reports return information about users' access denied events due to Context-aware access rules.", 1671 // "The Chrome activity reports return information about unsafe events reported in the context of the WebProtect features of BeyondCorp.", 1672 // "The Data Studio activity reports return information about various types of Data Studio activity events." 1673 // ], 1674 // "location": "path", 1675 // "pattern": "(access_transparency)|(admin)|(calendar)|(chat)|(chrome)|(context_aware_access)|(data_studio)|(drive)|(gcp)|(gplus)|(groups)|(groups_enterprise)|(jamboard)|(login)|(meet)|(mobile)|(rules)|(saml)|(token)|(user_accounts)", 1676 // "required": true, 1677 // "type": "string" 1678 // }, 1679 // "customerId": { 1680 // "description": "The unique ID of the customer to retrieve data for.", 1681 // "location": "query", 1682 // "pattern": "C.+|my_customer", 1683 // "type": "string" 1684 // }, 1685 // "endTime": { 1686 // "description": "Sets the end of the range of time shown in the report. The date is in the RFC 3339 format, for example 2010-10-28T10:26:35.000Z. The default value is the approximate time of the API request. An API report has three basic time concepts: - *Date of the API's request for a report*: When the API created and retrieved the report. - *Report's start time*: The beginning of the timespan shown in the report. The `startTime` must be before the `endTime` (if specified) and the current time when the request is made, or the API returns an error. - *Report's end time*: The end of the timespan shown in the report. For example, the timespan of events summarized in a report can start in April and end in May. The report itself can be requested in August. If the `endTime` is not specified, the report returns all activities from the `startTime` until the current time or the most recent 180 days if the `startTime` is more than 180 days in the past.", 1687 // "location": "query", 1688 // "pattern": "(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d):(\\d\\d)(?:\\.(\\d+))?(?:(Z)|([-+])(\\d\\d):(\\d\\d))", 1689 // "type": "string" 1690 // }, 1691 // "eventName": { 1692 // "description": "The name of the event being queried by the API. Each `eventName` is related to a specific Google Workspace service or feature which the API organizes into types of events. An example is the Google Calendar events in the Admin console application's reports. The Calendar Settings `type` structure has all of the Calendar `eventName` activities reported by the API. When an administrator changes a Calendar setting, the API reports this activity in the Calendar Settings `type` and `eventName` parameters. For more information about `eventName` query strings and parameters, see the list of event names for various applications above in `applicationName`.", 1693 // "location": "query", 1694 // "type": "string" 1695 // }, 1696 // "filters": { 1697 // "description": "The `filters` query string is a comma-separated list. The list is composed of event parameters that are manipulated by relational operators. Event parameters are in the form `parameter1 name[parameter1 value],parameter2 name[parameter2 value],...` These event parameters are associated with a specific `eventName`. An empty report is returned if the filtered request's parameter does not belong to the `eventName`. For more information about `eventName` parameters, see the list of event names for various applications above in `applicationName`. In the following Admin Activity example, the \u003c\u003e operator is URL-encoded in the request's query string (%3C%3E): GET...\u0026eventName=CHANGE_CALENDAR_SETTING \u0026filters=NEW_VALUE%3C%3EREAD_ONLY_ACCESS In the following Drive example, the list can be a view or edit event's `doc_id` parameter with a value that is manipulated by an 'equal to' (==) or 'not equal to' (\u003c\u003e) relational operator. In the first example, the report returns each edited document's `doc_id`. In the second example, the report returns each viewed document's `doc_id` that equals the value 12345 and does not return any viewed document's which have a `doc_id` value of 98765. The \u003c\u003e operator is URL-encoded in the request's query string (%3C%3E): GET...\u0026eventName=edit\u0026filters=doc_id GET...\u0026eventName=view\u0026filters=doc_id==12345,doc_id%3C%3E98765 The relational operators include: - `==` - 'equal to'. - `\u003c\u003e` - 'not equal to'. It is URL-encoded (%3C%3E). - `\u003c` - 'less than'. It is URL-encoded (%3C). - `\u003c=` - 'less than or equal to'. It is URL-encoded (%3C=). - `\u003e` - 'greater than'. It is URL-encoded (%3E). - `\u003e=` - 'greater than or equal to'. It is URL-encoded (%3E=). *Note:* The API doesn't accept multiple values of a parameter. If a particular parameter is supplied more than once in the API request, the API only accepts the last value of that request parameter. In addition, if an invalid request parameter is supplied in the API request, the API ignores that request parameter and returns the response corresponding to the remaining valid request parameters. If no parameters are requested, all parameters are returned. ", 1698 // "location": "query", 1699 // "pattern": "(.+[\u003c,\u003c=,==,\u003e=,\u003e,\u003c\u003e].+,)*(.+[\u003c,\u003c=,==,\u003e=,\u003e,\u003c\u003e].+)", 1700 // "type": "string" 1701 // }, 1702 // "groupIdFilter": { 1703 // "description": "Comma separated group ids (obfuscated) on which user activities are filtered, i.e, the response will contain activities for only those users that are a part of at least one of the group ids mentioned here. Format: \"id:abc123,id:xyz456\"", 1704 // "location": "query", 1705 // "pattern": "(id:[a-z0-9]+(,id:[a-z0-9]+)*)", 1706 // "type": "string" 1707 // }, 1708 // "maxResults": { 1709 // "default": "1000", 1710 // "description": "Determines how many activity records are shown on each response page. For example, if the request sets `maxResults=1` and the report has two activities, the report has two pages. The response's `nextPageToken` property has the token to the second page. The `maxResults` query string is optional in the request. The default value is 1000.", 1711 // "format": "int32", 1712 // "location": "query", 1713 // "maximum": "1000", 1714 // "minimum": "1", 1715 // "type": "integer" 1716 // }, 1717 // "orgUnitID": { 1718 // "default": "", 1719 // "description": "ID of the organizational unit to report on. Activity records will be shown only for users who belong to the specified organizational unit. Data before Dec 17, 2018 doesn't appear in the filtered results.", 1720 // "location": "query", 1721 // "pattern": "(id:[a-z0-9]+)", 1722 // "type": "string" 1723 // }, 1724 // "pageToken": { 1725 // "description": "The token to specify next page. A report with multiple pages has a `nextPageToken` property in the response. In your follow-on request getting the next page of the report, enter the `nextPageToken` value in the `pageToken` query string.", 1726 // "location": "query", 1727 // "type": "string" 1728 // }, 1729 // "startTime": { 1730 // "description": "Sets the beginning of the range of time shown in the report. The date is in the RFC 3339 format, for example 2010-10-28T10:26:35.000Z. The report returns all activities from `startTime` until `endTime`. The `startTime` must be before the `endTime` (if specified) and the current time when the request is made, or the API returns an error.", 1731 // "location": "query", 1732 // "pattern": "(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d):(\\d\\d)(?:\\.(\\d+))?(?:(Z)|([-+])(\\d\\d):(\\d\\d))", 1733 // "type": "string" 1734 // }, 1735 // "userKey": { 1736 // "description": "Represents the profile ID or the user email for which the data should be filtered. Can be `all` for all information, or `userKey` for a user's unique Google Workspace profile ID or their primary email address.", 1737 // "location": "path", 1738 // "required": true, 1739 // "type": "string" 1740 // } 1741 // }, 1742 // "path": "admin/reports/v1/activity/users/{userKey}/applications/{applicationName}/watch", 1743 // "request": { 1744 // "$ref": "Channel" 1745 // }, 1746 // "response": { 1747 // "$ref": "Channel" 1748 // }, 1749 // "scopes": [ 1750 // "https://www.googleapis.com/auth/admin.reports.audit.readonly" 1751 // ] 1752 // } 1753 1754} 1755 1756// method id "admin.channels.stop": 1757 1758type ChannelsStopCall struct { 1759 s *Service 1760 channel *Channel 1761 urlParams_ gensupport.URLParams 1762 ctx_ context.Context 1763 header_ http.Header 1764} 1765 1766// Stop: Stop watching resources through this channel. 1767func (r *ChannelsService) Stop(channel *Channel) *ChannelsStopCall { 1768 c := &ChannelsStopCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1769 c.channel = channel 1770 return c 1771} 1772 1773// Fields allows partial responses to be retrieved. See 1774// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1775// for more information. 1776func (c *ChannelsStopCall) Fields(s ...googleapi.Field) *ChannelsStopCall { 1777 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1778 return c 1779} 1780 1781// Context sets the context to be used in this call's Do method. Any 1782// pending HTTP request will be aborted if the provided context is 1783// canceled. 1784func (c *ChannelsStopCall) Context(ctx context.Context) *ChannelsStopCall { 1785 c.ctx_ = ctx 1786 return c 1787} 1788 1789// Header returns an http.Header that can be modified by the caller to 1790// add HTTP headers to the request. 1791func (c *ChannelsStopCall) Header() http.Header { 1792 if c.header_ == nil { 1793 c.header_ = make(http.Header) 1794 } 1795 return c.header_ 1796} 1797 1798func (c *ChannelsStopCall) doRequest(alt string) (*http.Response, error) { 1799 reqHeaders := make(http.Header) 1800 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 1801 for k, v := range c.header_ { 1802 reqHeaders[k] = v 1803 } 1804 reqHeaders.Set("User-Agent", c.s.userAgent()) 1805 var body io.Reader = nil 1806 body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel) 1807 if err != nil { 1808 return nil, err 1809 } 1810 reqHeaders.Set("Content-Type", "application/json") 1811 c.urlParams_.Set("alt", alt) 1812 c.urlParams_.Set("prettyPrint", "false") 1813 urls := googleapi.ResolveRelative(c.s.BasePath, "admin/reports_v1/channels/stop") 1814 urls += "?" + c.urlParams_.Encode() 1815 req, err := http.NewRequest("POST", urls, body) 1816 if err != nil { 1817 return nil, err 1818 } 1819 req.Header = reqHeaders 1820 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1821} 1822 1823// Do executes the "admin.channels.stop" call. 1824func (c *ChannelsStopCall) Do(opts ...googleapi.CallOption) error { 1825 gensupport.SetOptions(c.urlParams_, opts...) 1826 res, err := c.doRequest("json") 1827 if err != nil { 1828 return err 1829 } 1830 defer googleapi.CloseBody(res) 1831 if err := googleapi.CheckResponse(res); err != nil { 1832 return err 1833 } 1834 return nil 1835 // { 1836 // "description": "Stop watching resources through this channel.", 1837 // "flatPath": "admin/reports_v1/channels/stop", 1838 // "httpMethod": "POST", 1839 // "id": "admin.channels.stop", 1840 // "parameterOrder": [], 1841 // "parameters": {}, 1842 // "path": "admin/reports_v1/channels/stop", 1843 // "request": { 1844 // "$ref": "Channel" 1845 // }, 1846 // "scopes": [ 1847 // "https://www.googleapis.com/auth/admin.reports.audit.readonly" 1848 // ] 1849 // } 1850 1851} 1852 1853// method id "reports.customerUsageReports.get": 1854 1855type CustomerUsageReportsGetCall struct { 1856 s *Service 1857 date string 1858 urlParams_ gensupport.URLParams 1859 ifNoneMatch_ string 1860 ctx_ context.Context 1861 header_ http.Header 1862} 1863 1864// Get: Retrieves a report which is a collection of properties and 1865// statistics for a specific customer's account. For more information, 1866// see the Customers Usage Report guide. For more information about the 1867// customer report's parameters, see the Customers Usage parameters 1868// reference guides. 1869// 1870// - date: Represents the date the usage occurred. The timestamp is in 1871// the ISO 8601 format, yyyy-mm-dd. We recommend you use your 1872// account's time zone for this. 1873func (r *CustomerUsageReportsService) Get(date string) *CustomerUsageReportsGetCall { 1874 c := &CustomerUsageReportsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1875 c.date = date 1876 return c 1877} 1878 1879// CustomerId sets the optional parameter "customerId": The unique ID of 1880// the customer to retrieve data for. 1881func (c *CustomerUsageReportsGetCall) CustomerId(customerId string) *CustomerUsageReportsGetCall { 1882 c.urlParams_.Set("customerId", customerId) 1883 return c 1884} 1885 1886// PageToken sets the optional parameter "pageToken": Token to specify 1887// next page. A report with multiple pages has a `nextPageToken` 1888// property in the response. For your follow-on requests getting all of 1889// the report's pages, enter the `nextPageToken` value in the 1890// `pageToken` query string. 1891func (c *CustomerUsageReportsGetCall) PageToken(pageToken string) *CustomerUsageReportsGetCall { 1892 c.urlParams_.Set("pageToken", pageToken) 1893 return c 1894} 1895 1896// Parameters sets the optional parameter "parameters": The `parameters` 1897// query string is a comma-separated list of event parameters that 1898// refine a report's results. The parameter is associated with a 1899// specific application. The application values for the Customers usage 1900// report include `accounts`, `app_maker`, `apps_scripts`, `calendar`, 1901// `classroom`, `cros`, `docs`, `gmail`, `gplus`, `device_management`, 1902// `meet`, and `sites`. A `parameters` query string is in the CSV form 1903// of `app_name1:param_name1, app_name2:param_name2`. *Note:* The API 1904// doesn't accept multiple values of a parameter. If a particular 1905// parameter is supplied more than once in the API request, the API only 1906// accepts the last value of that request parameter. In addition, if an 1907// invalid request parameter is supplied in the API request, the API 1908// ignores that request parameter and returns the response corresponding 1909// to the remaining valid request parameters. An example of an invalid 1910// request parameter is one that does not belong to the application. If 1911// no parameters are requested, all parameters are returned. 1912func (c *CustomerUsageReportsGetCall) Parameters(parameters string) *CustomerUsageReportsGetCall { 1913 c.urlParams_.Set("parameters", parameters) 1914 return c 1915} 1916 1917// Fields allows partial responses to be retrieved. See 1918// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1919// for more information. 1920func (c *CustomerUsageReportsGetCall) Fields(s ...googleapi.Field) *CustomerUsageReportsGetCall { 1921 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1922 return c 1923} 1924 1925// IfNoneMatch sets the optional parameter which makes the operation 1926// fail if the object's ETag matches the given value. This is useful for 1927// getting updates only after the object has changed since the last 1928// request. Use googleapi.IsNotModified to check whether the response 1929// error from Do is the result of In-None-Match. 1930func (c *CustomerUsageReportsGetCall) IfNoneMatch(entityTag string) *CustomerUsageReportsGetCall { 1931 c.ifNoneMatch_ = entityTag 1932 return c 1933} 1934 1935// Context sets the context to be used in this call's Do method. Any 1936// pending HTTP request will be aborted if the provided context is 1937// canceled. 1938func (c *CustomerUsageReportsGetCall) Context(ctx context.Context) *CustomerUsageReportsGetCall { 1939 c.ctx_ = ctx 1940 return c 1941} 1942 1943// Header returns an http.Header that can be modified by the caller to 1944// add HTTP headers to the request. 1945func (c *CustomerUsageReportsGetCall) Header() http.Header { 1946 if c.header_ == nil { 1947 c.header_ = make(http.Header) 1948 } 1949 return c.header_ 1950} 1951 1952func (c *CustomerUsageReportsGetCall) doRequest(alt string) (*http.Response, error) { 1953 reqHeaders := make(http.Header) 1954 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 1955 for k, v := range c.header_ { 1956 reqHeaders[k] = v 1957 } 1958 reqHeaders.Set("User-Agent", c.s.userAgent()) 1959 if c.ifNoneMatch_ != "" { 1960 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1961 } 1962 var body io.Reader = nil 1963 c.urlParams_.Set("alt", alt) 1964 c.urlParams_.Set("prettyPrint", "false") 1965 urls := googleapi.ResolveRelative(c.s.BasePath, "admin/reports/v1/usage/dates/{date}") 1966 urls += "?" + c.urlParams_.Encode() 1967 req, err := http.NewRequest("GET", urls, body) 1968 if err != nil { 1969 return nil, err 1970 } 1971 req.Header = reqHeaders 1972 googleapi.Expand(req.URL, map[string]string{ 1973 "date": c.date, 1974 }) 1975 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1976} 1977 1978// Do executes the "reports.customerUsageReports.get" call. 1979// Exactly one of *UsageReports or error will be non-nil. Any non-2xx 1980// status code is an error. Response headers are in either 1981// *UsageReports.ServerResponse.Header or (if a response was returned at 1982// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1983// to check whether the returned error was because 1984// http.StatusNotModified was returned. 1985func (c *CustomerUsageReportsGetCall) Do(opts ...googleapi.CallOption) (*UsageReports, error) { 1986 gensupport.SetOptions(c.urlParams_, opts...) 1987 res, err := c.doRequest("json") 1988 if res != nil && res.StatusCode == http.StatusNotModified { 1989 if res.Body != nil { 1990 res.Body.Close() 1991 } 1992 return nil, &googleapi.Error{ 1993 Code: res.StatusCode, 1994 Header: res.Header, 1995 } 1996 } 1997 if err != nil { 1998 return nil, err 1999 } 2000 defer googleapi.CloseBody(res) 2001 if err := googleapi.CheckResponse(res); err != nil { 2002 return nil, err 2003 } 2004 ret := &UsageReports{ 2005 ServerResponse: googleapi.ServerResponse{ 2006 Header: res.Header, 2007 HTTPStatusCode: res.StatusCode, 2008 }, 2009 } 2010 target := &ret 2011 if err := gensupport.DecodeResponse(target, res); err != nil { 2012 return nil, err 2013 } 2014 return ret, nil 2015 // { 2016 // "description": "Retrieves a report which is a collection of properties and statistics for a specific customer's account. For more information, see the Customers Usage Report guide. For more information about the customer report's parameters, see the Customers Usage parameters reference guides. ", 2017 // "flatPath": "admin/reports/v1/usage/dates/{date}", 2018 // "httpMethod": "GET", 2019 // "id": "reports.customerUsageReports.get", 2020 // "parameterOrder": [ 2021 // "date" 2022 // ], 2023 // "parameters": { 2024 // "customerId": { 2025 // "description": "The unique ID of the customer to retrieve data for.", 2026 // "location": "query", 2027 // "pattern": "C.+|my_customer", 2028 // "type": "string" 2029 // }, 2030 // "date": { 2031 // "description": "Represents the date the usage occurred. The timestamp is in the ISO 8601 format, yyyy-mm-dd. We recommend you use your account's time zone for this.", 2032 // "location": "path", 2033 // "pattern": "(\\d){4}-(\\d){2}-(\\d){2}", 2034 // "required": true, 2035 // "type": "string" 2036 // }, 2037 // "pageToken": { 2038 // "description": "Token to specify next page. A report with multiple pages has a `nextPageToken` property in the response. For your follow-on requests getting all of the report's pages, enter the `nextPageToken` value in the `pageToken` query string.", 2039 // "location": "query", 2040 // "type": "string" 2041 // }, 2042 // "parameters": { 2043 // "description": "The `parameters` query string is a comma-separated list of event parameters that refine a report's results. The parameter is associated with a specific application. The application values for the Customers usage report include `accounts`, `app_maker`, `apps_scripts`, `calendar`, `classroom`, `cros`, `docs`, `gmail`, `gplus`, `device_management`, `meet`, and `sites`. A `parameters` query string is in the CSV form of `app_name1:param_name1, app_name2:param_name2`. *Note:* The API doesn't accept multiple values of a parameter. If a particular parameter is supplied more than once in the API request, the API only accepts the last value of that request parameter. In addition, if an invalid request parameter is supplied in the API request, the API ignores that request parameter and returns the response corresponding to the remaining valid request parameters. An example of an invalid request parameter is one that does not belong to the application. If no parameters are requested, all parameters are returned. ", 2044 // "location": "query", 2045 // "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)):[^,]+)", 2046 // "type": "string" 2047 // } 2048 // }, 2049 // "path": "admin/reports/v1/usage/dates/{date}", 2050 // "response": { 2051 // "$ref": "UsageReports" 2052 // }, 2053 // "scopes": [ 2054 // "https://www.googleapis.com/auth/admin.reports.usage.readonly" 2055 // ] 2056 // } 2057 2058} 2059 2060// Pages invokes f for each page of results. 2061// A non-nil error returned from f will halt the iteration. 2062// The provided context supersedes any context provided to the Context method. 2063func (c *CustomerUsageReportsGetCall) Pages(ctx context.Context, f func(*UsageReports) error) error { 2064 c.ctx_ = ctx 2065 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2066 for { 2067 x, err := c.Do() 2068 if err != nil { 2069 return err 2070 } 2071 if err := f(x); err != nil { 2072 return err 2073 } 2074 if x.NextPageToken == "" { 2075 return nil 2076 } 2077 c.PageToken(x.NextPageToken) 2078 } 2079} 2080 2081// method id "reports.entityUsageReports.get": 2082 2083type EntityUsageReportsGetCall struct { 2084 s *Service 2085 entityType string 2086 entityKey string 2087 date string 2088 urlParams_ gensupport.URLParams 2089 ifNoneMatch_ string 2090 ctx_ context.Context 2091 header_ http.Header 2092} 2093 2094// Get: Retrieves a report which is a collection of properties and 2095// statistics for entities used by users within the account. For more 2096// information, see the Entities Usage Report guide. For more 2097// information about the entities report's parameters, see the Entities 2098// Usage parameters reference guides. 2099// 2100// - date: Represents the date the usage occurred. The timestamp is in 2101// the ISO 8601 format, yyyy-mm-dd. We recommend you use your 2102// account's time zone for this. 2103// - entityKey: Represents the key of the object to filter the data 2104// with. 2105// - entityType: Represents the type of entity for the report. 2106func (r *EntityUsageReportsService) Get(entityType string, entityKey string, date string) *EntityUsageReportsGetCall { 2107 c := &EntityUsageReportsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2108 c.entityType = entityType 2109 c.entityKey = entityKey 2110 c.date = date 2111 return c 2112} 2113 2114// CustomerId sets the optional parameter "customerId": The unique ID of 2115// the customer to retrieve data for. 2116func (c *EntityUsageReportsGetCall) CustomerId(customerId string) *EntityUsageReportsGetCall { 2117 c.urlParams_.Set("customerId", customerId) 2118 return c 2119} 2120 2121// Filters sets the optional parameter "filters": The `filters` query 2122// string is a comma-separated list of an application's event parameters 2123// where the parameter's value is manipulated by a relational operator. 2124// The `filters` query string includes the name of the application whose 2125// usage is returned in the report. The application values for the 2126// Entities usage report include `accounts`, `docs`, and `gmail`. 2127// Filters are in the form `[application name]:parameter name[parameter 2128// value],...`. In this example, the `<>` 'not equal to' operator is 2129// URL-encoded in the request's query string (%3C%3E): GET 2130// https://www.googleapis.com/admin/reports/v1/usage/gplus_communities/all/dates/2017-12-01 2131// ?parameters=gplus:community_name,gplus:num_total_members 2132// &filters=gplus:num_total_members%3C%3E0 The relational operators 2133// include: - `==` - 'equal to'. - `<>` - 'not equal to'. It is 2134// URL-encoded (%3C%3E). - `<` - 'less than'. It is URL-encoded (%3C). - 2135// `<=` - 'less than or equal to'. It is URL-encoded (%3C=). - `>` - 2136// 'greater than'. It is URL-encoded (%3E). - `>=` - 'greater than or 2137// equal to'. It is URL-encoded (%3E=). Filters can only be applied to 2138// numeric parameters. 2139func (c *EntityUsageReportsGetCall) Filters(filters string) *EntityUsageReportsGetCall { 2140 c.urlParams_.Set("filters", filters) 2141 return c 2142} 2143 2144// MaxResults sets the optional parameter "maxResults": Determines how 2145// many activity records are shown on each response page. For example, 2146// if the request sets `maxResults=1` and the report has two activities, 2147// the report has two pages. The response's `nextPageToken` property has 2148// the token to the second page. 2149func (c *EntityUsageReportsGetCall) MaxResults(maxResults int64) *EntityUsageReportsGetCall { 2150 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 2151 return c 2152} 2153 2154// PageToken sets the optional parameter "pageToken": Token to specify 2155// next page. A report with multiple pages has a `nextPageToken` 2156// property in the response. In your follow-on request getting the next 2157// page of the report, enter the `nextPageToken` value in the 2158// `pageToken` query string. 2159func (c *EntityUsageReportsGetCall) PageToken(pageToken string) *EntityUsageReportsGetCall { 2160 c.urlParams_.Set("pageToken", pageToken) 2161 return c 2162} 2163 2164// Parameters sets the optional parameter "parameters": The `parameters` 2165// query string is a comma-separated list of event parameters that 2166// refine a report's results. The parameter is associated with a 2167// specific application. The application values for the Entities usage 2168// report are only `gplus`. A `parameter` query string is in the CSV 2169// form of `[app_name1:param_name1], [app_name2:param_name2]...`. 2170// *Note:* The API doesn't accept multiple values of a parameter. If a 2171// particular parameter is supplied more than once in the API request, 2172// the API only accepts the last value of that request parameter. In 2173// addition, if an invalid request parameter is supplied in the API 2174// request, the API ignores that request parameter and returns the 2175// response corresponding to the remaining valid request parameters. An 2176// example of an invalid request parameter is one that does not belong 2177// to the application. If no parameters are requested, all parameters 2178// are returned. 2179func (c *EntityUsageReportsGetCall) Parameters(parameters string) *EntityUsageReportsGetCall { 2180 c.urlParams_.Set("parameters", parameters) 2181 return c 2182} 2183 2184// Fields allows partial responses to be retrieved. See 2185// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2186// for more information. 2187func (c *EntityUsageReportsGetCall) Fields(s ...googleapi.Field) *EntityUsageReportsGetCall { 2188 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2189 return c 2190} 2191 2192// IfNoneMatch sets the optional parameter which makes the operation 2193// fail if the object's ETag matches the given value. This is useful for 2194// getting updates only after the object has changed since the last 2195// request. Use googleapi.IsNotModified to check whether the response 2196// error from Do is the result of In-None-Match. 2197func (c *EntityUsageReportsGetCall) IfNoneMatch(entityTag string) *EntityUsageReportsGetCall { 2198 c.ifNoneMatch_ = entityTag 2199 return c 2200} 2201 2202// Context sets the context to be used in this call's Do method. Any 2203// pending HTTP request will be aborted if the provided context is 2204// canceled. 2205func (c *EntityUsageReportsGetCall) Context(ctx context.Context) *EntityUsageReportsGetCall { 2206 c.ctx_ = ctx 2207 return c 2208} 2209 2210// Header returns an http.Header that can be modified by the caller to 2211// add HTTP headers to the request. 2212func (c *EntityUsageReportsGetCall) Header() http.Header { 2213 if c.header_ == nil { 2214 c.header_ = make(http.Header) 2215 } 2216 return c.header_ 2217} 2218 2219func (c *EntityUsageReportsGetCall) doRequest(alt string) (*http.Response, error) { 2220 reqHeaders := make(http.Header) 2221 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 2222 for k, v := range c.header_ { 2223 reqHeaders[k] = v 2224 } 2225 reqHeaders.Set("User-Agent", c.s.userAgent()) 2226 if c.ifNoneMatch_ != "" { 2227 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2228 } 2229 var body io.Reader = nil 2230 c.urlParams_.Set("alt", alt) 2231 c.urlParams_.Set("prettyPrint", "false") 2232 urls := googleapi.ResolveRelative(c.s.BasePath, "admin/reports/v1/usage/{entityType}/{entityKey}/dates/{date}") 2233 urls += "?" + c.urlParams_.Encode() 2234 req, err := http.NewRequest("GET", urls, body) 2235 if err != nil { 2236 return nil, err 2237 } 2238 req.Header = reqHeaders 2239 googleapi.Expand(req.URL, map[string]string{ 2240 "entityType": c.entityType, 2241 "entityKey": c.entityKey, 2242 "date": c.date, 2243 }) 2244 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2245} 2246 2247// Do executes the "reports.entityUsageReports.get" call. 2248// Exactly one of *UsageReports or error will be non-nil. Any non-2xx 2249// status code is an error. Response headers are in either 2250// *UsageReports.ServerResponse.Header or (if a response was returned at 2251// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2252// to check whether the returned error was because 2253// http.StatusNotModified was returned. 2254func (c *EntityUsageReportsGetCall) Do(opts ...googleapi.CallOption) (*UsageReports, error) { 2255 gensupport.SetOptions(c.urlParams_, opts...) 2256 res, err := c.doRequest("json") 2257 if res != nil && res.StatusCode == http.StatusNotModified { 2258 if res.Body != nil { 2259 res.Body.Close() 2260 } 2261 return nil, &googleapi.Error{ 2262 Code: res.StatusCode, 2263 Header: res.Header, 2264 } 2265 } 2266 if err != nil { 2267 return nil, err 2268 } 2269 defer googleapi.CloseBody(res) 2270 if err := googleapi.CheckResponse(res); err != nil { 2271 return nil, err 2272 } 2273 ret := &UsageReports{ 2274 ServerResponse: googleapi.ServerResponse{ 2275 Header: res.Header, 2276 HTTPStatusCode: res.StatusCode, 2277 }, 2278 } 2279 target := &ret 2280 if err := gensupport.DecodeResponse(target, res); err != nil { 2281 return nil, err 2282 } 2283 return ret, nil 2284 // { 2285 // "description": "Retrieves a report which is a collection of properties and statistics for entities used by users within the account. For more information, see the Entities Usage Report guide. For more information about the entities report's parameters, see the Entities Usage parameters reference guides.", 2286 // "flatPath": "admin/reports/v1/usage/{entityType}/{entityKey}/dates/{date}", 2287 // "httpMethod": "GET", 2288 // "id": "reports.entityUsageReports.get", 2289 // "parameterOrder": [ 2290 // "entityType", 2291 // "entityKey", 2292 // "date" 2293 // ], 2294 // "parameters": { 2295 // "customerId": { 2296 // "description": "The unique ID of the customer to retrieve data for.", 2297 // "location": "query", 2298 // "pattern": "C.+|my_customer", 2299 // "type": "string" 2300 // }, 2301 // "date": { 2302 // "description": "Represents the date the usage occurred. The timestamp is in the ISO 8601 format, yyyy-mm-dd. We recommend you use your account's time zone for this.", 2303 // "location": "path", 2304 // "pattern": "(\\d){4}-(\\d){2}-(\\d){2}", 2305 // "required": true, 2306 // "type": "string" 2307 // }, 2308 // "entityKey": { 2309 // "description": "Represents the key of the object to filter the data with.", 2310 // "enum": [ 2311 // "all", 2312 // "entityKey" 2313 // ], 2314 // "enumDescriptions": [ 2315 // "Returns activity events for all users.", 2316 // "Represents an app-specific identifier for the entity. For details on how to obtain the `entityKey` for a particular `entityType`, see the Entities Usage parameters reference guides." 2317 // ], 2318 // "location": "path", 2319 // "required": true, 2320 // "type": "string" 2321 // }, 2322 // "entityType": { 2323 // "description": "Represents the type of entity for the report.", 2324 // "enum": [ 2325 // "gplus_communities" 2326 // ], 2327 // "enumDescriptions": [ 2328 // "Returns a report on Google+ communities." 2329 // ], 2330 // "location": "path", 2331 // "pattern": "(gplus_communities)", 2332 // "required": true, 2333 // "type": "string" 2334 // }, 2335 // "filters": { 2336 // "description": "The `filters` query string is a comma-separated list of an application's event parameters where the parameter's value is manipulated by a relational operator. The `filters` query string includes the name of the application whose usage is returned in the report. The application values for the Entities usage report include `accounts`, `docs`, and `gmail`. Filters are in the form `[application name]:parameter name[parameter value],...`. In this example, the `\u003c\u003e` 'not equal to' operator is URL-encoded in the request's query string (%3C%3E): GET https://www.googleapis.com/admin/reports/v1/usage/gplus_communities/all/dates/2017-12-01 ?parameters=gplus:community_name,gplus:num_total_members \u0026filters=gplus:num_total_members%3C%3E0 The relational operators include: - `==` - 'equal to'. - `\u003c\u003e` - 'not equal to'. It is URL-encoded (%3C%3E). - `\u003c` - 'less than'. It is URL-encoded (%3C). - `\u003c=` - 'less than or equal to'. It is URL-encoded (%3C=). - `\u003e` - 'greater than'. It is URL-encoded (%3E). - `\u003e=` - 'greater than or equal to'. It is URL-encoded (%3E=). Filters can only be applied to numeric parameters.", 2337 // "location": "query", 2338 // "pattern": "(((gplus)):[a-z0-9_]+[\u003c,\u003c=,==,\u003e=,\u003e,!=][^,]+,)*(((gplus)):[a-z0-9_]+[\u003c,\u003c=,==,\u003e=,\u003e,!=][^,]+)", 2339 // "type": "string" 2340 // }, 2341 // "maxResults": { 2342 // "default": "1000", 2343 // "description": "Determines how many activity records are shown on each response page. For example, if the request sets `maxResults=1` and the report has two activities, the report has two pages. The response's `nextPageToken` property has the token to the second page.", 2344 // "format": "uint32", 2345 // "location": "query", 2346 // "maximum": "1000", 2347 // "minimum": "1", 2348 // "type": "integer" 2349 // }, 2350 // "pageToken": { 2351 // "description": "Token to specify next page. A report with multiple pages has a `nextPageToken` property in the response. In your follow-on request getting the next page of the report, enter the `nextPageToken` value in the `pageToken` query string.", 2352 // "location": "query", 2353 // "type": "string" 2354 // }, 2355 // "parameters": { 2356 // "description": "The `parameters` query string is a comma-separated list of event parameters that refine a report's results. The parameter is associated with a specific application. The application values for the Entities usage report are only `gplus`. A `parameter` query string is in the CSV form of `[app_name1:param_name1], [app_name2:param_name2]...`. *Note:* The API doesn't accept multiple values of a parameter. If a particular parameter is supplied more than once in the API request, the API only accepts the last value of that request parameter. In addition, if an invalid request parameter is supplied in the API request, the API ignores that request parameter and returns the response corresponding to the remaining valid request parameters. An example of an invalid request parameter is one that does not belong to the application. If no parameters are requested, all parameters are returned. ", 2357 // "location": "query", 2358 // "pattern": "(((gplus)):[^,]+,)*(((gplus)):[^,]+)", 2359 // "type": "string" 2360 // } 2361 // }, 2362 // "path": "admin/reports/v1/usage/{entityType}/{entityKey}/dates/{date}", 2363 // "response": { 2364 // "$ref": "UsageReports" 2365 // }, 2366 // "scopes": [ 2367 // "https://www.googleapis.com/auth/admin.reports.usage.readonly" 2368 // ] 2369 // } 2370 2371} 2372 2373// Pages invokes f for each page of results. 2374// A non-nil error returned from f will halt the iteration. 2375// The provided context supersedes any context provided to the Context method. 2376func (c *EntityUsageReportsGetCall) Pages(ctx context.Context, f func(*UsageReports) error) error { 2377 c.ctx_ = ctx 2378 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2379 for { 2380 x, err := c.Do() 2381 if err != nil { 2382 return err 2383 } 2384 if err := f(x); err != nil { 2385 return err 2386 } 2387 if x.NextPageToken == "" { 2388 return nil 2389 } 2390 c.PageToken(x.NextPageToken) 2391 } 2392} 2393 2394// method id "reports.userUsageReport.get": 2395 2396type UserUsageReportGetCall struct { 2397 s *Service 2398 userKey string 2399 date string 2400 urlParams_ gensupport.URLParams 2401 ifNoneMatch_ string 2402 ctx_ context.Context 2403 header_ http.Header 2404} 2405 2406// Get: Retrieves a report which is a collection of properties and 2407// statistics for a set of users with the account. For more information, 2408// see the User Usage Report guide. For more information about the user 2409// report's parameters, see the Users Usage parameters reference guides. 2410// 2411// - date: Represents the date the usage occurred. The timestamp is in 2412// the ISO 8601 format, yyyy-mm-dd. We recommend you use your 2413// account's time zone for this. 2414// - userKey: Represents the profile ID or the user email for which the 2415// data should be filtered. Can be `all` for all information, or 2416// `userKey` for a user's unique Google Workspace profile ID or their 2417// primary email address. 2418func (r *UserUsageReportService) Get(userKey string, date string) *UserUsageReportGetCall { 2419 c := &UserUsageReportGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2420 c.userKey = userKey 2421 c.date = date 2422 return c 2423} 2424 2425// CustomerId sets the optional parameter "customerId": The unique ID of 2426// the customer to retrieve data for. 2427func (c *UserUsageReportGetCall) CustomerId(customerId string) *UserUsageReportGetCall { 2428 c.urlParams_.Set("customerId", customerId) 2429 return c 2430} 2431 2432// Filters sets the optional parameter "filters": The `filters` query 2433// string is a comma-separated list of an application's event parameters 2434// where the parameter's value is manipulated by a relational operator. 2435// The `filters` query string includes the name of the application whose 2436// usage is returned in the report. The application values for the Users 2437// Usage Report include `accounts`, `docs`, and `gmail`. Filters are in 2438// the form `[application name]:parameter name[parameter value],...`. In 2439// this example, the `<>` 'not equal to' operator is URL-encoded in the 2440// request's query string (%3C%3E): GET 2441// https://www.googleapis.com/admin/reports/v1/usage/users/all/dates/2013-03-03 2442// ?parameters=accounts:last_login_time 2443// &filters=accounts:last_login_time%3C%3E2010-10-28T10:26:35.000Z The 2444// relational operators include: - `==` - 'equal to'. - `<>` - 'not 2445// equal to'. It is URL-encoded (%3C%3E). - `<` - 'less than'. It is 2446// URL-encoded (%3C). - `<=` - 'less than or equal to'. It is 2447// URL-encoded (%3C=). - `>` - 'greater than'. It is URL-encoded (%3E). 2448// - `>=` - 'greater than or equal to'. It is URL-encoded (%3E=). 2449func (c *UserUsageReportGetCall) Filters(filters string) *UserUsageReportGetCall { 2450 c.urlParams_.Set("filters", filters) 2451 return c 2452} 2453 2454// GroupIdFilter sets the optional parameter "groupIdFilter": Comma 2455// separated group ids (obfuscated) on which user activities are 2456// filtered, i.e, the response will contain activities for only those 2457// users that are a part of at least one of the group ids mentioned 2458// here. Format: "id:abc123,id:xyz456" 2459func (c *UserUsageReportGetCall) GroupIdFilter(groupIdFilter string) *UserUsageReportGetCall { 2460 c.urlParams_.Set("groupIdFilter", groupIdFilter) 2461 return c 2462} 2463 2464// MaxResults sets the optional parameter "maxResults": Determines how 2465// many activity records are shown on each response page. For example, 2466// if the request sets `maxResults=1` and the report has two activities, 2467// the report has two pages. The response's `nextPageToken` property has 2468// the token to the second page. The `maxResults` query string is 2469// optional. 2470func (c *UserUsageReportGetCall) MaxResults(maxResults int64) *UserUsageReportGetCall { 2471 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 2472 return c 2473} 2474 2475// OrgUnitID sets the optional parameter "orgUnitID": ID of the 2476// organizational unit to report on. User activity will be shown only 2477// for users who belong to the specified organizational unit. Data 2478// before Dec 17, 2018 doesn't appear in the filtered results. 2479func (c *UserUsageReportGetCall) OrgUnitID(orgUnitID string) *UserUsageReportGetCall { 2480 c.urlParams_.Set("orgUnitID", orgUnitID) 2481 return c 2482} 2483 2484// PageToken sets the optional parameter "pageToken": Token to specify 2485// next page. A report with multiple pages has a `nextPageToken` 2486// property in the response. In your follow-on request getting the next 2487// page of the report, enter the `nextPageToken` value in the 2488// `pageToken` query string. 2489func (c *UserUsageReportGetCall) PageToken(pageToken string) *UserUsageReportGetCall { 2490 c.urlParams_.Set("pageToken", pageToken) 2491 return c 2492} 2493 2494// Parameters sets the optional parameter "parameters": The `parameters` 2495// query string is a comma-separated list of event parameters that 2496// refine a report's results. The parameter is associated with a 2497// specific application. The application values for the Customers Usage 2498// report include `accounts`, `app_maker`, `apps_scripts`, `calendar`, 2499// `classroom`, `cros`, `docs`, `gmail`, `gplus`, `device_management`, 2500// `meet`, and `sites`. A `parameters` query string is in the CSV form 2501// of `app_name1:param_name1, app_name2:param_name2`. *Note:* The API 2502// doesn't accept multiple values of a parameter. If a particular 2503// parameter is supplied more than once in the API request, the API only 2504// accepts the last value of that request parameter. In addition, if an 2505// invalid request parameter is supplied in the API request, the API 2506// ignores that request parameter and returns the response corresponding 2507// to the remaining valid request parameters. An example of an invalid 2508// request parameter is one that does not belong to the application. If 2509// no parameters are requested, all parameters are returned. 2510func (c *UserUsageReportGetCall) Parameters(parameters string) *UserUsageReportGetCall { 2511 c.urlParams_.Set("parameters", parameters) 2512 return c 2513} 2514 2515// Fields allows partial responses to be retrieved. See 2516// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2517// for more information. 2518func (c *UserUsageReportGetCall) Fields(s ...googleapi.Field) *UserUsageReportGetCall { 2519 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2520 return c 2521} 2522 2523// IfNoneMatch sets the optional parameter which makes the operation 2524// fail if the object's ETag matches the given value. This is useful for 2525// getting updates only after the object has changed since the last 2526// request. Use googleapi.IsNotModified to check whether the response 2527// error from Do is the result of In-None-Match. 2528func (c *UserUsageReportGetCall) IfNoneMatch(entityTag string) *UserUsageReportGetCall { 2529 c.ifNoneMatch_ = entityTag 2530 return c 2531} 2532 2533// Context sets the context to be used in this call's Do method. Any 2534// pending HTTP request will be aborted if the provided context is 2535// canceled. 2536func (c *UserUsageReportGetCall) Context(ctx context.Context) *UserUsageReportGetCall { 2537 c.ctx_ = ctx 2538 return c 2539} 2540 2541// Header returns an http.Header that can be modified by the caller to 2542// add HTTP headers to the request. 2543func (c *UserUsageReportGetCall) Header() http.Header { 2544 if c.header_ == nil { 2545 c.header_ = make(http.Header) 2546 } 2547 return c.header_ 2548} 2549 2550func (c *UserUsageReportGetCall) doRequest(alt string) (*http.Response, error) { 2551 reqHeaders := make(http.Header) 2552 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 2553 for k, v := range c.header_ { 2554 reqHeaders[k] = v 2555 } 2556 reqHeaders.Set("User-Agent", c.s.userAgent()) 2557 if c.ifNoneMatch_ != "" { 2558 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2559 } 2560 var body io.Reader = nil 2561 c.urlParams_.Set("alt", alt) 2562 c.urlParams_.Set("prettyPrint", "false") 2563 urls := googleapi.ResolveRelative(c.s.BasePath, "admin/reports/v1/usage/users/{userKey}/dates/{date}") 2564 urls += "?" + c.urlParams_.Encode() 2565 req, err := http.NewRequest("GET", urls, body) 2566 if err != nil { 2567 return nil, err 2568 } 2569 req.Header = reqHeaders 2570 googleapi.Expand(req.URL, map[string]string{ 2571 "userKey": c.userKey, 2572 "date": c.date, 2573 }) 2574 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2575} 2576 2577// Do executes the "reports.userUsageReport.get" call. 2578// Exactly one of *UsageReports or error will be non-nil. Any non-2xx 2579// status code is an error. Response headers are in either 2580// *UsageReports.ServerResponse.Header or (if a response was returned at 2581// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2582// to check whether the returned error was because 2583// http.StatusNotModified was returned. 2584func (c *UserUsageReportGetCall) Do(opts ...googleapi.CallOption) (*UsageReports, error) { 2585 gensupport.SetOptions(c.urlParams_, opts...) 2586 res, err := c.doRequest("json") 2587 if res != nil && res.StatusCode == http.StatusNotModified { 2588 if res.Body != nil { 2589 res.Body.Close() 2590 } 2591 return nil, &googleapi.Error{ 2592 Code: res.StatusCode, 2593 Header: res.Header, 2594 } 2595 } 2596 if err != nil { 2597 return nil, err 2598 } 2599 defer googleapi.CloseBody(res) 2600 if err := googleapi.CheckResponse(res); err != nil { 2601 return nil, err 2602 } 2603 ret := &UsageReports{ 2604 ServerResponse: googleapi.ServerResponse{ 2605 Header: res.Header, 2606 HTTPStatusCode: res.StatusCode, 2607 }, 2608 } 2609 target := &ret 2610 if err := gensupport.DecodeResponse(target, res); err != nil { 2611 return nil, err 2612 } 2613 return ret, nil 2614 // { 2615 // "description": "Retrieves a report which is a collection of properties and statistics for a set of users with the account. For more information, see the User Usage Report guide. For more information about the user report's parameters, see the Users Usage parameters reference guides.", 2616 // "flatPath": "admin/reports/v1/usage/users/{userKey}/dates/{date}", 2617 // "httpMethod": "GET", 2618 // "id": "reports.userUsageReport.get", 2619 // "parameterOrder": [ 2620 // "userKey", 2621 // "date" 2622 // ], 2623 // "parameters": { 2624 // "customerId": { 2625 // "description": "The unique ID of the customer to retrieve data for.", 2626 // "location": "query", 2627 // "pattern": "C.+|my_customer", 2628 // "type": "string" 2629 // }, 2630 // "date": { 2631 // "description": "Represents the date the usage occurred. The timestamp is in the ISO 8601 format, yyyy-mm-dd. We recommend you use your account's time zone for this.", 2632 // "location": "path", 2633 // "pattern": "(\\d){4}-(\\d){2}-(\\d){2}", 2634 // "required": true, 2635 // "type": "string" 2636 // }, 2637 // "filters": { 2638 // "description": "The `filters` query string is a comma-separated list of an application's event parameters where the parameter's value is manipulated by a relational operator. The `filters` query string includes the name of the application whose usage is returned in the report. The application values for the Users Usage Report include `accounts`, `docs`, and `gmail`. Filters are in the form `[application name]:parameter name[parameter value],...`. In this example, the `\u003c\u003e` 'not equal to' operator is URL-encoded in the request's query string (%3C%3E): GET https://www.googleapis.com/admin/reports/v1/usage/users/all/dates/2013-03-03 ?parameters=accounts:last_login_time \u0026filters=accounts:last_login_time%3C%3E2010-10-28T10:26:35.000Z The relational operators include: - `==` - 'equal to'. - `\u003c\u003e` - 'not equal to'. It is URL-encoded (%3C%3E). - `\u003c` - 'less than'. It is URL-encoded (%3C). - `\u003c=` - 'less than or equal to'. It is URL-encoded (%3C=). - `\u003e` - 'greater than'. It is URL-encoded (%3E). - `\u003e=` - 'greater than or equal to'. It is URL-encoded (%3E=). ", 2639 // "location": "query", 2640 // "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,!=][^,]+)", 2641 // "type": "string" 2642 // }, 2643 // "groupIdFilter": { 2644 // "description": "Comma separated group ids (obfuscated) on which user activities are filtered, i.e, the response will contain activities for only those users that are a part of at least one of the group ids mentioned here. Format: \"id:abc123,id:xyz456\"", 2645 // "location": "query", 2646 // "pattern": "(id:[a-z0-9]+(,id:[a-z0-9]+)*)", 2647 // "type": "string" 2648 // }, 2649 // "maxResults": { 2650 // "default": "1000", 2651 // "description": "Determines how many activity records are shown on each response page. For example, if the request sets `maxResults=1` and the report has two activities, the report has two pages. The response's `nextPageToken` property has the token to the second page. The `maxResults` query string is optional.", 2652 // "format": "uint32", 2653 // "location": "query", 2654 // "maximum": "1000", 2655 // "minimum": "1", 2656 // "type": "integer" 2657 // }, 2658 // "orgUnitID": { 2659 // "default": "", 2660 // "description": "ID of the organizational unit to report on. User activity will be shown only for users who belong to the specified organizational unit. Data before Dec 17, 2018 doesn't appear in the filtered results.", 2661 // "location": "query", 2662 // "pattern": "(id:[a-z0-9]+)", 2663 // "type": "string" 2664 // }, 2665 // "pageToken": { 2666 // "description": "Token to specify next page. A report with multiple pages has a `nextPageToken` property in the response. In your follow-on request getting the next page of the report, enter the `nextPageToken` value in the `pageToken` query string.", 2667 // "location": "query", 2668 // "type": "string" 2669 // }, 2670 // "parameters": { 2671 // "description": "The `parameters` query string is a comma-separated list of event parameters that refine a report's results. The parameter is associated with a specific application. The application values for the Customers Usage report include `accounts`, `app_maker`, `apps_scripts`, `calendar`, `classroom`, `cros`, `docs`, `gmail`, `gplus`, `device_management`, `meet`, and `sites`. A `parameters` query string is in the CSV form of `app_name1:param_name1, app_name2:param_name2`. *Note:* The API doesn't accept multiple values of a parameter. If a particular parameter is supplied more than once in the API request, the API only accepts the last value of that request parameter. In addition, if an invalid request parameter is supplied in the API request, the API ignores that request parameter and returns the response corresponding to the remaining valid request parameters. An example of an invalid request parameter is one that does not belong to the application. If no parameters are requested, all parameters are returned. ", 2672 // "location": "query", 2673 // "pattern": "(((accounts)|(classroom)|(cros)|(gmail)|(calendar)|(docs)|(gplus)|(sites)|(device_management)|(drive)):[^,]+,)*(((accounts)|(classroom)|(cros)|(gmail)|(calendar)|(docs)|(gplus)|(sites)|(device_management)|(drive)):[^,]+)", 2674 // "type": "string" 2675 // }, 2676 // "userKey": { 2677 // "description": "Represents the profile ID or the user email for which the data should be filtered. Can be `all` for all information, or `userKey` for a user's unique Google Workspace profile ID or their primary email address.", 2678 // "location": "path", 2679 // "required": true, 2680 // "type": "string" 2681 // } 2682 // }, 2683 // "path": "admin/reports/v1/usage/users/{userKey}/dates/{date}", 2684 // "response": { 2685 // "$ref": "UsageReports" 2686 // }, 2687 // "scopes": [ 2688 // "https://www.googleapis.com/auth/admin.reports.usage.readonly" 2689 // ] 2690 // } 2691 2692} 2693 2694// Pages invokes f for each page of results. 2695// A non-nil error returned from f will halt the iteration. 2696// The provided context supersedes any context provided to the Context method. 2697func (c *UserUsageReportGetCall) Pages(ctx context.Context, f func(*UsageReports) error) error { 2698 c.ctx_ = ctx 2699 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2700 for { 2701 x, err := c.Do() 2702 if err != nil { 2703 return err 2704 } 2705 if err := f(x); err != nil { 2706 return err 2707 } 2708 if x.NextPageToken == "" { 2709 return nil 2710 } 2711 c.PageToken(x.NextPageToken) 2712 } 2713} 2714