Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
quota.proto185 linesDownload Raw Back to api
1// Copyright 2026 Google LLC2//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 at6//7//     http://www.apache.org/licenses/LICENSE-2.08//9// Unless required by applicable law or agreed to in writing, software10// 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 and13// limitations under the License.14 15syntax = "proto3";16 17package google.api;18 19option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";20option java_multiple_files = true;21option java_outer_classname = "QuotaProto";22option java_package = "com.google.api";23option objc_class_prefix = "GAPI";24 25// Quota configuration helps to achieve fairness and budgeting in service26// usage.27//28// The metric based quota configuration works this way:29// - The service configuration defines a set of metrics.30// - For API calls, the quota.metric_rules maps methods to metrics with31//   corresponding costs.32// - The quota.limits defines limits on the metrics, which will be used for33//   quota checks at runtime.34//35// An example quota configuration in yaml format:36//37//    quota:38//      limits:39//40//      - name: apiWriteQpsPerProject41//        metric: library.googleapis.com/write_calls42//        unit: "1/min/{project}"  # rate limit for consumer projects43//        values:44//          STANDARD: 1000045//46//47//      (The metric rules bind all methods to the read_calls metric,48//       except for the UpdateBook and DeleteBook methods. These two methods49//       are mapped to the write_calls metric, with the UpdateBook method50//       consuming at twice rate as the DeleteBook method.)51//      metric_rules:52//      - selector: "*"53//        metric_costs:54//          library.googleapis.com/read_calls: 155//      - selector: google.example.library.v1.LibraryService.UpdateBook56//        metric_costs:57//          library.googleapis.com/write_calls: 258//      - selector: google.example.library.v1.LibraryService.DeleteBook59//        metric_costs:60//          library.googleapis.com/write_calls: 161//62//  Corresponding Metric definition:63//64//      metrics:65//      - name: library.googleapis.com/read_calls66//        display_name: Read requests67//        metric_kind: DELTA68//        value_type: INT6469//70//      - name: library.googleapis.com/write_calls71//        display_name: Write requests72//        metric_kind: DELTA73//        value_type: INT6474//75//76message Quota {77  // List of QuotaLimit definitions for the service.78  repeated QuotaLimit limits = 3;79 80  // List of MetricRule definitions, each one mapping a selected method to one81  // or more metrics.82  repeated MetricRule metric_rules = 4;83}84 85// Bind API methods to metrics. Binding a method to a metric causes that86// metric's configured quota behaviors to apply to the method call.87message MetricRule {88  // Selects the methods to which this rule applies.89  //90  // Refer to [selector][google.api.DocumentationRule.selector] for syntax91  // details.92  string selector = 1;93 94  // Metrics to update when the selected methods are called, and the associated95  // cost applied to each metric.96  //97  // The key of the map is the metric name, and the values are the amount98  // increased for the metric against which the quota limits are defined.99  // The value must not be negative.100  map<string, int64> metric_costs = 2;101}102 103// `QuotaLimit` defines a specific limit that applies over a specified duration104// for a limit type. There can be at most one limit for a duration and limit105// type combination defined within a `QuotaGroup`.106message QuotaLimit {107  // Name of the quota limit.108  //109  // The name must be provided, and it must be unique within the service. The110  // name can only include alphanumeric characters as well as '-'.111  //112  // The maximum length of the limit name is 64 characters.113  string name = 6;114 115  // Optional. User-visible, extended description for this quota limit.116  // Should be used only when more context is needed to understand this limit117  // than provided by the limit's display name (see: `display_name`).118  string description = 2;119 120  // Default number of tokens that can be consumed during the specified121  // duration. This is the number of tokens assigned when a client122  // application developer activates the service for his/her project.123  //124  // Specifying a value of 0 will block all requests. This can be used if you125  // are provisioning quota to selected consumers and blocking others.126  // Similarly, a value of -1 will indicate an unlimited quota. No other127  // negative values are allowed.128  //129  // Used by group-based quotas only.130  int64 default_limit = 3;131 132  // Maximum number of tokens that can be consumed during the specified133  // duration. Client application developers can override the default limit up134  // to this maximum. If specified, this value cannot be set to a value less135  // than the default limit. If not specified, it is set to the default limit.136  //137  // To allow clients to apply overrides with no upper bound, set this to -1,138  // indicating unlimited maximum quota.139  //140  // Used by group-based quotas only.141  int64 max_limit = 4;142 143  // Free tier value displayed in the Developers Console for this limit.144  // The free tier is the number of tokens that will be subtracted from the145  // billed amount when billing is enabled.146  // This field can only be set on a limit with duration "1d", in a billable147  // group; it is invalid on any other limit. If this field is not set, it148  // defaults to 0, indicating that there is no free tier for this service.149  //150  // Used by group-based quotas only.151  int64 free_tier = 7;152 153  // Duration of this limit in textual notation. Must be "100s" or "1d".154  //155  // Used by group-based quotas only.156  string duration = 5;157 158  // The name of the metric this quota limit applies to. The quota limits with159  // the same metric will be checked together during runtime. The metric must be160  // defined within the service config.161  string metric = 8;162 163  // Specify the unit of the quota limit. It uses the same syntax as164  // [MetricDescriptor.unit][google.api.MetricDescriptor.unit]. The supported165  // unit kinds are determined by the quota backend system.166  //167  // Here are some examples:168  // * "1/min/{project}" for quota per minute per project.169  //170  // Note: the order of unit components is insignificant.171  // The "1" at the beginning is required to follow the metric unit syntax.172  string unit = 9;173 174  // Tiered limit values. You must specify this as a key:value pair, with an175  // integer value that is the maximum number of requests allowed for the176  // specified unit. Currently only STANDARD is supported.177  map<string, int64> values = 10;178 179  // User-visible display name for this limit.180  // Optional. If not set, the UI will provide a default display name based on181  // the quota configuration. This field can be used to override the default182  // display name generated from the configuration.183  string display_name = 12;184}185 
codekingpro/portable-devtools · Team Ai