25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

2102 lines
72 KiB

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