xref: /aosp_15_r20/external/googleapis/google/analytics/admin/v1beta/access_report.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.analytics.admin.v1beta;
18
19option go_package = "google.golang.org/genproto/googleapis/analytics/admin/v1beta;admin";
20option java_multiple_files = true;
21option java_outer_classname = "AccessReportProto";
22option java_package = "com.google.analytics.admin.v1beta";
23
24// Dimensions are attributes of your data. For example, the dimension
25// `userEmail` indicates the email of the user that accessed reporting data.
26// Dimension values in report responses are strings.
27message AccessDimension {
28  // The API name of the dimension. See [Data Access
29  // Schema](https://developers.google.com/analytics/devguides/config/admin/v1/access-api-schema)
30  // for the list of dimensions supported in this API.
31  //
32  // Dimensions are referenced by name in `dimensionFilter` and `orderBys`.
33  string dimension_name = 1;
34}
35
36// The quantitative measurements of a report. For example, the metric
37// `accessCount` is the total number of data access records.
38message AccessMetric {
39  // The API name of the metric. See [Data Access
40  // Schema](https://developers.google.com/analytics/devguides/config/admin/v1/access-api-schema)
41  // for the list of metrics supported in this API.
42  //
43  // Metrics are referenced by name in `metricFilter` & `orderBys`.
44  string metric_name = 1;
45}
46
47// A contiguous range of days: startDate, startDate + 1, ..., endDate.
48message AccessDateRange {
49  // The inclusive start date for the query in the format `YYYY-MM-DD`. Cannot
50  // be after `endDate`. The format `NdaysAgo`, `yesterday`, or `today` is also
51  // accepted, and in that case, the date is inferred based on the current time
52  // in the request's time zone.
53  string start_date = 1;
54
55  // The inclusive end date for the query in the format `YYYY-MM-DD`. Cannot
56  // be before `startDate`. The format `NdaysAgo`, `yesterday`, or `today` is
57  // also accepted, and in that case, the date is inferred based on the current
58  // time in the request's time zone.
59  string end_date = 2;
60}
61
62// Expresses dimension or metric filters. The fields in the same expression need
63// to be either all dimensions or all metrics.
64message AccessFilterExpression {
65  // Specify one type of filter expression for `FilterExpression`.
66  oneof one_expression {
67    // Each of the FilterExpressions in the and_group has an AND relationship.
68    AccessFilterExpressionList and_group = 1;
69
70    // Each of the FilterExpressions in the or_group has an OR relationship.
71    AccessFilterExpressionList or_group = 2;
72
73    // The FilterExpression is NOT of not_expression.
74    AccessFilterExpression not_expression = 3;
75
76    // A primitive filter. In the same FilterExpression, all of the filter's
77    // field names need to be either all dimensions or all metrics.
78    AccessFilter access_filter = 4;
79  }
80}
81
82// A list of filter expressions.
83message AccessFilterExpressionList {
84  // A list of filter expressions.
85  repeated AccessFilterExpression expressions = 1;
86}
87
88// An expression to filter dimension or metric values.
89message AccessFilter {
90  // Specify one type of filter for `Filter`.
91  oneof one_filter {
92    // Strings related filter.
93    AccessStringFilter string_filter = 2;
94
95    // A filter for in list values.
96    AccessInListFilter in_list_filter = 3;
97
98    // A filter for numeric or date values.
99    AccessNumericFilter numeric_filter = 4;
100
101    // A filter for two values.
102    AccessBetweenFilter between_filter = 5;
103  }
104
105  // The dimension name or metric name.
106  string field_name = 1;
107}
108
109// The filter for strings.
110message AccessStringFilter {
111  // The match type of a string filter.
112  enum MatchType {
113    // Unspecified
114    MATCH_TYPE_UNSPECIFIED = 0;
115
116    // Exact match of the string value.
117    EXACT = 1;
118
119    // Begins with the string value.
120    BEGINS_WITH = 2;
121
122    // Ends with the string value.
123    ENDS_WITH = 3;
124
125    // Contains the string value.
126    CONTAINS = 4;
127
128    // Full match for the regular expression with the string value.
129    FULL_REGEXP = 5;
130
131    // Partial match for the regular expression with the string value.
132    PARTIAL_REGEXP = 6;
133  }
134
135  // The match type for this filter.
136  MatchType match_type = 1;
137
138  // The string value used for the matching.
139  string value = 2;
140
141  // If true, the string value is case sensitive.
142  bool case_sensitive = 3;
143}
144
145// The result needs to be in a list of string values.
146message AccessInListFilter {
147  // The list of string values. Must be non-empty.
148  repeated string values = 1;
149
150  // If true, the string value is case sensitive.
151  bool case_sensitive = 2;
152}
153
154// Filters for numeric or date values.
155message AccessNumericFilter {
156  // The operation applied to a numeric filter.
157  enum Operation {
158    // Unspecified.
159    OPERATION_UNSPECIFIED = 0;
160
161    // Equal
162    EQUAL = 1;
163
164    // Less than
165    LESS_THAN = 2;
166
167    // Less than or equal
168    LESS_THAN_OR_EQUAL = 3;
169
170    // Greater than
171    GREATER_THAN = 4;
172
173    // Greater than or equal
174    GREATER_THAN_OR_EQUAL = 5;
175  }
176
177  // The operation type for this filter.
178  Operation operation = 1;
179
180  // A numeric value or a date value.
181  NumericValue value = 2;
182}
183
184// To express that the result needs to be between two numbers (inclusive).
185message AccessBetweenFilter {
186  // Begins with this number.
187  NumericValue from_value = 1;
188
189  // Ends with this number.
190  NumericValue to_value = 2;
191}
192
193// To represent a number.
194message NumericValue {
195  // One of a numeric value
196  oneof one_value {
197    // Integer value
198    int64 int64_value = 1;
199
200    // Double value
201    double double_value = 2;
202  }
203}
204
205// Order bys define how rows will be sorted in the response. For example,
206// ordering rows by descending access count is one ordering, and ordering rows
207// by the country string is a different ordering.
208message AccessOrderBy {
209  // Sorts by metric values.
210  message MetricOrderBy {
211    // A metric name in the request to order by.
212    string metric_name = 1;
213  }
214
215  // Sorts by dimension values.
216  message DimensionOrderBy {
217    // Rule to order the string dimension values by.
218    enum OrderType {
219      // Unspecified.
220      ORDER_TYPE_UNSPECIFIED = 0;
221
222      // Alphanumeric sort by Unicode code point. For example, "2" < "A" < "X" <
223      // "b" < "z".
224      ALPHANUMERIC = 1;
225
226      // Case insensitive alphanumeric sort by lower case Unicode code point.
227      // For example, "2" < "A" < "b" < "X" < "z".
228      CASE_INSENSITIVE_ALPHANUMERIC = 2;
229
230      // Dimension values are converted to numbers before sorting. For example
231      // in NUMERIC sort, "25" < "100", and in `ALPHANUMERIC` sort, "100" <
232      // "25". Non-numeric dimension values all have equal ordering value below
233      // all numeric values.
234      NUMERIC = 3;
235    }
236
237    // A dimension name in the request to order by.
238    string dimension_name = 1;
239
240    // Controls the rule for dimension value ordering.
241    OrderType order_type = 2;
242  }
243
244  // Specify one type of order by for `OrderBy`.
245  oneof one_order_by {
246    // Sorts results by a metric's values.
247    MetricOrderBy metric = 1;
248
249    // Sorts results by a dimension's values.
250    DimensionOrderBy dimension = 2;
251  }
252
253  // If true, sorts by descending order. If false or unspecified, sorts in
254  // ascending order.
255  bool desc = 3;
256}
257
258// Describes a dimension column in the report. Dimensions requested in a report
259// produce column entries within rows and DimensionHeaders. However, dimensions
260// used exclusively within filters or expressions do not produce columns in a
261// report; correspondingly, those dimensions do not produce headers.
262message AccessDimensionHeader {
263  // The dimension's name; for example 'userEmail'.
264  string dimension_name = 1;
265}
266
267// Describes a metric column in the report. Visible metrics requested in a
268// report produce column entries within rows and MetricHeaders. However,
269// metrics used exclusively within filters or expressions do not produce columns
270// in a report; correspondingly, those metrics do not produce headers.
271message AccessMetricHeader {
272  // The metric's name; for example 'accessCount'.
273  string metric_name = 1;
274}
275
276// Access report data for each row.
277message AccessRow {
278  // List of dimension values. These values are in the same order as specified
279  // in the request.
280  repeated AccessDimensionValue dimension_values = 1;
281
282  // List of metric values. These values are in the same order as specified
283  // in the request.
284  repeated AccessMetricValue metric_values = 2;
285}
286
287// The value of a dimension.
288message AccessDimensionValue {
289  // The dimension value. For example, this value may be 'France' for the
290  // 'country' dimension.
291  string value = 1;
292}
293
294// The value of a metric.
295message AccessMetricValue {
296  // The measurement value. For example, this value may be '13'.
297  string value = 1;
298}
299
300// Current state of all quotas for this Analytics property. If any quota for a
301// property is exhausted, all requests to that property will return Resource
302// Exhausted errors.
303message AccessQuota {
304  // Properties can use 250,000 tokens per day. Most requests consume fewer than
305  // 10 tokens.
306  AccessQuotaStatus tokens_per_day = 1;
307
308  // Properties can use 50,000 tokens per hour. An API request consumes a single
309  // number of tokens, and that number is deducted from all of the hourly,
310  // daily, and per project hourly quotas.
311  AccessQuotaStatus tokens_per_hour = 2;
312
313  // Properties can use up to 50 concurrent requests.
314  AccessQuotaStatus concurrent_requests = 3;
315
316  // Properties and cloud project pairs can have up to 50 server errors per
317  // hour.
318  AccessQuotaStatus server_errors_per_project_per_hour = 4;
319
320  // Properties can use up to 25% of their tokens per project per hour. This
321  // amounts to Analytics 360 Properties can use 12,500 tokens per project per
322  // hour. An API request consumes a single number of tokens, and that number is
323  // deducted from all of the hourly, daily, and per project hourly quotas.
324  AccessQuotaStatus tokens_per_project_per_hour = 5;
325}
326
327// Current state for a particular quota group.
328message AccessQuotaStatus {
329  // Quota consumed by this request.
330  int32 consumed = 1;
331
332  // Quota remaining after this request.
333  int32 remaining = 2;
334}
335