xref: /aosp_15_r20/external/googleapis/google/cloud/channel/v1/reports_service.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package google.cloud.channel.v1;
18
19import "google/api/annotations.proto";
20import "google/api/client.proto";
21import "google/api/field_behavior.proto";
22import "google/api/resource.proto";
23import "google/cloud/channel/v1/operations.proto";
24import "google/longrunning/operations.proto";
25import "google/protobuf/timestamp.proto";
26import "google/type/date.proto";
27import "google/type/datetime.proto";
28import "google/type/decimal.proto";
29import "google/type/money.proto";
30
31option go_package = "cloud.google.com/go/channel/apiv1/channelpb;channelpb";
32option java_multiple_files = true;
33option java_outer_classname = "ReportsServiceProto";
34option java_package = "com.google.cloud.channel.v1";
35
36// CloudChannelReportsService lets Google Cloud resellers and
37// distributors retrieve and combine a variety of data in Cloud Channel for
38// multiple products (Google Cloud, Google Voice, and Google Workspace.)
39//
40// Deprecated: This service is being deprecated. Please use [Export Channel
41// Services data to
42// BigQuery](https://cloud.google.com/channel/docs/rebilling/export-data-to-bigquery)
43// instead.
44service CloudChannelReportsService {
45  option deprecated = true;
46  option (google.api.default_host) = "cloudchannel.googleapis.com";
47  option (google.api.oauth_scopes) =
48      "https://www.googleapis.com/auth/apps.reports.usage.readonly";
49
50  // Begins generation of data for a given report. The report
51  // identifier is a UID (for example, `613bf59q`).
52  //
53  // Possible error codes:
54  //
55  // * PERMISSION_DENIED: The user doesn't have access to this report.
56  // * INVALID_ARGUMENT: Required request parameters are missing
57  //   or invalid.
58  // * NOT_FOUND: The report identifier was not found.
59  // * INTERNAL: Any non-user error related to a technical issue
60  //   in the backend. Contact Cloud Channel support.
61  // * UNKNOWN: Any non-user error related to a technical issue
62  //   in the backend. Contact Cloud Channel support.
63  //
64  // Return value:
65  // The ID of a long-running operation.
66  //
67  // To get the results of the operation, call the GetOperation method of
68  // CloudChannelOperationsService. The Operation metadata contains an
69  // instance of [OperationMetadata][google.cloud.channel.v1.OperationMetadata].
70  //
71  // To get the results of report generation, call
72  // [CloudChannelReportsService.FetchReportResults][google.cloud.channel.v1.CloudChannelReportsService.FetchReportResults]
73  // with the
74  // [RunReportJobResponse.report_job][google.cloud.channel.v1.RunReportJobResponse.report_job].
75  //
76  // Deprecated: Please use [Export Channel Services data to
77  // BigQuery](https://cloud.google.com/channel/docs/rebilling/export-data-to-bigquery)
78  // instead.
79  rpc RunReportJob(RunReportJobRequest) returns (google.longrunning.Operation) {
80    option deprecated = true;
81    option (google.api.http) = {
82      post: "/v1/{name=accounts/*/reports/*}:run"
83      body: "*"
84    };
85    option (google.longrunning.operation_info) = {
86      response_type: "RunReportJobResponse"
87      metadata_type: "OperationMetadata"
88    };
89  }
90
91  // Retrieves data generated by
92  // [CloudChannelReportsService.RunReportJob][google.cloud.channel.v1.CloudChannelReportsService.RunReportJob].
93  //
94  // Deprecated: Please use [Export Channel Services data to
95  // BigQuery](https://cloud.google.com/channel/docs/rebilling/export-data-to-bigquery)
96  // instead.
97  rpc FetchReportResults(FetchReportResultsRequest)
98      returns (FetchReportResultsResponse) {
99    option deprecated = true;
100    option (google.api.http) = {
101      post: "/v1/{report_job=accounts/*/reportJobs/*}:fetchReportResults"
102      body: "*"
103    };
104    option (google.api.method_signature) = "report_job";
105  }
106
107  // Lists the reports that RunReportJob can run. These reports include an ID,
108  // a description, and the list of columns that will be in the result.
109  //
110  // Deprecated: Please use [Export Channel Services data to
111  // BigQuery](https://cloud.google.com/channel/docs/rebilling/export-data-to-bigquery)
112  // instead.
113  rpc ListReports(ListReportsRequest) returns (ListReportsResponse) {
114    option deprecated = true;
115    option (google.api.http) = {
116      get: "/v1/{parent=accounts/*}/reports"
117    };
118    option (google.api.method_signature) = "parent";
119  }
120}
121
122// Request message for
123// [CloudChannelReportsService.RunReportJob][google.cloud.channel.v1.CloudChannelReportsService.RunReportJob].
124message RunReportJobRequest {
125  option deprecated = true;
126
127  // Required. The report's resource name. Specifies the account and report used
128  // to generate report data. The report_id identifier is a UID (for example,
129  // `613bf59q`).
130  // Name uses the format:
131  // accounts/{account_id}/reports/{report_id}
132  string name = 1 [
133    (google.api.field_behavior) = REQUIRED,
134    (google.api.resource_reference) = {
135      type: "cloudchannel.googleapis.com/Report"
136    }
137  ];
138
139  // Optional. The range of usage or invoice dates to include in the result.
140  DateRange date_range = 2 [(google.api.field_behavior) = OPTIONAL];
141
142  // Optional. A structured string that defines conditions on dimension columns
143  // to restrict the report output.
144  //
145  // Filters support logical operators (AND, OR, NOT) and conditional operators
146  // (=, !=, <, >, <=, and >=) using `column_id` as keys.
147  //
148  // For example:
149  // `(customer:"accounts/C123abc/customers/S456def" OR
150  // customer:"accounts/C123abc/customers/S789ghi") AND
151  // invoice_start_date.year >= 2022`
152  string filter = 3 [(google.api.field_behavior) = OPTIONAL];
153
154  // Optional. The BCP-47 language code, such as "en-US".  If specified, the
155  // response is localized to the corresponding language code if the
156  // original data sources support it.
157  // Default is "en-US".
158  string language_code = 4 [(google.api.field_behavior) = OPTIONAL];
159}
160
161// Response message for
162// [CloudChannelReportsService.RunReportJob][google.cloud.channel.v1.CloudChannelReportsService.RunReportJob].
163message RunReportJobResponse {
164  option deprecated = true;
165
166  // Pass `report_job.name` to
167  // [FetchReportResultsRequest.report_job][google.cloud.channel.v1.FetchReportResultsRequest.report_job]
168  // to retrieve the report's results.
169  ReportJob report_job = 1;
170
171  // The metadata for the report's results (display name, columns, row count,
172  // and date range). If you view this before the operation finishes,
173  // you may see incomplete data.
174  ReportResultsMetadata report_metadata = 2;
175}
176
177// Request message for
178// [CloudChannelReportsService.FetchReportResults][google.cloud.channel.v1.CloudChannelReportsService.FetchReportResults].
179message FetchReportResultsRequest {
180  option deprecated = true;
181
182  // Required. The report job created by
183  // [CloudChannelReportsService.RunReportJob][google.cloud.channel.v1.CloudChannelReportsService.RunReportJob].
184  // Report_job uses the format:
185  // accounts/{account_id}/reportJobs/{report_job_id}
186  string report_job = 1 [
187    (google.api.field_behavior) = REQUIRED,
188    (google.api.resource_reference) = {
189      type: "cloudchannel.googleapis.com/ReportJob"
190    }
191  ];
192
193  // Optional. Requested page size of the report. The server may return fewer
194  // results than requested. If you don't specify a page size, the server uses a
195  // sensible default (may change over time).
196  //
197  // The maximum value is 30,000; the server will change larger values to
198  // 30,000.
199  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
200
201  // Optional. A token that specifies a page of results beyond the first page.
202  // Obtained through
203  // [FetchReportResultsResponse.next_page_token][google.cloud.channel.v1.FetchReportResultsResponse.next_page_token]
204  // of the previous
205  // [CloudChannelReportsService.FetchReportResults][google.cloud.channel.v1.CloudChannelReportsService.FetchReportResults]
206  // call.
207  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
208
209  // Optional. List of keys specifying which report partitions to return.
210  // If empty, returns all partitions.
211  repeated string partition_keys = 4 [(google.api.field_behavior) = OPTIONAL];
212}
213
214// Response message for
215// [CloudChannelReportsService.FetchReportResults][google.cloud.channel.v1.CloudChannelReportsService.FetchReportResults].
216// Contains a tabular representation of the report results.
217message FetchReportResultsResponse {
218  option deprecated = true;
219
220  // The metadata for the report results (display name, columns, row count, and
221  // date ranges).
222  ReportResultsMetadata report_metadata = 1;
223
224  // The report's lists of values. Each row follows the settings and ordering
225  // of the columns from `report_metadata`.
226  repeated Row rows = 2;
227
228  // Pass this token to
229  // [FetchReportResultsRequest.page_token][google.cloud.channel.v1.FetchReportResultsRequest.page_token]
230  // to retrieve the next page of results.
231  string next_page_token = 3;
232}
233
234// Request message for
235// [CloudChannelReportsService.ListReports][google.cloud.channel.v1.CloudChannelReportsService.ListReports].
236message ListReportsRequest {
237  option deprecated = true;
238
239  // Required. The resource name of the partner account to list available
240  // reports for. Parent uses the format: accounts/{account_id}
241  string parent = 1 [(google.api.field_behavior) = REQUIRED];
242
243  // Optional. Requested page size of the report. The server might return fewer
244  // results than requested. If unspecified, returns 20 reports. The maximum
245  // value is 100.
246  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
247
248  // Optional. A token that specifies a page of results beyond the first page.
249  // Obtained through
250  // [ListReportsResponse.next_page_token][google.cloud.channel.v1.ListReportsResponse.next_page_token]
251  // of the previous
252  // [CloudChannelReportsService.ListReports][google.cloud.channel.v1.CloudChannelReportsService.ListReports]
253  // call.
254  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
255
256  // Optional. The BCP-47 language code, such as "en-US".  If specified, the
257  // response is localized to the corresponding language code if the
258  // original data sources support it.
259  // Default is "en-US".
260  string language_code = 4 [(google.api.field_behavior) = OPTIONAL];
261}
262
263// Response message for
264// [CloudChannelReportsService.ListReports][google.cloud.channel.v1.CloudChannelReportsService.ListReports].
265message ListReportsResponse {
266  option deprecated = true;
267
268  // The reports available to the partner.
269  repeated Report reports = 1;
270
271  // Pass this token to
272  // [FetchReportResultsRequest.page_token][google.cloud.channel.v1.FetchReportResultsRequest.page_token]
273  // to retrieve the next page of results.
274  string next_page_token = 2;
275}
276
277// The result of a [RunReportJob][] operation. Contains the name to use in
278// [FetchReportResultsRequest.report_job][google.cloud.channel.v1.FetchReportResultsRequest.report_job]
279// and the status of the operation.
280message ReportJob {
281  option deprecated = true;
282  option (google.api.resource) = {
283    type: "cloudchannel.googleapis.com/ReportJob"
284    pattern: "accounts/{account}/reportJobs/{report_job}"
285  };
286
287  // Required. The resource name of a report job.
288  // Name uses the format:
289  // `accounts/{account_id}/reportJobs/{report_job_id}`
290  string name = 1 [(google.api.field_behavior) = REQUIRED];
291
292  // The current status of report generation.
293  ReportStatus report_status = 2;
294}
295
296// The features describing the data. Returned by
297// [CloudChannelReportsService.RunReportJob][google.cloud.channel.v1.CloudChannelReportsService.RunReportJob]
298// and
299// [CloudChannelReportsService.FetchReportResults][google.cloud.channel.v1.CloudChannelReportsService.FetchReportResults].
300message ReportResultsMetadata {
301  option deprecated = true;
302
303  // Details of the completed report.
304  Report report = 1;
305
306  // The total number of rows of data in the final report.
307  int64 row_count = 2;
308
309  // The date range of reported usage.
310  DateRange date_range = 3;
311
312  // The usage dates immediately preceding `date_range` with the same duration.
313  // Use this to calculate trending usage and costs. This is only populated if
314  // you request trending data.
315  //
316  // For example, if `date_range` is July 1-15, `preceding_date_range` will be
317  // June 16-30.
318  DateRange preceding_date_range = 4;
319}
320
321// The definition of a report column. Specifies the data properties
322// in the corresponding position of the report rows.
323message Column {
324  option deprecated = true;
325
326  // Available data types for columns. Corresponds to the fields in the
327  // ReportValue `oneof` field.
328  enum DataType {
329    // Not used.
330    DATA_TYPE_UNSPECIFIED = 0;
331
332    // ReportValues for this column will use string_value.
333    STRING = 1;
334
335    // ReportValues for this column will use int_value.
336    INT = 2;
337
338    // ReportValues for this column will use decimal_value.
339    DECIMAL = 3;
340
341    // ReportValues for this column will use money_value.
342    MONEY = 4;
343
344    // ReportValues for this column will use date_value.
345    DATE = 5;
346
347    // ReportValues for this column will use date_time_value.
348    DATE_TIME = 6;
349  }
350
351  // The unique name of the column (for example, customer_domain,
352  // channel_partner, customer_cost). You can use column IDs in
353  // [RunReportJobRequest.filter][google.cloud.channel.v1.RunReportJobRequest.filter].
354  // To see all reports and their columns, call
355  // [CloudChannelReportsService.ListReports][google.cloud.channel.v1.CloudChannelReportsService.ListReports].
356  string column_id = 1;
357
358  // The column's display name.
359  string display_name = 2;
360
361  // The type of the values for this column.
362  DataType data_type = 3;
363}
364
365// A representation of usage or invoice date ranges.
366message DateRange {
367  option deprecated = true;
368
369  // The earliest usage date time (inclusive).
370  //
371  // If you use time groupings (daily, weekly, etc), each group uses
372  // midnight to midnight (Pacific time). The usage start date is
373  // rounded down to include all usage from the specified date. We recommend
374  // that clients pass `usage_start_date_time` in Pacific time.
375  google.type.DateTime usage_start_date_time = 1;
376
377  // The latest usage date time (exclusive).
378  //
379  // If you use time groupings (daily, weekly, etc), each group uses
380  // midnight to midnight (Pacific time). The usage end date is
381  // rounded down to include all usage from the specified date. We recommend
382  // that clients pass `usage_start_date_time` in Pacific time.
383  google.type.DateTime usage_end_date_time = 2;
384
385  // The earliest invoice date (inclusive).
386  //
387  // If this value is not the first day of a month, this will move it back to
388  // the first day of the given month.
389  google.type.Date invoice_start_date = 3;
390
391  // The latest invoice date (inclusive).
392  //
393  // If this value is not the last day of a month, this will move it forward to
394  // the last day of the given month.
395  google.type.Date invoice_end_date = 4;
396}
397
398// A row of report values.
399message Row {
400  option deprecated = true;
401
402  // The list of values in the row.
403  repeated ReportValue values = 1;
404
405  // The key for the partition this row belongs to. This field is empty
406  // if the report is not partitioned.
407  string partition_key = 2;
408}
409
410// A single report value.
411message ReportValue {
412  option deprecated = true;
413
414  // A single report value.
415  oneof value {
416    // A value of type `string`.
417    string string_value = 1;
418
419    // A value of type `int`.
420    int64 int_value = 2;
421
422    // A value of type `google.type.Decimal`, representing non-integer numeric
423    // values.
424    google.type.Decimal decimal_value = 3;
425
426    // A value of type `google.type.Money` (currency code, whole units, decimal
427    // units).
428    google.type.Money money_value = 4;
429
430    // A value of type `google.type.Date` (year, month, day).
431    google.type.Date date_value = 5;
432
433    // A value of type `google.type.DateTime` (year, month, day, hour, minute,
434    // second, and UTC offset or timezone.)
435    google.type.DateTime date_time_value = 6;
436  }
437}
438
439// Status of a report generation process.
440message ReportStatus {
441  option deprecated = true;
442
443  // Available states of report generation.
444  enum State {
445    // Not used.
446    STATE_UNSPECIFIED = 0;
447
448    // Report processing started.
449    STARTED = 1;
450
451    // Data generated from the report is being staged.
452    WRITING = 2;
453
454    // Report data is available for access.
455    AVAILABLE = 3;
456
457    // Report failed.
458    FAILED = 4;
459  }
460
461  // The current state of the report generation process.
462  State state = 1;
463
464  // The report generation's start time.
465  google.protobuf.Timestamp start_time = 2;
466
467  // The report generation's completion time.
468  google.protobuf.Timestamp end_time = 3;
469}
470
471// The ID and description of a report that was used to generate report data.
472// For example, "Google Cloud Daily Spend", "Google Workspace License Activity",
473// etc.
474message Report {
475  option deprecated = true;
476  option (google.api.resource) = {
477    type: "cloudchannel.googleapis.com/Report"
478    pattern: "accounts/{account}/reports/{report}"
479  };
480
481  // Required. The report's resource name. Specifies the account and report used
482  // to generate report data. The report_id identifier is a UID (for example,
483  // `613bf59q`).
484  //
485  // Name uses the format:
486  // accounts/{account_id}/reports/{report_id}
487  string name = 1 [(google.api.field_behavior) = REQUIRED];
488
489  // A human-readable name for this report.
490  string display_name = 2;
491
492  // The list of columns included in the report. This defines the schema of
493  // the report results.
494  repeated Column columns = 3;
495
496  // A description of other aspects of the report, such as the products
497  // it supports.
498  string description = 4;
499}
500