xref: /aosp_15_r20/external/googleapis/google/api/serviceusage/v1beta1/resources.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.api.serviceusage.v1beta1;
18
19import "google/api/auth.proto";
20import "google/api/documentation.proto";
21import "google/api/endpoint.proto";
22import "google/api/monitored_resource.proto";
23import "google/api/monitoring.proto";
24import "google/api/quota.proto";
25import "google/api/usage.proto";
26import "google/protobuf/api.proto";
27
28option csharp_namespace = "Google.Api.ServiceUsage.V1Beta1";
29option go_package = "google.golang.org/genproto/googleapis/api/serviceusage/v1beta1;serviceusage";
30option java_multiple_files = true;
31option java_outer_classname = "ResourcesProto";
32option java_package = "com.google.api.serviceusage.v1beta1";
33option php_namespace = "Google\\Api\\ServiceUsage\\V1beta1";
34option ruby_package = "Google::Api::ServiceUsage::V1beta1";
35
36// A service that is available for use by the consumer.
37message Service {
38  // The resource name of the consumer and service.
39  //
40  // A valid name would be:
41  // - `projects/123/services/serviceusage.googleapis.com`
42  string name = 1;
43
44  // The resource name of the consumer.
45  //
46  // A valid name would be:
47  // - `projects/123`
48  string parent = 5;
49
50  // The service configuration of the available service.
51  // Some fields may be filtered out of the configuration in responses to
52  // the `ListServices` method. These fields are present only in responses to
53  // the `GetService` method.
54  ServiceConfig config = 2;
55
56  // Whether or not the service has been enabled for use by the consumer.
57  State state = 4;
58}
59
60// Whether or not a service has been enabled for use by a consumer.
61enum State {
62  // The default value, which indicates that the enabled state of the service
63  // is unspecified or not meaningful. Currently, all consumers other than
64  // projects (such as folders and organizations) are always in this state.
65  STATE_UNSPECIFIED = 0;
66
67  // The service cannot be used by this consumer. It has either been explicitly
68  // disabled, or has never been enabled.
69  DISABLED = 1;
70
71  // The service has been explicitly enabled for use by this consumer.
72  ENABLED = 2;
73}
74
75// The configuration of the service.
76message ServiceConfig {
77  // The DNS address at which this service is available.
78  //
79  // An example DNS address would be:
80  // `calendar.googleapis.com`.
81  string name = 1;
82
83  // The product title for this service.
84  string title = 2;
85
86  // A list of API interfaces exported by this service. Contains only the names,
87  // versions, and method names of the interfaces.
88  repeated google.protobuf.Api apis = 3;
89
90  // Additional API documentation. Contains only the summary and the
91  // documentation URL.
92  google.api.Documentation documentation = 6;
93
94  // Quota configuration.
95  google.api.Quota quota = 10;
96
97  // Auth configuration. Contains only the OAuth rules.
98  google.api.Authentication authentication = 11;
99
100  // Configuration controlling usage of this service.
101  google.api.Usage usage = 15;
102
103  // Configuration for network endpoints. Contains only the names and aliases
104  // of the endpoints.
105  repeated google.api.Endpoint endpoints = 18;
106
107  // Defines the monitored resources used by this service. This is required
108  // by the [Service.monitoring][google.api.Service.monitoring] and
109  // [Service.logging][google.api.Service.logging] configurations.
110  repeated google.api.MonitoredResourceDescriptor monitored_resources = 25;
111
112  // Monitoring configuration.
113  // This should not include the 'producer_destinations' field.
114  google.api.Monitoring monitoring = 28;
115}
116
117// The operation metadata returned for the batchend services operation.
118message OperationMetadata {
119  // The full name of the resources that this operation is directly
120  // associated with.
121  repeated string resource_names = 2;
122}
123
124// Consumer quota settings for a quota metric.
125message ConsumerQuotaMetric {
126  // The resource name of the quota settings on this metric for this consumer.
127  //
128  // An example name would be:
129  // `projects/123/services/compute.googleapis.com/consumerQuotaMetrics/compute.googleapis.com%2Fcpus`
130  //
131  // The resource name is intended to be opaque and should not be parsed for
132  // its component strings, since its representation could change in the future.
133  string name = 1;
134
135  // The name of the metric.
136  //
137  // An example name would be:
138  // `compute.googleapis.com/cpus`
139  string metric = 4;
140
141  // The display name of the metric.
142  //
143  // An example name would be:
144  // `CPUs`
145  string display_name = 2;
146
147  // The consumer quota for each quota limit defined on the metric.
148  repeated ConsumerQuotaLimit consumer_quota_limits = 3;
149
150  // The quota limits targeting the descendant containers of the
151  // consumer in request.
152  //
153  // If the consumer in request is of type `organizations`
154  // or `folders`, the field will list per-project limits in the metric; if the
155  // consumer in request is of type `project`, the field will be empty.
156  //
157  // The `quota_buckets` field of each descendant consumer quota limit will not
158  // be populated.
159  repeated ConsumerQuotaLimit descendant_consumer_quota_limits = 6;
160
161  // The units in which the metric value is reported.
162  string unit = 5;
163}
164
165// Consumer quota settings for a quota limit.
166message ConsumerQuotaLimit {
167  // The resource name of the quota limit.
168  //
169  // An example name would be:
170  // `projects/123/services/compute.googleapis.com/consumerQuotaMetrics/compute.googleapis.com%2Fcpus/limits/%2Fproject%2Fregion`
171  //
172  // The resource name is intended to be opaque and should not be parsed for
173  // its component strings, since its representation could change in the future.
174  string name = 1;
175
176  // The name of the parent metric of this limit.
177  //
178  // An example name would be:
179  // `compute.googleapis.com/cpus`
180  string metric = 8;
181
182  // The limit unit.
183  //
184  // An example unit would be
185  // `1/{project}/{region}`
186  // Note that `{project}` and `{region}` are not placeholders in this example;
187  // the literal characters `{` and `}` occur in the string.
188  string unit = 2;
189
190  // Whether this limit is precise or imprecise.
191  bool is_precise = 3;
192
193  // Whether admin overrides are allowed on this limit
194  bool allows_admin_overrides = 7;
195
196  // Summary of the enforced quota buckets, organized by quota dimension,
197  // ordered from least specific to most specific (for example, the global
198  // default bucket, with no quota dimensions, will always appear first).
199  repeated QuotaBucket quota_buckets = 9;
200
201  // List of all supported locations.
202  // This field is present only if the limit has a {region} or {zone} dimension.
203  repeated string supported_locations = 11;
204}
205
206// Selected view of quota. Can be used to request more detailed quota
207// information when retrieving quota metrics and limits.
208enum QuotaView {
209  // No quota view specified. Requests that do not specify a quota view will
210  // typically default to the BASIC view.
211  QUOTA_VIEW_UNSPECIFIED = 0;
212
213  // Only buckets with overrides are shown in the response.
214  BASIC = 1;
215
216  // Include per-location buckets even if they do not have overrides.
217  // When the view is FULL, and a limit has regional or zonal quota, the limit
218  // will include buckets for all regions or zones that could support
219  // overrides, even if none are currently present. In some cases this will
220  // cause the response to become very large; callers that do not need this
221  // extra information should use the BASIC view instead.
222  FULL = 2;
223}
224
225// A quota bucket is a quota provisioning unit for a specific set of dimensions.
226message QuotaBucket {
227  // The effective limit of this quota bucket. Equal to default_limit if there
228  // are no overrides.
229  int64 effective_limit = 1;
230
231  // The default limit of this quota bucket, as specified by the service
232  // configuration.
233  int64 default_limit = 2;
234
235  // Producer override on this quota bucket.
236  QuotaOverride producer_override = 3;
237
238  // Consumer override on this quota bucket.
239  QuotaOverride consumer_override = 4;
240
241  // Admin override on this quota bucket.
242  QuotaOverride admin_override = 5;
243
244  // Producer policy inherited from the closet ancestor of the current consumer.
245  ProducerQuotaPolicy producer_quota_policy = 7;
246
247  // The dimensions of this quota bucket.
248  //
249  // If this map is empty, this is the global bucket, which is the default quota
250  // value applied to all requests that do not have a more specific override.
251  //
252  // If this map is nonempty, the default limit, effective limit, and quota
253  // overrides apply only to requests that have the dimensions given in the map.
254  //
255  // For example, if the map has key `region` and value `us-east-1`, then the
256  // specified effective limit is only effective in that region, and the
257  // specified overrides apply only in that region.
258  map<string, string> dimensions = 6;
259}
260
261// A quota override
262message QuotaOverride {
263  // The resource name of the override.
264  // This name is generated by the server when the override is created.
265  //
266  // Example names would be:
267  // `projects/123/services/compute.googleapis.com/consumerQuotaMetrics/compute.googleapis.com%2Fcpus/limits/%2Fproject%2Fregion/adminOverrides/4a3f2c1d`
268  // `projects/123/services/compute.googleapis.com/consumerQuotaMetrics/compute.googleapis.com%2Fcpus/limits/%2Fproject%2Fregion/consumerOverrides/4a3f2c1d`
269  //
270  // The resource name is intended to be opaque and should not be parsed for
271  // its component strings, since its representation could change in the future.
272  string name = 1;
273
274  // The overriding quota limit value.
275  // Can be any nonnegative integer, or -1 (unlimited quota).
276  int64 override_value = 2;
277
278  // If this map is nonempty, then this override applies only to specific values
279  // for dimensions defined in the limit unit.
280  //
281  // For example, an override on a limit with the unit `1/{project}/{region}`
282  // could contain an entry with the key `region` and the value `us-east-1`;
283  // the override is only applied to quota consumed in that region.
284  //
285  // This map has the following restrictions:
286  //
287  // *   Keys that are not defined in the limit's unit are not valid keys.
288  //     Any string appearing in `{brackets}` in the unit (besides `{project}`
289  //     or
290  //     `{user}`) is a defined key.
291  // *   `project` is not a valid key; the project is already specified in
292  //     the parent resource name.
293  // *   `user` is not a valid key; the API does not support quota overrides
294  //     that apply only to a specific user.
295  // *   If `region` appears as a key, its value must be a valid Cloud region.
296  // *   If `zone` appears as a key, its value must be a valid Cloud zone.
297  // *   If any valid key other than `region` or `zone` appears in the map, then
298  //     all valid keys other than `region` or `zone` must also appear in the
299  //     map.
300  map<string, string> dimensions = 3;
301
302  // The name of the metric to which this override applies.
303  //
304  // An example name would be:
305  // `compute.googleapis.com/cpus`
306  string metric = 4;
307
308  // The limit unit of the limit to which this override applies.
309  //
310  // An example unit would be:
311  // `1/{project}/{region}`
312  // Note that `{project}` and `{region}` are not placeholders in this example;
313  // the literal characters `{` and `}` occur in the string.
314  string unit = 5;
315
316  // The resource name of the ancestor that requested the override. For example:
317  // `organizations/12345` or `folders/67890`.
318  // Used by admin overrides only.
319  string admin_override_ancestor = 6;
320}
321
322// Import data embedded in the request message
323message OverrideInlineSource {
324  // The overrides to create.
325  // Each override must have a value for 'metric' and 'unit', to specify
326  // which metric and which limit the override should be applied to.
327  // The 'name' field of the override does not need to be set; it is ignored.
328  repeated QuotaOverride overrides = 1;
329}
330
331// Enumerations of quota safety checks.
332enum QuotaSafetyCheck {
333  // Unspecified quota safety check.
334  QUOTA_SAFETY_CHECK_UNSPECIFIED = 0;
335
336  // Validates that a quota mutation would not cause the consumer's effective
337  // limit to be lower than the consumer's quota usage.
338  LIMIT_DECREASE_BELOW_USAGE = 1;
339
340  // Validates that a quota mutation would not cause the consumer's effective
341  // limit to decrease by more than 10 percent.
342  LIMIT_DECREASE_PERCENTAGE_TOO_HIGH = 2;
343}
344
345// Quota policy created by service producer.
346message ProducerQuotaPolicy {
347  // The resource name of the policy.
348  // This name is generated by the server when the policy is created.
349  //
350  // Example names would be:
351  // `organizations/123/services/compute.googleapis.com/consumerQuotaMetrics/compute.googleapis.com%2Fcpus/limits/%2Fproject%2Fregion/producerQuotaPolicies/4a3f2c1d`
352  string name = 1;
353
354  // The quota policy value.
355  // Can be any nonnegative integer, or -1 (unlimited quota).
356  int64 policy_value = 2;
357
358  //
359  // If this map is nonempty, then this policy applies only to specific values
360  // for dimensions defined in the limit unit.
361  //
362  // For example, a policy on a limit with the unit `1/{project}/{region}`
363  // could contain an entry with the key `region` and the value `us-east-1`;
364  // the policy is only applied to quota consumed in that region.
365  //
366  // This map has the following restrictions:
367  //
368  // *   Keys that are not defined in the limit's unit are not valid keys.
369  //     Any string appearing in {brackets} in the unit (besides {project} or
370  //     {user}) is a defined key.
371  // *   `project` is not a valid key; the project is already specified in
372  //     the parent resource name.
373  // *   `user` is not a valid key; the API does not support quota policies
374  //     that apply only to a specific user.
375  // *   If `region` appears as a key, its value must be a valid Cloud region.
376  // *   If `zone` appears as a key, its value must be a valid Cloud zone.
377  // *   If any valid key other than `region` or `zone` appears in the map, then
378  //     all valid keys other than `region` or `zone` must also appear in the
379  //     map.
380  map<string, string> dimensions = 3;
381
382  // The name of the metric to which this policy applies.
383  //
384  // An example name would be:
385  // `compute.googleapis.com/cpus`
386  string metric = 4;
387
388  // The limit unit of the limit to which this policy applies.
389  //
390  // An example unit would be:
391  // `1/{project}/{region}`
392  // Note that `{project}` and `{region}` are not placeholders in this example;
393  // the literal characters `{` and `}` occur in the string.
394  string unit = 5;
395
396  // The cloud resource container at which the quota policy is created. The
397  // format is `{container_type}/{container_number}`
398  string container = 6;
399}
400
401// Quota policy created by quota administrator.
402message AdminQuotaPolicy {
403  // The resource name of the policy.
404  // This name is generated by the server when the policy is created.
405  //
406  // Example names would be:
407  // `organizations/123/services/compute.googleapis.com/consumerQuotaMetrics/compute.googleapis.com%2Fcpus/limits/%2Fproject%2Fregion/adminQuotaPolicies/4a3f2c1d`
408  string name = 1;
409
410  // The quota policy value.
411  // Can be any nonnegative integer, or -1 (unlimited quota).
412  int64 policy_value = 2;
413
414  //
415  // If this map is nonempty, then this policy applies only to specific values
416  // for dimensions defined in the limit unit.
417  //
418  // For example, a policy on a limit with the unit `1/{project}/{region}`
419  // could contain an entry with the key `region` and the value `us-east-1`;
420  // the policy is only applied to quota consumed in that region.
421  //
422  // This map has the following restrictions:
423  //
424  // *   If `region` appears as a key, its value must be a valid Cloud region.
425  // *   If `zone` appears as a key, its value must be a valid Cloud zone.
426  // *   Keys other than `region` or `zone` are not valid.
427  map<string, string> dimensions = 3;
428
429  // The name of the metric to which this policy applies.
430  //
431  // An example name would be:
432  // `compute.googleapis.com/cpus`
433  string metric = 4;
434
435  // The limit unit of the limit to which this policy applies.
436  //
437  // An example unit would be:
438  // `1/{project}/{region}`
439  // Note that `{project}` and `{region}` are not placeholders in this example;
440  // the literal characters `{` and `}` occur in the string.
441  string unit = 5;
442
443  // The cloud resource container at which the quota policy is created. The
444  // format is `{container_type}/{container_number}`
445  string container = 6;
446}
447
448// Service identity for a service. This is the identity that service producer
449// should use to access consumer resources.
450message ServiceIdentity {
451  // The email address of the service account that a service producer would use
452  // to access consumer resources.
453  string email = 1;
454
455  // The unique and stable id of the service account.
456  // https://cloud.google.com/iam/reference/rest/v1/projects.serviceAccounts#ServiceAccount
457  string unique_id = 2;
458}
459