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: https://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 or default values are omitted from API requests. However, any 227 // non-pointer, non-interface field appearing in ForceSendFields will be 228 // sent to the server regardless of whether the field is empty or not. 229 // This may be 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 or default values are omitted from API requests. However, any 281 // non-pointer, non-interface field appearing in ForceSendFields will be 282 // sent to the server regardless of whether the field is empty or not. 283 // This may be 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 or default values are omitted from API requests. However, any 322 // non-pointer, non-interface field appearing in ForceSendFields will be 323 // sent to the server regardless of whether the field is empty or not. 324 // This may be 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 or default values are omitted from API requests. However, any 371 // non-pointer, non-interface field appearing in ForceSendFields will be 372 // sent to the server regardless of whether the field is empty or not. 373 // This may be 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 or default values are omitted from API requests. However, any 422 // non-pointer, non-interface field appearing in ForceSendFields will be 423 // sent to the server regardless of whether the field is empty or not. 424 // This may be 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 or default values are omitted from API requests. However, any 454 // non-pointer, non-interface field appearing in ForceSendFields will be 455 // sent to the server regardless of whether the field is empty or not. 456 // This may be 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 or default values are omitted from API requests. However, any 481 // non-pointer, non-interface field appearing in ForceSendFields will be 482 // sent to the server regardless of whether the field is empty or not. 483 // This may be 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 or default values are omitted from API requests. However, any 522 // non-pointer, non-interface field appearing in ForceSendFields will be 523 // sent to the server regardless of whether the field is empty or not. 524 // This may be 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 or default values are omitted from API requests. However, any 590 // non-pointer, non-interface field appearing in ForceSendFields will be 591 // sent to the server regardless of whether the field is empty or not. 592 // This may be 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 or default values are omitted from API requests. However, any 637 // non-pointer, non-interface field appearing in ForceSendFields will be 638 // sent to the server regardless of whether the field is empty or not. 639 // This may be 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 or default values are omitted from API requests. However, any 681 // non-pointer, non-interface field appearing in ForceSendFields will be 682 // sent to the server regardless of whether the field is empty or not. 683 // This may be 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 or default values are omitted from API requests. However, any 727 // non-pointer, non-interface field appearing in ForceSendFields will be 728 // sent to the server regardless of whether the field is empty or not. 729 // This may be 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 or default values are omitted from API requests. However, any 771 // non-pointer, non-interface field appearing in ForceSendFields will be 772 // sent to the server regardless of whether the field is empty or not. 773 // This may be 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 or default values are omitted from API requests. However, any 818 // non-pointer, non-interface field appearing in ForceSendFields will be 819 // sent to the server regardless of whether the field is empty or not. 820 // This may be 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 or default values are omitted from API requests. However, any 857 // non-pointer, non-interface field appearing in ForceSendFields will be 858 // sent to the server regardless of whether the field is empty or not. 859 // This may be 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 or default values are omitted from API requests. However, any 889 // non-pointer, non-interface field appearing in ForceSendFields will be 890 // sent to the server regardless of whether the field is empty or not. 891 // This may be 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. Must not be a deleted user. For a deleted 934// user, call `users.list` in Directory API with `showDeleted=true`, 935// then use the returned `ID` as the `userKey`. 936func (r *ActivitiesService) List(userKey string, applicationName string) *ActivitiesListCall { 937 c := &ActivitiesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 938 c.userKey = userKey 939 c.applicationName = applicationName 940 return c 941} 942 943// ActorIpAddress sets the optional parameter "actorIpAddress": The 944// Internet Protocol (IP) Address of host where the event was performed. 945// This is an additional way to filter a report's summary using the IP 946// address of the user whose activity is being reported. This IP address 947// may or may not reflect the user's physical location. For example, the 948// IP address can be the user's proxy server's address or a virtual 949// private network (VPN) address. This parameter supports both IPv4 and 950// IPv6 address versions. 951func (c *ActivitiesListCall) ActorIpAddress(actorIpAddress string) *ActivitiesListCall { 952 c.urlParams_.Set("actorIpAddress", actorIpAddress) 953 return c 954} 955 956// CustomerId sets the optional parameter "customerId": The unique ID of 957// the customer to retrieve data for. 958func (c *ActivitiesListCall) CustomerId(customerId string) *ActivitiesListCall { 959 c.urlParams_.Set("customerId", customerId) 960 return c 961} 962 963// EndTime sets the optional parameter "endTime": Sets the end of the 964// range of time shown in the report. The date is in the RFC 3339 965// format, for example 2010-10-28T10:26:35.000Z. The default value is 966// the approximate time of the API request. An API report has three 967// basic time concepts: - *Date of the API's request for a report*: When 968// the API created and retrieved the report. - *Report's start time*: 969// The beginning of the timespan shown in the report. The `startTime` 970// must be before the `endTime` (if specified) and the current time when 971// the request is made, or the API returns an error. - *Report's end 972// time*: The end of the timespan shown in the report. For example, the 973// timespan of events summarized in a report can start in April and end 974// in May. The report itself can be requested in August. If the 975// `endTime` is not specified, the report returns all activities from 976// the `startTime` until the current time or the most recent 180 days if 977// the `startTime` is more than 180 days in the past. 978func (c *ActivitiesListCall) EndTime(endTime string) *ActivitiesListCall { 979 c.urlParams_.Set("endTime", endTime) 980 return c 981} 982 983// EventName sets the optional parameter "eventName": The name of the 984// event being queried by the API. Each `eventName` is related to a 985// specific Google Workspace service or feature which the API organizes 986// into types of events. An example is the Google Calendar events in the 987// Admin console application's reports. The Calendar Settings `type` 988// structure has all of the Calendar `eventName` activities reported by 989// the API. When an administrator changes a Calendar setting, the API 990// reports this activity in the Calendar Settings `type` and `eventName` 991// parameters. For more information about `eventName` query strings and 992// parameters, see the list of event names for various applications 993// above in `applicationName`. 994func (c *ActivitiesListCall) EventName(eventName string) *ActivitiesListCall { 995 c.urlParams_.Set("eventName", eventName) 996 return c 997} 998 999// Filters sets the optional parameter "filters": The `filters` query 1000// string is a comma-separated list. The list is composed of event 1001// parameters that are manipulated by relational operators. Event 1002// parameters are in the form `parameter1 name[parameter1 1003// value],parameter2 name[parameter2 value],...` These event parameters 1004// are associated with a specific `eventName`. An empty report is 1005// returned if the filtered request's parameter does not belong to the 1006// `eventName`. For more information about `eventName` parameters, see 1007// the list of event names for various applications above in 1008// `applicationName`. In the following Admin Activity example, the <> 1009// operator is URL-encoded in the request's query string (%3C%3E): 1010// GET...&eventName=CHANGE_CALENDAR_SETTING 1011// &filters=NEW_VALUE%3C%3EREAD_ONLY_ACCESS In the following Drive 1012// example, the list can be a view or edit event's `doc_id` parameter 1013// with a value that is manipulated by an 'equal to' (==) or 'not equal 1014// to' (<>) relational operator. In the first example, the report 1015// returns each edited document's `doc_id`. In the second example, the 1016// report returns each viewed document's `doc_id` that equals the value 1017// 12345 and does not return any viewed document's which have a `doc_id` 1018// value of 98765. The <> operator is URL-encoded in the request's query 1019// string (%3C%3E): GET...&eventName=edit&filters=doc_id 1020// GET...&eventName=view&filters=doc_id==12345,doc_id%3C%3E98765 The 1021// relational operators include: - `==` - 'equal to'. - `<>` - 'not 1022// equal to'. It is URL-encoded (%3C%3E). - `<` - 'less than'. It is 1023// URL-encoded (%3C). - `<=` - 'less than or equal to'. It is 1024// URL-encoded (%3C=). - `>` - 'greater than'. It is URL-encoded (%3E). 1025// - `>=` - 'greater than or equal to'. It is URL-encoded (%3E=). 1026// *Note:* The API doesn't accept multiple values of a parameter. If a 1027// particular parameter is supplied more than once in the API request, 1028// the API only accepts the last value of that request parameter. In 1029// addition, if an invalid request parameter is supplied in the API 1030// request, the API ignores that request parameter and returns the 1031// response corresponding to the remaining valid request parameters. If 1032// no parameters are requested, all parameters are returned. 1033func (c *ActivitiesListCall) Filters(filters string) *ActivitiesListCall { 1034 c.urlParams_.Set("filters", filters) 1035 return c 1036} 1037 1038// GroupIdFilter sets the optional parameter "groupIdFilter": Comma 1039// separated group ids (obfuscated) on which user activities are 1040// filtered, i.e. the response will contain activities for only those 1041// users that are a part of at least one of the group ids mentioned 1042// here. Format: "id:abc123,id:xyz456" 1043func (c *ActivitiesListCall) GroupIdFilter(groupIdFilter string) *ActivitiesListCall { 1044 c.urlParams_.Set("groupIdFilter", groupIdFilter) 1045 return c 1046} 1047 1048// MaxResults sets the optional parameter "maxResults": Determines how 1049// many activity records are shown on each response page. For example, 1050// if the request sets `maxResults=1` and the report has two activities, 1051// the report has two pages. The response's `nextPageToken` property has 1052// the token to the second page. The `maxResults` query string is 1053// optional in the request. The default value is 1000. 1054func (c *ActivitiesListCall) MaxResults(maxResults int64) *ActivitiesListCall { 1055 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 1056 return c 1057} 1058 1059// OrgUnitID sets the optional parameter "orgUnitID": ID of the 1060// organizational unit to report on. Activity records will be shown only 1061// for users who belong to the specified organizational unit. Data 1062// before Dec 17, 2018 doesn't appear in the filtered results. 1063func (c *ActivitiesListCall) OrgUnitID(orgUnitID string) *ActivitiesListCall { 1064 c.urlParams_.Set("orgUnitID", orgUnitID) 1065 return c 1066} 1067 1068// PageToken sets the optional parameter "pageToken": The token to 1069// specify next page. A report with multiple pages has a `nextPageToken` 1070// property in the response. In your follow-on request getting the next 1071// page of the report, enter the `nextPageToken` value in the 1072// `pageToken` query string. 1073func (c *ActivitiesListCall) PageToken(pageToken string) *ActivitiesListCall { 1074 c.urlParams_.Set("pageToken", pageToken) 1075 return c 1076} 1077 1078// StartTime sets the optional parameter "startTime": Sets the beginning 1079// of the range of time shown in the report. The date is in the RFC 3339 1080// format, for example 2010-10-28T10:26:35.000Z. The report returns all 1081// activities from `startTime` until `endTime`. The `startTime` must be 1082// before the `endTime` (if specified) and the current time when the 1083// request is made, or the API returns an error. 1084func (c *ActivitiesListCall) StartTime(startTime string) *ActivitiesListCall { 1085 c.urlParams_.Set("startTime", startTime) 1086 return c 1087} 1088 1089// Fields allows partial responses to be retrieved. See 1090// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1091// for more information. 1092func (c *ActivitiesListCall) Fields(s ...googleapi.Field) *ActivitiesListCall { 1093 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1094 return c 1095} 1096 1097// IfNoneMatch sets the optional parameter which makes the operation 1098// fail if the object's ETag matches the given value. This is useful for 1099// getting updates only after the object has changed since the last 1100// request. Use googleapi.IsNotModified to check whether the response 1101// error from Do is the result of In-None-Match. 1102func (c *ActivitiesListCall) IfNoneMatch(entityTag string) *ActivitiesListCall { 1103 c.ifNoneMatch_ = entityTag 1104 return c 1105} 1106 1107// Context sets the context to be used in this call's Do method. Any 1108// pending HTTP request will be aborted if the provided context is 1109// canceled. 1110func (c *ActivitiesListCall) Context(ctx context.Context) *ActivitiesListCall { 1111 c.ctx_ = ctx 1112 return c 1113} 1114 1115// Header returns an http.Header that can be modified by the caller to 1116// add HTTP headers to the request. 1117func (c *ActivitiesListCall) Header() http.Header { 1118 if c.header_ == nil { 1119 c.header_ = make(http.Header) 1120 } 1121 return c.header_ 1122} 1123 1124func (c *ActivitiesListCall) doRequest(alt string) (*http.Response, error) { 1125 reqHeaders := make(http.Header) 1126 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210830") 1127 for k, v := range c.header_ { 1128 reqHeaders[k] = v 1129 } 1130 reqHeaders.Set("User-Agent", c.s.userAgent()) 1131 if c.ifNoneMatch_ != "" { 1132 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1133 } 1134 var body io.Reader = nil 1135 c.urlParams_.Set("alt", alt) 1136 c.urlParams_.Set("prettyPrint", "false") 1137 urls := googleapi.ResolveRelative(c.s.BasePath, "admin/reports/v1/activity/users/{userKey}/applications/{applicationName}") 1138 urls += "?" + c.urlParams_.Encode() 1139 req, err := http.NewRequest("GET", urls, body) 1140 if err != nil { 1141 return nil, err 1142 } 1143 req.Header = reqHeaders 1144 googleapi.Expand(req.URL, map[string]string{ 1145 "userKey": c.userKey, 1146 "applicationName": c.applicationName, 1147 }) 1148 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1149} 1150 1151// Do executes the "reports.activities.list" call. 1152// Exactly one of *Activities or error will be non-nil. Any non-2xx 1153// status code is an error. Response headers are in either 1154// *Activities.ServerResponse.Header or (if a response was returned at 1155// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1156// to check whether the returned error was because 1157// http.StatusNotModified was returned. 1158func (c *ActivitiesListCall) Do(opts ...googleapi.CallOption) (*Activities, error) { 1159 gensupport.SetOptions(c.urlParams_, opts...) 1160 res, err := c.doRequest("json") 1161 if res != nil && res.StatusCode == http.StatusNotModified { 1162 if res.Body != nil { 1163 res.Body.Close() 1164 } 1165 return nil, &googleapi.Error{ 1166 Code: res.StatusCode, 1167 Header: res.Header, 1168 } 1169 } 1170 if err != nil { 1171 return nil, err 1172 } 1173 defer googleapi.CloseBody(res) 1174 if err := googleapi.CheckResponse(res); err != nil { 1175 return nil, err 1176 } 1177 ret := &Activities{ 1178 ServerResponse: googleapi.ServerResponse{ 1179 Header: res.Header, 1180 HTTPStatusCode: res.StatusCode, 1181 }, 1182 } 1183 target := &ret 1184 if err := gensupport.DecodeResponse(target, res); err != nil { 1185 return nil, err 1186 } 1187 return ret, nil 1188 // { 1189 // "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. ", 1190 // "flatPath": "admin/reports/v1/activity/users/{userKey}/applications/{applicationName}", 1191 // "httpMethod": "GET", 1192 // "id": "reports.activities.list", 1193 // "parameterOrder": [ 1194 // "userKey", 1195 // "applicationName" 1196 // ], 1197 // "parameters": { 1198 // "actorIpAddress": { 1199 // "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.", 1200 // "location": "query", 1201 // "type": "string" 1202 // }, 1203 // "applicationName": { 1204 // "description": "Application name for which the events are to be retrieved.", 1205 // "enum": [ 1206 // "access_transparency", 1207 // "admin", 1208 // "calendar", 1209 // "chat", 1210 // "drive", 1211 // "gcp", 1212 // "gplus", 1213 // "groups", 1214 // "groups_enterprise", 1215 // "jamboard", 1216 // "login", 1217 // "meet", 1218 // "mobile", 1219 // "rules", 1220 // "saml", 1221 // "token", 1222 // "user_accounts", 1223 // "context_aware_access", 1224 // "chrome", 1225 // "data_studio", 1226 // "keep" 1227 // ], 1228 // "enumDescriptions": [ 1229 // "The Google Workspace Access Transparency activity reports return information about different types of Access Transparency activity events.", 1230 // "The Admin console application's activity reports return account information about different types of administrator activity events.", 1231 // "The Google Calendar application's activity reports return information about various Calendar activity events.", 1232 // "The Chat activity reports return information about various Chat activity events.", 1233 // "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.", 1234 // "The Google Cloud Platform application's activity reports return information about various GCP activity events.", 1235 // "The Google+ application's activity reports return information about various Google+ activity events.", 1236 // "The Google Groups application's activity reports return information about various Groups activity events.", 1237 // "The Enterprise Groups activity reports return information about various Enterprise group activity events.", 1238 // "The Jamboard activity reports return information about various Jamboard activity events.", 1239 // "The Login application's activity reports return account information about different types of Login activity events.", 1240 // "The Meet Audit activity report return information about different types of Meet Audit activity events.", 1241 // "The Mobile Audit activity report return information about different types of Mobile Audit activity events.", 1242 // "The Rules activity report return information about different types of Rules activity events.", 1243 // "The SAML activity report return information about different types of SAML activity events.", 1244 // "The Token application's activity reports return account information about different types of Token activity events.", 1245 // "The User Accounts application's activity reports return account information about different types of User Accounts activity events.", 1246 // "The Context-aware access activity reports return information about users' access denied events due to Context-aware access rules.", 1247 // "The Chrome activity reports return information about unsafe events reported in the context of the WebProtect features of BeyondCorp.", 1248 // "The Data Studio activity reports return information about various types of Data Studio activity events.", 1249 // "The Keep application's activity reports return information about various Google Keep activity events. The Keep activity report is only available for Google Workspace Business and Enterprise customers." 1250 // ], 1251 // "location": "path", 1252 // "pattern": "(access_transparency)|(admin)|(calendar)|(chat)|(chrome)|(context_aware_access)|(data_studio)|(drive)|(gcp)|(gplus)|(groups)|(groups_enterprise)|(jamboard)|(keep)|(login)|(meet)|(mobile)|(rules)|(saml)|(token)|(user_accounts)", 1253 // "required": true, 1254 // "type": "string" 1255 // }, 1256 // "customerId": { 1257 // "description": "The unique ID of the customer to retrieve data for.", 1258 // "location": "query", 1259 // "pattern": "C.+|my_customer", 1260 // "type": "string" 1261 // }, 1262 // "endTime": { 1263 // "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.", 1264 // "location": "query", 1265 // "pattern": "(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d):(\\d\\d)(?:\\.(\\d+))?(?:(Z)|([-+])(\\d\\d):(\\d\\d))", 1266 // "type": "string" 1267 // }, 1268 // "eventName": { 1269 // "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`.", 1270 // "location": "query", 1271 // "type": "string" 1272 // }, 1273 // "filters": { 1274 // "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. ", 1275 // "location": "query", 1276 // "pattern": "(.+[\u003c,\u003c=,==,\u003e=,\u003e,\u003c\u003e].+,)*(.+[\u003c,\u003c=,==,\u003e=,\u003e,\u003c\u003e].+)", 1277 // "type": "string" 1278 // }, 1279 // "groupIdFilter": { 1280 // "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\"", 1281 // "location": "query", 1282 // "pattern": "(id:[a-z0-9]+(,id:[a-z0-9]+)*)", 1283 // "type": "string" 1284 // }, 1285 // "maxResults": { 1286 // "default": "1000", 1287 // "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.", 1288 // "format": "int32", 1289 // "location": "query", 1290 // "maximum": "1000", 1291 // "minimum": "1", 1292 // "type": "integer" 1293 // }, 1294 // "orgUnitID": { 1295 // "default": "", 1296 // "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.", 1297 // "location": "query", 1298 // "pattern": "(id:[a-z0-9]+)", 1299 // "type": "string" 1300 // }, 1301 // "pageToken": { 1302 // "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.", 1303 // "location": "query", 1304 // "type": "string" 1305 // }, 1306 // "startTime": { 1307 // "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.", 1308 // "location": "query", 1309 // "pattern": "(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d):(\\d\\d)(?:\\.(\\d+))?(?:(Z)|([-+])(\\d\\d):(\\d\\d))", 1310 // "type": "string" 1311 // }, 1312 // "userKey": { 1313 // "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. Must not be a deleted user. For a deleted user, call `users.list` in Directory API with `showDeleted=true`, then use the returned `ID` as the `userKey`.", 1314 // "location": "path", 1315 // "required": true, 1316 // "type": "string" 1317 // } 1318 // }, 1319 // "path": "admin/reports/v1/activity/users/{userKey}/applications/{applicationName}", 1320 // "response": { 1321 // "$ref": "Activities" 1322 // }, 1323 // "scopes": [ 1324 // "https://www.googleapis.com/auth/admin.reports.audit.readonly" 1325 // ] 1326 // } 1327 1328} 1329 1330// Pages invokes f for each page of results. 1331// A non-nil error returned from f will halt the iteration. 1332// The provided context supersedes any context provided to the Context method. 1333func (c *ActivitiesListCall) Pages(ctx context.Context, f func(*Activities) error) error { 1334 c.ctx_ = ctx 1335 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 1336 for { 1337 x, err := c.Do() 1338 if err != nil { 1339 return err 1340 } 1341 if err := f(x); err != nil { 1342 return err 1343 } 1344 if x.NextPageToken == "" { 1345 return nil 1346 } 1347 c.PageToken(x.NextPageToken) 1348 } 1349} 1350 1351// method id "reports.activities.watch": 1352 1353type ActivitiesWatchCall struct { 1354 s *Service 1355 userKey string 1356 applicationName string 1357 channel *Channel 1358 urlParams_ gensupport.URLParams 1359 ctx_ context.Context 1360 header_ http.Header 1361} 1362 1363// Watch: Start receiving notifications for account activities. For more 1364// information, see Receiving Push Notifications. 1365// 1366// - applicationName: Application name for which the events are to be 1367// retrieved. 1368// - userKey: Represents the profile ID or the user email for which the 1369// data should be filtered. Can be `all` for all information, or 1370// `userKey` for a user's unique Google Workspace profile ID or their 1371// primary email address. Must not be a deleted user. For a deleted 1372// user, call `users.list` in Directory API with `showDeleted=true`, 1373// then use the returned `ID` as the `userKey`. 1374func (r *ActivitiesService) Watch(userKey string, applicationName string, channel *Channel) *ActivitiesWatchCall { 1375 c := &ActivitiesWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1376 c.userKey = userKey 1377 c.applicationName = applicationName 1378 c.channel = channel 1379 return c 1380} 1381 1382// ActorIpAddress sets the optional parameter "actorIpAddress": The 1383// Internet Protocol (IP) Address of host where the event was performed. 1384// This is an additional way to filter a report's summary using the IP 1385// address of the user whose activity is being reported. This IP address 1386// may or may not reflect the user's physical location. For example, the 1387// IP address can be the user's proxy server's address or a virtual 1388// private network (VPN) address. This parameter supports both IPv4 and 1389// IPv6 address versions. 1390func (c *ActivitiesWatchCall) ActorIpAddress(actorIpAddress string) *ActivitiesWatchCall { 1391 c.urlParams_.Set("actorIpAddress", actorIpAddress) 1392 return c 1393} 1394 1395// CustomerId sets the optional parameter "customerId": The unique ID of 1396// the customer to retrieve data for. 1397func (c *ActivitiesWatchCall) CustomerId(customerId string) *ActivitiesWatchCall { 1398 c.urlParams_.Set("customerId", customerId) 1399 return c 1400} 1401 1402// EndTime sets the optional parameter "endTime": Sets the end of the 1403// range of time shown in the report. The date is in the RFC 3339 1404// format, for example 2010-10-28T10:26:35.000Z. The default value is 1405// the approximate time of the API request. An API report has three 1406// basic time concepts: - *Date of the API's request for a report*: When 1407// the API created and retrieved the report. - *Report's start time*: 1408// The beginning of the timespan shown in the report. The `startTime` 1409// must be before the `endTime` (if specified) and the current time when 1410// the request is made, or the API returns an error. - *Report's end 1411// time*: The end of the timespan shown in the report. For example, the 1412// timespan of events summarized in a report can start in April and end 1413// in May. The report itself can be requested in August. If the 1414// `endTime` is not specified, the report returns all activities from 1415// the `startTime` until the current time or the most recent 180 days if 1416// the `startTime` is more than 180 days in the past. 1417func (c *ActivitiesWatchCall) EndTime(endTime string) *ActivitiesWatchCall { 1418 c.urlParams_.Set("endTime", endTime) 1419 return c 1420} 1421 1422// EventName sets the optional parameter "eventName": The name of the 1423// event being queried by the API. Each `eventName` is related to a 1424// specific Google Workspace service or feature which the API organizes 1425// into types of events. An example is the Google Calendar events in the 1426// Admin console application's reports. The Calendar Settings `type` 1427// structure has all of the Calendar `eventName` activities reported by 1428// the API. When an administrator changes a Calendar setting, the API 1429// reports this activity in the Calendar Settings `type` and `eventName` 1430// parameters. For more information about `eventName` query strings and 1431// parameters, see the list of event names for various applications 1432// above in `applicationName`. 1433func (c *ActivitiesWatchCall) EventName(eventName string) *ActivitiesWatchCall { 1434 c.urlParams_.Set("eventName", eventName) 1435 return c 1436} 1437 1438// Filters sets the optional parameter "filters": The `filters` query 1439// string is a comma-separated list. The list is composed of event 1440// parameters that are manipulated by relational operators. Event 1441// parameters are in the form `parameter1 name[parameter1 1442// value],parameter2 name[parameter2 value],...` These event parameters 1443// are associated with a specific `eventName`. An empty report is 1444// returned if the filtered request's parameter does not belong to the 1445// `eventName`. For more information about `eventName` parameters, see 1446// the list of event names for various applications above in 1447// `applicationName`. In the following Admin Activity example, the <> 1448// operator is URL-encoded in the request's query string (%3C%3E): 1449// GET...&eventName=CHANGE_CALENDAR_SETTING 1450// &filters=NEW_VALUE%3C%3EREAD_ONLY_ACCESS In the following Drive 1451// example, the list can be a view or edit event's `doc_id` parameter 1452// with a value that is manipulated by an 'equal to' (==) or 'not equal 1453// to' (<>) relational operator. In the first example, the report 1454// returns each edited document's `doc_id`. In the second example, the 1455// report returns each viewed document's `doc_id` that equals the value 1456// 12345 and does not return any viewed document's which have a `doc_id` 1457// value of 98765. The <> operator is URL-encoded in the request's query 1458// string (%3C%3E): GET...&eventName=edit&filters=doc_id 1459// GET...&eventName=view&filters=doc_id==12345,doc_id%3C%3E98765 The 1460// relational operators include: - `==` - 'equal to'. - `<>` - 'not 1461// equal to'. It is URL-encoded (%3C%3E). - `<` - 'less than'. It is 1462// URL-encoded (%3C). - `<=` - 'less than or equal to'. It is 1463// URL-encoded (%3C=). - `>` - 'greater than'. It is URL-encoded (%3E). 1464// - `>=` - 'greater than or equal to'. It is URL-encoded (%3E=). 1465// *Note:* The API doesn't accept multiple values of a parameter. If a 1466// particular parameter is supplied more than once in the API request, 1467// the API only accepts the last value of that request parameter. In 1468// addition, if an invalid request parameter is supplied in the API 1469// request, the API ignores that request parameter and returns the 1470// response corresponding to the remaining valid request parameters. If 1471// no parameters are requested, all parameters are returned. 1472func (c *ActivitiesWatchCall) Filters(filters string) *ActivitiesWatchCall { 1473 c.urlParams_.Set("filters", filters) 1474 return c 1475} 1476 1477// GroupIdFilter sets the optional parameter "groupIdFilter": Comma 1478// separated group ids (obfuscated) on which user activities are 1479// filtered, i.e. the response will contain activities for only those 1480// users that are a part of at least one of the group ids mentioned 1481// here. Format: "id:abc123,id:xyz456" 1482func (c *ActivitiesWatchCall) GroupIdFilter(groupIdFilter string) *ActivitiesWatchCall { 1483 c.urlParams_.Set("groupIdFilter", groupIdFilter) 1484 return c 1485} 1486 1487// MaxResults sets the optional parameter "maxResults": Determines how 1488// many activity records are shown on each response page. For example, 1489// if the request sets `maxResults=1` and the report has two activities, 1490// the report has two pages. The response's `nextPageToken` property has 1491// the token to the second page. The `maxResults` query string is 1492// optional in the request. The default value is 1000. 1493func (c *ActivitiesWatchCall) MaxResults(maxResults int64) *ActivitiesWatchCall { 1494 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 1495 return c 1496} 1497 1498// OrgUnitID sets the optional parameter "orgUnitID": ID of the 1499// organizational unit to report on. Activity records will be shown only 1500// for users who belong to the specified organizational unit. Data 1501// before Dec 17, 2018 doesn't appear in the filtered results. 1502func (c *ActivitiesWatchCall) OrgUnitID(orgUnitID string) *ActivitiesWatchCall { 1503 c.urlParams_.Set("orgUnitID", orgUnitID) 1504 return c 1505} 1506 1507// PageToken sets the optional parameter "pageToken": The token to 1508// specify next page. A report with multiple pages has a `nextPageToken` 1509// property in the response. In your follow-on request getting the next 1510// page of the report, enter the `nextPageToken` value in the 1511// `pageToken` query string. 1512func (c *ActivitiesWatchCall) PageToken(pageToken string) *ActivitiesWatchCall { 1513 c.urlParams_.Set("pageToken", pageToken) 1514 return c 1515} 1516 1517// StartTime sets the optional parameter "startTime": Sets the beginning 1518// of the range of time shown in the report. The date is in the RFC 3339 1519// format, for example 2010-10-28T10:26:35.000Z. The report returns all 1520// activities from `startTime` until `endTime`. The `startTime` must be 1521// before the `endTime` (if specified) and the current time when the 1522// request is made, or the API returns an error. 1523func (c *ActivitiesWatchCall) StartTime(startTime string) *ActivitiesWatchCall { 1524 c.urlParams_.Set("startTime", startTime) 1525 return c 1526} 1527 1528// Fields allows partial responses to be retrieved. See 1529// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1530// for more information. 1531func (c *ActivitiesWatchCall) Fields(s ...googleapi.Field) *ActivitiesWatchCall { 1532 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1533 return c 1534} 1535 1536// Context sets the context to be used in this call's Do method. Any 1537// pending HTTP request will be aborted if the provided context is 1538// canceled. 1539func (c *ActivitiesWatchCall) Context(ctx context.Context) *ActivitiesWatchCall { 1540 c.ctx_ = ctx 1541 return c 1542} 1543 1544// Header returns an http.Header that can be modified by the caller to 1545// add HTTP headers to the request. 1546func (c *ActivitiesWatchCall) Header() http.Header { 1547 if c.header_ == nil { 1548 c.header_ = make(http.Header) 1549 } 1550 return c.header_ 1551} 1552 1553func (c *ActivitiesWatchCall) doRequest(alt string) (*http.Response, error) { 1554 reqHeaders := make(http.Header) 1555 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210830") 1556 for k, v := range c.header_ { 1557 reqHeaders[k] = v 1558 } 1559 reqHeaders.Set("User-Agent", c.s.userAgent()) 1560 var body io.Reader = nil 1561 body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel) 1562 if err != nil { 1563 return nil, err 1564 } 1565 reqHeaders.Set("Content-Type", "application/json") 1566 c.urlParams_.Set("alt", alt) 1567 c.urlParams_.Set("prettyPrint", "false") 1568 urls := googleapi.ResolveRelative(c.s.BasePath, "admin/reports/v1/activity/users/{userKey}/applications/{applicationName}/watch") 1569 urls += "?" + c.urlParams_.Encode() 1570 req, err := http.NewRequest("POST", urls, body) 1571 if err != nil { 1572 return nil, err 1573 } 1574 req.Header = reqHeaders 1575 googleapi.Expand(req.URL, map[string]string{ 1576 "userKey": c.userKey, 1577 "applicationName": c.applicationName, 1578 }) 1579 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1580} 1581 1582// Do executes the "reports.activities.watch" call. 1583// Exactly one of *Channel or error will be non-nil. Any non-2xx status 1584// code is an error. Response headers are in either 1585// *Channel.ServerResponse.Header or (if a response was returned at all) 1586// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1587// check whether the returned error was because http.StatusNotModified 1588// was returned. 1589func (c *ActivitiesWatchCall) Do(opts ...googleapi.CallOption) (*Channel, error) { 1590 gensupport.SetOptions(c.urlParams_, opts...) 1591 res, err := c.doRequest("json") 1592 if res != nil && res.StatusCode == http.StatusNotModified { 1593 if res.Body != nil { 1594 res.Body.Close() 1595 } 1596 return nil, &googleapi.Error{ 1597 Code: res.StatusCode, 1598 Header: res.Header, 1599 } 1600 } 1601 if err != nil { 1602 return nil, err 1603 } 1604 defer googleapi.CloseBody(res) 1605 if err := googleapi.CheckResponse(res); err != nil { 1606 return nil, err 1607 } 1608 ret := &Channel{ 1609 ServerResponse: googleapi.ServerResponse{ 1610 Header: res.Header, 1611 HTTPStatusCode: res.StatusCode, 1612 }, 1613 } 1614 target := &ret 1615 if err := gensupport.DecodeResponse(target, res); err != nil { 1616 return nil, err 1617 } 1618 return ret, nil 1619 // { 1620 // "description": "Start receiving notifications for account activities. For more information, see Receiving Push Notifications.", 1621 // "flatPath": "admin/reports/v1/activity/users/{userKey}/applications/{applicationName}/watch", 1622 // "httpMethod": "POST", 1623 // "id": "reports.activities.watch", 1624 // "parameterOrder": [ 1625 // "userKey", 1626 // "applicationName" 1627 // ], 1628 // "parameters": { 1629 // "actorIpAddress": { 1630 // "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.", 1631 // "location": "query", 1632 // "type": "string" 1633 // }, 1634 // "applicationName": { 1635 // "description": "Application name for which the events are to be retrieved.", 1636 // "enum": [ 1637 // "access_transparency", 1638 // "admin", 1639 // "calendar", 1640 // "chat", 1641 // "drive", 1642 // "gcp", 1643 // "gplus", 1644 // "groups", 1645 // "groups_enterprise", 1646 // "jamboard", 1647 // "login", 1648 // "meet", 1649 // "mobile", 1650 // "rules", 1651 // "saml", 1652 // "token", 1653 // "user_accounts", 1654 // "context_aware_access", 1655 // "chrome", 1656 // "data_studio", 1657 // "keep" 1658 // ], 1659 // "enumDescriptions": [ 1660 // "The Google Workspace Access Transparency activity reports return information about different types of Access Transparency activity events.", 1661 // "The Admin console application's activity reports return account information about different types of administrator activity events.", 1662 // "The Google Calendar application's activity reports return information about various Calendar activity events.", 1663 // "The Chat activity reports return information about various Chat activity events.", 1664 // "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.", 1665 // "The Google Cloud Platform application's activity reports return information about various GCP activity events.", 1666 // "The Google+ application's activity reports return information about various Google+ activity events.", 1667 // "The Google Groups application's activity reports return information about various Groups activity events.", 1668 // "The Enterprise Groups activity reports return information about various Enterprise group activity events.", 1669 // "The Jamboard activity reports return information about various Jamboard activity events.", 1670 // "The Login application's activity reports return account information about different types of Login activity events.", 1671 // "The Meet Audit activity report return information about different types of Meet Audit activity events.", 1672 // "The Mobile Audit activity report return information about different types of Mobile Audit activity events.", 1673 // "The Rules activity report return information about different types of Rules activity events.", 1674 // "The SAML activity report return information about different types of SAML activity events.", 1675 // "The Token application's activity reports return account information about different types of Token activity events.", 1676 // "The User Accounts application's activity reports return account information about different types of User Accounts activity events.", 1677 // "The Context-aware access activity reports return information about users' access denied events due to Context-aware access rules.", 1678 // "The Chrome activity reports return information about unsafe events reported in the context of the WebProtect features of BeyondCorp.", 1679 // "The Data Studio activity reports return information about various types of Data Studio activity events.", 1680 // "The Keep application's activity reports return information about various Google Keep activity events. The Keep activity report is only available for Google Workspace Business and Enterprise customers." 1681 // ], 1682 // "location": "path", 1683 // "pattern": "(access_transparency)|(admin)|(calendar)|(chat)|(chrome)|(context_aware_access)|(data_studio)|(drive)|(gcp)|(gplus)|(groups)|(groups_enterprise)|(jamboard)|(keep)|(login)|(meet)|(mobile)|(rules)|(saml)|(token)|(user_accounts)", 1684 // "required": true, 1685 // "type": "string" 1686 // }, 1687 // "customerId": { 1688 // "description": "The unique ID of the customer to retrieve data for.", 1689 // "location": "query", 1690 // "pattern": "C.+|my_customer", 1691 // "type": "string" 1692 // }, 1693 // "endTime": { 1694 // "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.", 1695 // "location": "query", 1696 // "pattern": "(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d):(\\d\\d)(?:\\.(\\d+))?(?:(Z)|([-+])(\\d\\d):(\\d\\d))", 1697 // "type": "string" 1698 // }, 1699 // "eventName": { 1700 // "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`.", 1701 // "location": "query", 1702 // "type": "string" 1703 // }, 1704 // "filters": { 1705 // "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. ", 1706 // "location": "query", 1707 // "pattern": "(.+[\u003c,\u003c=,==,\u003e=,\u003e,\u003c\u003e].+,)*(.+[\u003c,\u003c=,==,\u003e=,\u003e,\u003c\u003e].+)", 1708 // "type": "string" 1709 // }, 1710 // "groupIdFilter": { 1711 // "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\"", 1712 // "location": "query", 1713 // "pattern": "(id:[a-z0-9]+(,id:[a-z0-9]+)*)", 1714 // "type": "string" 1715 // }, 1716 // "maxResults": { 1717 // "default": "1000", 1718 // "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.", 1719 // "format": "int32", 1720 // "location": "query", 1721 // "maximum": "1000", 1722 // "minimum": "1", 1723 // "type": "integer" 1724 // }, 1725 // "orgUnitID": { 1726 // "default": "", 1727 // "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.", 1728 // "location": "query", 1729 // "pattern": "(id:[a-z0-9]+)", 1730 // "type": "string" 1731 // }, 1732 // "pageToken": { 1733 // "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.", 1734 // "location": "query", 1735 // "type": "string" 1736 // }, 1737 // "startTime": { 1738 // "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.", 1739 // "location": "query", 1740 // "pattern": "(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d):(\\d\\d)(?:\\.(\\d+))?(?:(Z)|([-+])(\\d\\d):(\\d\\d))", 1741 // "type": "string" 1742 // }, 1743 // "userKey": { 1744 // "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. Must not be a deleted user. For a deleted user, call `users.list` in Directory API with `showDeleted=true`, then use the returned `ID` as the `userKey`.", 1745 // "location": "path", 1746 // "required": true, 1747 // "type": "string" 1748 // } 1749 // }, 1750 // "path": "admin/reports/v1/activity/users/{userKey}/applications/{applicationName}/watch", 1751 // "request": { 1752 // "$ref": "Channel" 1753 // }, 1754 // "response": { 1755 // "$ref": "Channel" 1756 // }, 1757 // "scopes": [ 1758 // "https://www.googleapis.com/auth/admin.reports.audit.readonly" 1759 // ] 1760 // } 1761 1762} 1763 1764// method id "admin.channels.stop": 1765 1766type ChannelsStopCall struct { 1767 s *Service 1768 channel *Channel 1769 urlParams_ gensupport.URLParams 1770 ctx_ context.Context 1771 header_ http.Header 1772} 1773 1774// Stop: Stop watching resources through this channel. 1775func (r *ChannelsService) Stop(channel *Channel) *ChannelsStopCall { 1776 c := &ChannelsStopCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1777 c.channel = channel 1778 return c 1779} 1780 1781// Fields allows partial responses to be retrieved. See 1782// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1783// for more information. 1784func (c *ChannelsStopCall) Fields(s ...googleapi.Field) *ChannelsStopCall { 1785 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1786 return c 1787} 1788 1789// Context sets the context to be used in this call's Do method. Any 1790// pending HTTP request will be aborted if the provided context is 1791// canceled. 1792func (c *ChannelsStopCall) Context(ctx context.Context) *ChannelsStopCall { 1793 c.ctx_ = ctx 1794 return c 1795} 1796 1797// Header returns an http.Header that can be modified by the caller to 1798// add HTTP headers to the request. 1799func (c *ChannelsStopCall) Header() http.Header { 1800 if c.header_ == nil { 1801 c.header_ = make(http.Header) 1802 } 1803 return c.header_ 1804} 1805 1806func (c *ChannelsStopCall) doRequest(alt string) (*http.Response, error) { 1807 reqHeaders := make(http.Header) 1808 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210830") 1809 for k, v := range c.header_ { 1810 reqHeaders[k] = v 1811 } 1812 reqHeaders.Set("User-Agent", c.s.userAgent()) 1813 var body io.Reader = nil 1814 body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel) 1815 if err != nil { 1816 return nil, err 1817 } 1818 reqHeaders.Set("Content-Type", "application/json") 1819 c.urlParams_.Set("alt", alt) 1820 c.urlParams_.Set("prettyPrint", "false") 1821 urls := googleapi.ResolveRelative(c.s.BasePath, "admin/reports_v1/channels/stop") 1822 urls += "?" + c.urlParams_.Encode() 1823 req, err := http.NewRequest("POST", urls, body) 1824 if err != nil { 1825 return nil, err 1826 } 1827 req.Header = reqHeaders 1828 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1829} 1830 1831// Do executes the "admin.channels.stop" call. 1832func (c *ChannelsStopCall) Do(opts ...googleapi.CallOption) error { 1833 gensupport.SetOptions(c.urlParams_, opts...) 1834 res, err := c.doRequest("json") 1835 if err != nil { 1836 return err 1837 } 1838 defer googleapi.CloseBody(res) 1839 if err := googleapi.CheckResponse(res); err != nil { 1840 return err 1841 } 1842 return nil 1843 // { 1844 // "description": "Stop watching resources through this channel.", 1845 // "flatPath": "admin/reports_v1/channels/stop", 1846 // "httpMethod": "POST", 1847 // "id": "admin.channels.stop", 1848 // "parameterOrder": [], 1849 // "parameters": {}, 1850 // "path": "admin/reports_v1/channels/stop", 1851 // "request": { 1852 // "$ref": "Channel" 1853 // }, 1854 // "scopes": [ 1855 // "https://www.googleapis.com/auth/admin.reports.audit.readonly" 1856 // ] 1857 // } 1858 1859} 1860 1861// method id "reports.customerUsageReports.get": 1862 1863type CustomerUsageReportsGetCall struct { 1864 s *Service 1865 date string 1866 urlParams_ gensupport.URLParams 1867 ifNoneMatch_ string 1868 ctx_ context.Context 1869 header_ http.Header 1870} 1871 1872// Get: Retrieves a report which is a collection of properties and 1873// statistics for a specific customer's account. For more information, 1874// see the Customers Usage Report guide. For more information about the 1875// customer report's parameters, see the Customers Usage parameters 1876// reference guides. 1877// 1878// - date: Represents the date the usage occurred. The timestamp is in 1879// the ISO 8601 format, yyyy-mm-dd. We recommend you use your 1880// account's time zone for this. 1881func (r *CustomerUsageReportsService) Get(date string) *CustomerUsageReportsGetCall { 1882 c := &CustomerUsageReportsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1883 c.date = date 1884 return c 1885} 1886 1887// CustomerId sets the optional parameter "customerId": The unique ID of 1888// the customer to retrieve data for. 1889func (c *CustomerUsageReportsGetCall) CustomerId(customerId string) *CustomerUsageReportsGetCall { 1890 c.urlParams_.Set("customerId", customerId) 1891 return c 1892} 1893 1894// PageToken sets the optional parameter "pageToken": Token to specify 1895// next page. A report with multiple pages has a `nextPageToken` 1896// property in the response. For your follow-on requests getting all of 1897// the report's pages, enter the `nextPageToken` value in the 1898// `pageToken` query string. 1899func (c *CustomerUsageReportsGetCall) PageToken(pageToken string) *CustomerUsageReportsGetCall { 1900 c.urlParams_.Set("pageToken", pageToken) 1901 return c 1902} 1903 1904// Parameters sets the optional parameter "parameters": The `parameters` 1905// query string is a comma-separated list of event parameters that 1906// refine a report's results. The parameter is associated with a 1907// specific application. The application values for the Customers usage 1908// report include `accounts`, `app_maker`, `apps_scripts`, `calendar`, 1909// `classroom`, `cros`, `docs`, `gmail`, `gplus`, `device_management`, 1910// `meet`, and `sites`. A `parameters` query string is in the CSV form 1911// of `app_name1:param_name1, app_name2:param_name2`. *Note:* The API 1912// doesn't accept multiple values of a parameter. If a particular 1913// parameter is supplied more than once in the API request, the API only 1914// accepts the last value of that request parameter. In addition, if an 1915// invalid request parameter is supplied in the API request, the API 1916// ignores that request parameter and returns the response corresponding 1917// to the remaining valid request parameters. An example of an invalid 1918// request parameter is one that does not belong to the application. If 1919// no parameters are requested, all parameters are returned. 1920func (c *CustomerUsageReportsGetCall) Parameters(parameters string) *CustomerUsageReportsGetCall { 1921 c.urlParams_.Set("parameters", parameters) 1922 return c 1923} 1924 1925// Fields allows partial responses to be retrieved. See 1926// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1927// for more information. 1928func (c *CustomerUsageReportsGetCall) Fields(s ...googleapi.Field) *CustomerUsageReportsGetCall { 1929 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1930 return c 1931} 1932 1933// IfNoneMatch sets the optional parameter which makes the operation 1934// fail if the object's ETag matches the given value. This is useful for 1935// getting updates only after the object has changed since the last 1936// request. Use googleapi.IsNotModified to check whether the response 1937// error from Do is the result of In-None-Match. 1938func (c *CustomerUsageReportsGetCall) IfNoneMatch(entityTag string) *CustomerUsageReportsGetCall { 1939 c.ifNoneMatch_ = entityTag 1940 return c 1941} 1942 1943// Context sets the context to be used in this call's Do method. Any 1944// pending HTTP request will be aborted if the provided context is 1945// canceled. 1946func (c *CustomerUsageReportsGetCall) Context(ctx context.Context) *CustomerUsageReportsGetCall { 1947 c.ctx_ = ctx 1948 return c 1949} 1950 1951// Header returns an http.Header that can be modified by the caller to 1952// add HTTP headers to the request. 1953func (c *CustomerUsageReportsGetCall) Header() http.Header { 1954 if c.header_ == nil { 1955 c.header_ = make(http.Header) 1956 } 1957 return c.header_ 1958} 1959 1960func (c *CustomerUsageReportsGetCall) doRequest(alt string) (*http.Response, error) { 1961 reqHeaders := make(http.Header) 1962 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210830") 1963 for k, v := range c.header_ { 1964 reqHeaders[k] = v 1965 } 1966 reqHeaders.Set("User-Agent", c.s.userAgent()) 1967 if c.ifNoneMatch_ != "" { 1968 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1969 } 1970 var body io.Reader = nil 1971 c.urlParams_.Set("alt", alt) 1972 c.urlParams_.Set("prettyPrint", "false") 1973 urls := googleapi.ResolveRelative(c.s.BasePath, "admin/reports/v1/usage/dates/{date}") 1974 urls += "?" + c.urlParams_.Encode() 1975 req, err := http.NewRequest("GET", urls, body) 1976 if err != nil { 1977 return nil, err 1978 } 1979 req.Header = reqHeaders 1980 googleapi.Expand(req.URL, map[string]string{ 1981 "date": c.date, 1982 }) 1983 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1984} 1985 1986// Do executes the "reports.customerUsageReports.get" call. 1987// Exactly one of *UsageReports or error will be non-nil. Any non-2xx 1988// status code is an error. Response headers are in either 1989// *UsageReports.ServerResponse.Header or (if a response was returned at 1990// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1991// to check whether the returned error was because 1992// http.StatusNotModified was returned. 1993func (c *CustomerUsageReportsGetCall) Do(opts ...googleapi.CallOption) (*UsageReports, error) { 1994 gensupport.SetOptions(c.urlParams_, opts...) 1995 res, err := c.doRequest("json") 1996 if res != nil && res.StatusCode == http.StatusNotModified { 1997 if res.Body != nil { 1998 res.Body.Close() 1999 } 2000 return nil, &googleapi.Error{ 2001 Code: res.StatusCode, 2002 Header: res.Header, 2003 } 2004 } 2005 if err != nil { 2006 return nil, err 2007 } 2008 defer googleapi.CloseBody(res) 2009 if err := googleapi.CheckResponse(res); err != nil { 2010 return nil, err 2011 } 2012 ret := &UsageReports{ 2013 ServerResponse: googleapi.ServerResponse{ 2014 Header: res.Header, 2015 HTTPStatusCode: res.StatusCode, 2016 }, 2017 } 2018 target := &ret 2019 if err := gensupport.DecodeResponse(target, res); err != nil { 2020 return nil, err 2021 } 2022 return ret, nil 2023 // { 2024 // "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. ", 2025 // "flatPath": "admin/reports/v1/usage/dates/{date}", 2026 // "httpMethod": "GET", 2027 // "id": "reports.customerUsageReports.get", 2028 // "parameterOrder": [ 2029 // "date" 2030 // ], 2031 // "parameters": { 2032 // "customerId": { 2033 // "description": "The unique ID of the customer to retrieve data for.", 2034 // "location": "query", 2035 // "pattern": "C.+|my_customer", 2036 // "type": "string" 2037 // }, 2038 // "date": { 2039 // "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.", 2040 // "location": "path", 2041 // "pattern": "(\\d){4}-(\\d){2}-(\\d){2}", 2042 // "required": true, 2043 // "type": "string" 2044 // }, 2045 // "pageToken": { 2046 // "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.", 2047 // "location": "query", 2048 // "type": "string" 2049 // }, 2050 // "parameters": { 2051 // "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. ", 2052 // "location": "query", 2053 // "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)):[^,]+)", 2054 // "type": "string" 2055 // } 2056 // }, 2057 // "path": "admin/reports/v1/usage/dates/{date}", 2058 // "response": { 2059 // "$ref": "UsageReports" 2060 // }, 2061 // "scopes": [ 2062 // "https://www.googleapis.com/auth/admin.reports.usage.readonly" 2063 // ] 2064 // } 2065 2066} 2067 2068// Pages invokes f for each page of results. 2069// A non-nil error returned from f will halt the iteration. 2070// The provided context supersedes any context provided to the Context method. 2071func (c *CustomerUsageReportsGetCall) Pages(ctx context.Context, f func(*UsageReports) error) error { 2072 c.ctx_ = ctx 2073 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2074 for { 2075 x, err := c.Do() 2076 if err != nil { 2077 return err 2078 } 2079 if err := f(x); err != nil { 2080 return err 2081 } 2082 if x.NextPageToken == "" { 2083 return nil 2084 } 2085 c.PageToken(x.NextPageToken) 2086 } 2087} 2088 2089// method id "reports.entityUsageReports.get": 2090 2091type EntityUsageReportsGetCall struct { 2092 s *Service 2093 entityType string 2094 entityKey string 2095 date string 2096 urlParams_ gensupport.URLParams 2097 ifNoneMatch_ string 2098 ctx_ context.Context 2099 header_ http.Header 2100} 2101 2102// Get: Retrieves a report which is a collection of properties and 2103// statistics for entities used by users within the account. For more 2104// information, see the Entities Usage Report guide. For more 2105// information about the entities report's parameters, see the Entities 2106// Usage parameters reference guides. 2107// 2108// - date: Represents the date the usage occurred. The timestamp is in 2109// the ISO 8601 format, yyyy-mm-dd. We recommend you use your 2110// account's time zone for this. 2111// - entityKey: Represents the key of the object to filter the data 2112// with. 2113// - entityType: Represents the type of entity for the report. 2114func (r *EntityUsageReportsService) Get(entityType string, entityKey string, date string) *EntityUsageReportsGetCall { 2115 c := &EntityUsageReportsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2116 c.entityType = entityType 2117 c.entityKey = entityKey 2118 c.date = date 2119 return c 2120} 2121 2122// CustomerId sets the optional parameter "customerId": The unique ID of 2123// the customer to retrieve data for. 2124func (c *EntityUsageReportsGetCall) CustomerId(customerId string) *EntityUsageReportsGetCall { 2125 c.urlParams_.Set("customerId", customerId) 2126 return c 2127} 2128 2129// Filters sets the optional parameter "filters": The `filters` query 2130// string is a comma-separated list of an application's event parameters 2131// where the parameter's value is manipulated by a relational operator. 2132// The `filters` query string includes the name of the application whose 2133// usage is returned in the report. The application values for the 2134// Entities usage report include `accounts`, `docs`, and `gmail`. 2135// Filters are in the form `[application name]:parameter name[parameter 2136// value],...`. In this example, the `<>` 'not equal to' operator is 2137// URL-encoded in the request's query string (%3C%3E): GET 2138// https://www.googleapis.com/admin/reports/v1/usage/gplus_communities/all/dates/2017-12-01 2139// ?parameters=gplus:community_name,gplus:num_total_members 2140// &filters=gplus:num_total_members%3C%3E0 The relational operators 2141// include: - `==` - 'equal to'. - `<>` - 'not equal to'. It is 2142// URL-encoded (%3C%3E). - `<` - 'less than'. It is URL-encoded (%3C). - 2143// `<=` - 'less than or equal to'. It is URL-encoded (%3C=). - `>` - 2144// 'greater than'. It is URL-encoded (%3E). - `>=` - 'greater than or 2145// equal to'. It is URL-encoded (%3E=). Filters can only be applied to 2146// numeric parameters. 2147func (c *EntityUsageReportsGetCall) Filters(filters string) *EntityUsageReportsGetCall { 2148 c.urlParams_.Set("filters", filters) 2149 return c 2150} 2151 2152// MaxResults sets the optional parameter "maxResults": Determines how 2153// many activity records are shown on each response page. For example, 2154// if the request sets `maxResults=1` and the report has two activities, 2155// the report has two pages. The response's `nextPageToken` property has 2156// the token to the second page. 2157func (c *EntityUsageReportsGetCall) MaxResults(maxResults int64) *EntityUsageReportsGetCall { 2158 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 2159 return c 2160} 2161 2162// PageToken sets the optional parameter "pageToken": Token to specify 2163// next page. A report with multiple pages has a `nextPageToken` 2164// property in the response. In your follow-on request getting the next 2165// page of the report, enter the `nextPageToken` value in the 2166// `pageToken` query string. 2167func (c *EntityUsageReportsGetCall) PageToken(pageToken string) *EntityUsageReportsGetCall { 2168 c.urlParams_.Set("pageToken", pageToken) 2169 return c 2170} 2171 2172// Parameters sets the optional parameter "parameters": The `parameters` 2173// query string is a comma-separated list of event parameters that 2174// refine a report's results. The parameter is associated with a 2175// specific application. The application values for the Entities usage 2176// report are only `gplus`. A `parameter` query string is in the CSV 2177// form of `[app_name1:param_name1], [app_name2:param_name2]...`. 2178// *Note:* The API doesn't accept multiple values of a parameter. If a 2179// particular parameter is supplied more than once in the API request, 2180// the API only accepts the last value of that request parameter. In 2181// addition, if an invalid request parameter is supplied in the API 2182// request, the API ignores that request parameter and returns the 2183// response corresponding to the remaining valid request parameters. An 2184// example of an invalid request parameter is one that does not belong 2185// to the application. If no parameters are requested, all parameters 2186// are returned. 2187func (c *EntityUsageReportsGetCall) Parameters(parameters string) *EntityUsageReportsGetCall { 2188 c.urlParams_.Set("parameters", parameters) 2189 return c 2190} 2191 2192// Fields allows partial responses to be retrieved. See 2193// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2194// for more information. 2195func (c *EntityUsageReportsGetCall) Fields(s ...googleapi.Field) *EntityUsageReportsGetCall { 2196 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2197 return c 2198} 2199 2200// IfNoneMatch sets the optional parameter which makes the operation 2201// fail if the object's ETag matches the given value. This is useful for 2202// getting updates only after the object has changed since the last 2203// request. Use googleapi.IsNotModified to check whether the response 2204// error from Do is the result of In-None-Match. 2205func (c *EntityUsageReportsGetCall) IfNoneMatch(entityTag string) *EntityUsageReportsGetCall { 2206 c.ifNoneMatch_ = entityTag 2207 return c 2208} 2209 2210// Context sets the context to be used in this call's Do method. Any 2211// pending HTTP request will be aborted if the provided context is 2212// canceled. 2213func (c *EntityUsageReportsGetCall) Context(ctx context.Context) *EntityUsageReportsGetCall { 2214 c.ctx_ = ctx 2215 return c 2216} 2217 2218// Header returns an http.Header that can be modified by the caller to 2219// add HTTP headers to the request. 2220func (c *EntityUsageReportsGetCall) Header() http.Header { 2221 if c.header_ == nil { 2222 c.header_ = make(http.Header) 2223 } 2224 return c.header_ 2225} 2226 2227func (c *EntityUsageReportsGetCall) doRequest(alt string) (*http.Response, error) { 2228 reqHeaders := make(http.Header) 2229 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210830") 2230 for k, v := range c.header_ { 2231 reqHeaders[k] = v 2232 } 2233 reqHeaders.Set("User-Agent", c.s.userAgent()) 2234 if c.ifNoneMatch_ != "" { 2235 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2236 } 2237 var body io.Reader = nil 2238 c.urlParams_.Set("alt", alt) 2239 c.urlParams_.Set("prettyPrint", "false") 2240 urls := googleapi.ResolveRelative(c.s.BasePath, "admin/reports/v1/usage/{entityType}/{entityKey}/dates/{date}") 2241 urls += "?" + c.urlParams_.Encode() 2242 req, err := http.NewRequest("GET", urls, body) 2243 if err != nil { 2244 return nil, err 2245 } 2246 req.Header = reqHeaders 2247 googleapi.Expand(req.URL, map[string]string{ 2248 "entityType": c.entityType, 2249 "entityKey": c.entityKey, 2250 "date": c.date, 2251 }) 2252 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2253} 2254 2255// Do executes the "reports.entityUsageReports.get" call. 2256// Exactly one of *UsageReports or error will be non-nil. Any non-2xx 2257// status code is an error. Response headers are in either 2258// *UsageReports.ServerResponse.Header or (if a response was returned at 2259// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2260// to check whether the returned error was because 2261// http.StatusNotModified was returned. 2262func (c *EntityUsageReportsGetCall) Do(opts ...googleapi.CallOption) (*UsageReports, error) { 2263 gensupport.SetOptions(c.urlParams_, opts...) 2264 res, err := c.doRequest("json") 2265 if res != nil && res.StatusCode == http.StatusNotModified { 2266 if res.Body != nil { 2267 res.Body.Close() 2268 } 2269 return nil, &googleapi.Error{ 2270 Code: res.StatusCode, 2271 Header: res.Header, 2272 } 2273 } 2274 if err != nil { 2275 return nil, err 2276 } 2277 defer googleapi.CloseBody(res) 2278 if err := googleapi.CheckResponse(res); err != nil { 2279 return nil, err 2280 } 2281 ret := &UsageReports{ 2282 ServerResponse: googleapi.ServerResponse{ 2283 Header: res.Header, 2284 HTTPStatusCode: res.StatusCode, 2285 }, 2286 } 2287 target := &ret 2288 if err := gensupport.DecodeResponse(target, res); err != nil { 2289 return nil, err 2290 } 2291 return ret, nil 2292 // { 2293 // "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.", 2294 // "flatPath": "admin/reports/v1/usage/{entityType}/{entityKey}/dates/{date}", 2295 // "httpMethod": "GET", 2296 // "id": "reports.entityUsageReports.get", 2297 // "parameterOrder": [ 2298 // "entityType", 2299 // "entityKey", 2300 // "date" 2301 // ], 2302 // "parameters": { 2303 // "customerId": { 2304 // "description": "The unique ID of the customer to retrieve data for.", 2305 // "location": "query", 2306 // "pattern": "C.+|my_customer", 2307 // "type": "string" 2308 // }, 2309 // "date": { 2310 // "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.", 2311 // "location": "path", 2312 // "pattern": "(\\d){4}-(\\d){2}-(\\d){2}", 2313 // "required": true, 2314 // "type": "string" 2315 // }, 2316 // "entityKey": { 2317 // "description": "Represents the key of the object to filter the data with.", 2318 // "enum": [ 2319 // "all", 2320 // "entityKey" 2321 // ], 2322 // "enumDescriptions": [ 2323 // "Returns activity events for all users.", 2324 // "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." 2325 // ], 2326 // "location": "path", 2327 // "required": true, 2328 // "type": "string" 2329 // }, 2330 // "entityType": { 2331 // "description": "Represents the type of entity for the report.", 2332 // "enum": [ 2333 // "gplus_communities" 2334 // ], 2335 // "enumDescriptions": [ 2336 // "Returns a report on Google+ communities." 2337 // ], 2338 // "location": "path", 2339 // "pattern": "(gplus_communities)", 2340 // "required": true, 2341 // "type": "string" 2342 // }, 2343 // "filters": { 2344 // "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.", 2345 // "location": "query", 2346 // "pattern": "(((gplus)):[a-z0-9_]+[\u003c,\u003c=,==,\u003e=,\u003e,!=][^,]+,)*(((gplus)):[a-z0-9_]+[\u003c,\u003c=,==,\u003e=,\u003e,!=][^,]+)", 2347 // "type": "string" 2348 // }, 2349 // "maxResults": { 2350 // "default": "1000", 2351 // "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.", 2352 // "format": "uint32", 2353 // "location": "query", 2354 // "maximum": "1000", 2355 // "minimum": "1", 2356 // "type": "integer" 2357 // }, 2358 // "pageToken": { 2359 // "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.", 2360 // "location": "query", 2361 // "type": "string" 2362 // }, 2363 // "parameters": { 2364 // "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. ", 2365 // "location": "query", 2366 // "pattern": "(((gplus)):[^,]+,)*(((gplus)):[^,]+)", 2367 // "type": "string" 2368 // } 2369 // }, 2370 // "path": "admin/reports/v1/usage/{entityType}/{entityKey}/dates/{date}", 2371 // "response": { 2372 // "$ref": "UsageReports" 2373 // }, 2374 // "scopes": [ 2375 // "https://www.googleapis.com/auth/admin.reports.usage.readonly" 2376 // ] 2377 // } 2378 2379} 2380 2381// Pages invokes f for each page of results. 2382// A non-nil error returned from f will halt the iteration. 2383// The provided context supersedes any context provided to the Context method. 2384func (c *EntityUsageReportsGetCall) Pages(ctx context.Context, f func(*UsageReports) error) error { 2385 c.ctx_ = ctx 2386 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2387 for { 2388 x, err := c.Do() 2389 if err != nil { 2390 return err 2391 } 2392 if err := f(x); err != nil { 2393 return err 2394 } 2395 if x.NextPageToken == "" { 2396 return nil 2397 } 2398 c.PageToken(x.NextPageToken) 2399 } 2400} 2401 2402// method id "reports.userUsageReport.get": 2403 2404type UserUsageReportGetCall struct { 2405 s *Service 2406 userKey string 2407 date string 2408 urlParams_ gensupport.URLParams 2409 ifNoneMatch_ string 2410 ctx_ context.Context 2411 header_ http.Header 2412} 2413 2414// Get: Retrieves a report which is a collection of properties and 2415// statistics for a set of users with the account. For more information, 2416// see the User Usage Report guide. For more information about the user 2417// report's parameters, see the Users Usage parameters reference guides. 2418// 2419// - date: Represents the date the usage occurred. The timestamp is in 2420// the ISO 8601 format, yyyy-mm-dd. We recommend you use your 2421// account's time zone for this. 2422// - userKey: Represents the profile ID or the user email for which the 2423// data should be filtered. Can be `all` for all information, or 2424// `userKey` for a user's unique Google Workspace profile ID or their 2425// primary email address. Must not be a deleted user. For a deleted 2426// user, call `users.list` in Directory API with `showDeleted=true`, 2427// then use the returned `ID` as the `userKey`. 2428func (r *UserUsageReportService) Get(userKey string, date string) *UserUsageReportGetCall { 2429 c := &UserUsageReportGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2430 c.userKey = userKey 2431 c.date = date 2432 return c 2433} 2434 2435// CustomerId sets the optional parameter "customerId": The unique ID of 2436// the customer to retrieve data for. 2437func (c *UserUsageReportGetCall) CustomerId(customerId string) *UserUsageReportGetCall { 2438 c.urlParams_.Set("customerId", customerId) 2439 return c 2440} 2441 2442// Filters sets the optional parameter "filters": The `filters` query 2443// string is a comma-separated list of an application's event parameters 2444// where the parameter's value is manipulated by a relational operator. 2445// The `filters` query string includes the name of the application whose 2446// usage is returned in the report. The application values for the Users 2447// Usage Report include `accounts`, `docs`, and `gmail`. Filters are in 2448// the form `[application name]:parameter name[parameter value],...`. In 2449// this example, the `<>` 'not equal to' operator is URL-encoded in the 2450// request's query string (%3C%3E): GET 2451// https://www.googleapis.com/admin/reports/v1/usage/users/all/dates/2013-03-03 2452// ?parameters=accounts:last_login_time 2453// &filters=accounts:last_login_time%3C%3E2010-10-28T10:26:35.000Z The 2454// relational operators include: - `==` - 'equal to'. - `<>` - 'not 2455// equal to'. It is URL-encoded (%3C%3E). - `<` - 'less than'. It is 2456// URL-encoded (%3C). - `<=` - 'less than or equal to'. It is 2457// URL-encoded (%3C=). - `>` - 'greater than'. It is URL-encoded (%3E). 2458// - `>=` - 'greater than or equal to'. It is URL-encoded (%3E=). 2459func (c *UserUsageReportGetCall) Filters(filters string) *UserUsageReportGetCall { 2460 c.urlParams_.Set("filters", filters) 2461 return c 2462} 2463 2464// GroupIdFilter sets the optional parameter "groupIdFilter": Comma 2465// separated group ids (obfuscated) on which user activities are 2466// filtered, i.e. the response will contain activities for only those 2467// users that are a part of at least one of the group ids mentioned 2468// here. Format: "id:abc123,id:xyz456" 2469func (c *UserUsageReportGetCall) GroupIdFilter(groupIdFilter string) *UserUsageReportGetCall { 2470 c.urlParams_.Set("groupIdFilter", groupIdFilter) 2471 return c 2472} 2473 2474// MaxResults sets the optional parameter "maxResults": Determines how 2475// many activity records are shown on each response page. For example, 2476// if the request sets `maxResults=1` and the report has two activities, 2477// the report has two pages. The response's `nextPageToken` property has 2478// the token to the second page. The `maxResults` query string is 2479// optional. 2480func (c *UserUsageReportGetCall) MaxResults(maxResults int64) *UserUsageReportGetCall { 2481 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 2482 return c 2483} 2484 2485// OrgUnitID sets the optional parameter "orgUnitID": ID of the 2486// organizational unit to report on. User activity will be shown only 2487// for users who belong to the specified organizational unit. Data 2488// before Dec 17, 2018 doesn't appear in the filtered results. 2489func (c *UserUsageReportGetCall) OrgUnitID(orgUnitID string) *UserUsageReportGetCall { 2490 c.urlParams_.Set("orgUnitID", orgUnitID) 2491 return c 2492} 2493 2494// PageToken sets the optional parameter "pageToken": Token to specify 2495// next page. A report with multiple pages has a `nextPageToken` 2496// property in the response. In your follow-on request getting the next 2497// page of the report, enter the `nextPageToken` value in the 2498// `pageToken` query string. 2499func (c *UserUsageReportGetCall) PageToken(pageToken string) *UserUsageReportGetCall { 2500 c.urlParams_.Set("pageToken", pageToken) 2501 return c 2502} 2503 2504// Parameters sets the optional parameter "parameters": The `parameters` 2505// query string is a comma-separated list of event parameters that 2506// refine a report's results. The parameter is associated with a 2507// specific application. The application values for the Customers Usage 2508// report include `accounts`, `app_maker`, `apps_scripts`, `calendar`, 2509// `classroom`, `cros`, `docs`, `gmail`, `gplus`, `device_management`, 2510// `meet`, and `sites`. A `parameters` query string is in the CSV form 2511// of `app_name1:param_name1, app_name2:param_name2`. *Note:* The API 2512// doesn't accept multiple values of a parameter. If a particular 2513// parameter is supplied more than once in the API request, the API only 2514// accepts the last value of that request parameter. In addition, if an 2515// invalid request parameter is supplied in the API request, the API 2516// ignores that request parameter and returns the response corresponding 2517// to the remaining valid request parameters. An example of an invalid 2518// request parameter is one that does not belong to the application. If 2519// no parameters are requested, all parameters are returned. 2520func (c *UserUsageReportGetCall) Parameters(parameters string) *UserUsageReportGetCall { 2521 c.urlParams_.Set("parameters", parameters) 2522 return c 2523} 2524 2525// Fields allows partial responses to be retrieved. See 2526// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2527// for more information. 2528func (c *UserUsageReportGetCall) Fields(s ...googleapi.Field) *UserUsageReportGetCall { 2529 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2530 return c 2531} 2532 2533// IfNoneMatch sets the optional parameter which makes the operation 2534// fail if the object's ETag matches the given value. This is useful for 2535// getting updates only after the object has changed since the last 2536// request. Use googleapi.IsNotModified to check whether the response 2537// error from Do is the result of In-None-Match. 2538func (c *UserUsageReportGetCall) IfNoneMatch(entityTag string) *UserUsageReportGetCall { 2539 c.ifNoneMatch_ = entityTag 2540 return c 2541} 2542 2543// Context sets the context to be used in this call's Do method. Any 2544// pending HTTP request will be aborted if the provided context is 2545// canceled. 2546func (c *UserUsageReportGetCall) Context(ctx context.Context) *UserUsageReportGetCall { 2547 c.ctx_ = ctx 2548 return c 2549} 2550 2551// Header returns an http.Header that can be modified by the caller to 2552// add HTTP headers to the request. 2553func (c *UserUsageReportGetCall) Header() http.Header { 2554 if c.header_ == nil { 2555 c.header_ = make(http.Header) 2556 } 2557 return c.header_ 2558} 2559 2560func (c *UserUsageReportGetCall) doRequest(alt string) (*http.Response, error) { 2561 reqHeaders := make(http.Header) 2562 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210830") 2563 for k, v := range c.header_ { 2564 reqHeaders[k] = v 2565 } 2566 reqHeaders.Set("User-Agent", c.s.userAgent()) 2567 if c.ifNoneMatch_ != "" { 2568 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2569 } 2570 var body io.Reader = nil 2571 c.urlParams_.Set("alt", alt) 2572 c.urlParams_.Set("prettyPrint", "false") 2573 urls := googleapi.ResolveRelative(c.s.BasePath, "admin/reports/v1/usage/users/{userKey}/dates/{date}") 2574 urls += "?" + c.urlParams_.Encode() 2575 req, err := http.NewRequest("GET", urls, body) 2576 if err != nil { 2577 return nil, err 2578 } 2579 req.Header = reqHeaders 2580 googleapi.Expand(req.URL, map[string]string{ 2581 "userKey": c.userKey, 2582 "date": c.date, 2583 }) 2584 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2585} 2586 2587// Do executes the "reports.userUsageReport.get" call. 2588// Exactly one of *UsageReports or error will be non-nil. Any non-2xx 2589// status code is an error. Response headers are in either 2590// *UsageReports.ServerResponse.Header or (if a response was returned at 2591// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2592// to check whether the returned error was because 2593// http.StatusNotModified was returned. 2594func (c *UserUsageReportGetCall) Do(opts ...googleapi.CallOption) (*UsageReports, error) { 2595 gensupport.SetOptions(c.urlParams_, opts...) 2596 res, err := c.doRequest("json") 2597 if res != nil && res.StatusCode == http.StatusNotModified { 2598 if res.Body != nil { 2599 res.Body.Close() 2600 } 2601 return nil, &googleapi.Error{ 2602 Code: res.StatusCode, 2603 Header: res.Header, 2604 } 2605 } 2606 if err != nil { 2607 return nil, err 2608 } 2609 defer googleapi.CloseBody(res) 2610 if err := googleapi.CheckResponse(res); err != nil { 2611 return nil, err 2612 } 2613 ret := &UsageReports{ 2614 ServerResponse: googleapi.ServerResponse{ 2615 Header: res.Header, 2616 HTTPStatusCode: res.StatusCode, 2617 }, 2618 } 2619 target := &ret 2620 if err := gensupport.DecodeResponse(target, res); err != nil { 2621 return nil, err 2622 } 2623 return ret, nil 2624 // { 2625 // "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.", 2626 // "flatPath": "admin/reports/v1/usage/users/{userKey}/dates/{date}", 2627 // "httpMethod": "GET", 2628 // "id": "reports.userUsageReport.get", 2629 // "parameterOrder": [ 2630 // "userKey", 2631 // "date" 2632 // ], 2633 // "parameters": { 2634 // "customerId": { 2635 // "description": "The unique ID of the customer to retrieve data for.", 2636 // "location": "query", 2637 // "pattern": "C.+|my_customer", 2638 // "type": "string" 2639 // }, 2640 // "date": { 2641 // "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.", 2642 // "location": "path", 2643 // "pattern": "(\\d){4}-(\\d){2}-(\\d){2}", 2644 // "required": true, 2645 // "type": "string" 2646 // }, 2647 // "filters": { 2648 // "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=). ", 2649 // "location": "query", 2650 // "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,!=][^,]+)", 2651 // "type": "string" 2652 // }, 2653 // "groupIdFilter": { 2654 // "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\"", 2655 // "location": "query", 2656 // "pattern": "(id:[a-z0-9]+(,id:[a-z0-9]+)*)", 2657 // "type": "string" 2658 // }, 2659 // "maxResults": { 2660 // "default": "1000", 2661 // "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.", 2662 // "format": "uint32", 2663 // "location": "query", 2664 // "maximum": "1000", 2665 // "minimum": "1", 2666 // "type": "integer" 2667 // }, 2668 // "orgUnitID": { 2669 // "default": "", 2670 // "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.", 2671 // "location": "query", 2672 // "pattern": "(id:[a-z0-9]+)", 2673 // "type": "string" 2674 // }, 2675 // "pageToken": { 2676 // "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.", 2677 // "location": "query", 2678 // "type": "string" 2679 // }, 2680 // "parameters": { 2681 // "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. ", 2682 // "location": "query", 2683 // "pattern": "(((accounts)|(classroom)|(cros)|(gmail)|(calendar)|(docs)|(gplus)|(sites)|(device_management)|(drive)):[^,]+,)*(((accounts)|(classroom)|(cros)|(gmail)|(calendar)|(docs)|(gplus)|(sites)|(device_management)|(drive)):[^,]+)", 2684 // "type": "string" 2685 // }, 2686 // "userKey": { 2687 // "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. Must not be a deleted user. For a deleted user, call `users.list` in Directory API with `showDeleted=true`, then use the returned `ID` as the `userKey`.", 2688 // "location": "path", 2689 // "required": true, 2690 // "type": "string" 2691 // } 2692 // }, 2693 // "path": "admin/reports/v1/usage/users/{userKey}/dates/{date}", 2694 // "response": { 2695 // "$ref": "UsageReports" 2696 // }, 2697 // "scopes": [ 2698 // "https://www.googleapis.com/auth/admin.reports.usage.readonly" 2699 // ] 2700 // } 2701 2702} 2703 2704// Pages invokes f for each page of results. 2705// A non-nil error returned from f will halt the iteration. 2706// The provided context supersedes any context provided to the Context method. 2707func (c *UserUsageReportGetCall) Pages(ctx context.Context, f func(*UsageReports) error) error { 2708 c.ctx_ = ctx 2709 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2710 for { 2711 x, err := c.Do() 2712 if err != nil { 2713 return err 2714 } 2715 if err := f(x); err != nil { 2716 return err 2717 } 2718 if x.NextPageToken == "" { 2719 return nil 2720 } 2721 c.PageToken(x.NextPageToken) 2722 } 2723} 2724