public sealed class Quota : IMessage<Quota>, IEquatable<Quota>, IDeepCloneable<Quota>, IBufferMessage, IMessage
Quota configuration helps to achieve fairness and budgeting in service
usage.
The metric based quota configuration works this way:
The service configuration defines a set of metrics.
For API calls, the quota.metric_rules maps methods to metrics with
corresponding costs.
The quota.limits defines limits on the metrics, which will be used for
quota checks at runtime.
An example quota configuration in yaml format:
quota:
limits:
- name: apiWriteQpsPerProject
metric: library.googleapis.com/write_calls
unit: "1/min/{project}" # rate limit for consumer projects
values:
STANDARD: 10000
(The metric rules bind all methods to the read_calls metric,
except for the UpdateBook and DeleteBook methods. These two methods
are mapped to the write_calls metric, with the UpdateBook method
consuming at twice rate as the DeleteBook method.)
metric_rules:
- selector: "*"
metric_costs:
library.googleapis.com/read_calls: 1
- selector: google.example.library.v1.LibraryService.UpdateBook
metric_costs:
library.googleapis.com/write_calls: 2
- selector: google.example.library.v1.LibraryService.DeleteBook
metric_costs:
library.googleapis.com/write_calls: 1
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eQuota configurations help manage service usage, ensuring fairness and enabling budgeting.\u003c/p\u003e\n"],["\u003cp\u003eService configurations define metrics, while \u003ccode\u003equota.metric_rules\u003c/code\u003e map API methods to metrics with associated costs.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003equota.limits\u003c/code\u003e define the limits on metrics, which are used during runtime quota checks.\u003c/p\u003e\n"],["\u003cp\u003eThe provided example illustrates a YAML configuration for setting limits on write calls per project, as well as assigning metric costs to read, update, and delete operations.\u003c/p\u003e\n"],["\u003cp\u003eThe Quota class implements several interfaces including IMessage, IEquatable, IDeepCloneable, and IBufferMessage.\u003c/p\u003e\n"]]],[],null,["# Class Quota (2.17.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.17.0 (latest)](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api.Quota)\n- [2.15.0](/dotnet/docs/reference/Google.Api.CommonProtos/2.15.0/Google.Api.Quota)\n- [2.10.0](/dotnet/docs/reference/Google.Api.CommonProtos/2.10.0/Google.Api.Quota)\n- [2.2.0](/dotnet/docs/reference/Google.Api.CommonProtos/2.2.0/Google.Api.Quota) \n\n public sealed class Quota : IMessage\u003cQuota\u003e, IEquatable\u003cQuota\u003e, IDeepCloneable\u003cQuota\u003e, IBufferMessage, IMessage\n\nQuota configuration helps to achieve fairness and budgeting in service\nusage.\n\nThe metric based quota configuration works this way:\n\n- The service configuration defines a set of metrics.\n- For API calls, the quota.metric_rules maps methods to metrics with corresponding costs.\n- The quota.limits defines limits on the metrics, which will be used for quota checks at runtime.\n\nAn example quota configuration in yaml format:\n\nquota:\nlimits: \n\n - name: apiWriteQpsPerProject\n metric: library.googleapis.com/write_calls\n unit: \"1/min/{project}\" # rate limit for consumer projects\n values:\n STANDARD: 10000\n\n (The metric rules bind all methods to the read_calls metric,\n except for the UpdateBook and DeleteBook methods. These two methods\n are mapped to the write_calls metric, with the UpdateBook method\n consuming at twice rate as the DeleteBook method.)\n metric_rules:\n - selector: \"*\"\n metric_costs:\n library.googleapis.com/read_calls: 1\n - selector: google.example.library.v1.LibraryService.UpdateBook\n metric_costs:\n library.googleapis.com/write_calls: 2\n - selector: google.example.library.v1.LibraryService.DeleteBook\n metric_costs:\n library.googleapis.com/write_calls: 1\n\nCorresponding Metric definition: \n\n metrics:\n - name: library.googleapis.com/read_calls\n display_name: Read requests\n metric_kind: DELTA\n value_type: INT64\n\n - name: library.googleapis.com/write_calls\n display_name: Write requests\n metric_kind: DELTA\n value_type: INT64\n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e Quota \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[Quota](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api.Quota), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[Quota](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api.Quota), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[Quota](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api.Quota), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals)\n\nNamespace\n---------\n\n[Google.Api](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api)\n\nAssembly\n--------\n\nGoogle.Api.CommonProtos.dll\n\nConstructors\n------------\n\n### Quota()\n\n public Quota()\n\n### Quota(Quota)\n\n public Quota(Quota other)\n\nFields\n------\n\n### LimitsFieldNumber\n\n public const int LimitsFieldNumber = 3\n\nField number for the \"limits\" field.\n\n### MetricRulesFieldNumber\n\n public const int MetricRulesFieldNumber = 4\n\nField number for the \"metric_rules\" field.\n\nProperties\n----------\n\n### Descriptor\n\n public static MessageDescriptor Descriptor { get; }\n\n### Limits\n\n public RepeatedField\u003cQuotaLimit\u003e Limits { get; }\n\nList of QuotaLimit definitions for the service.\n\n### MetricRules\n\n public RepeatedField\u003cMetricRule\u003e MetricRules { get; }\n\nList of MetricRule definitions, each one mapping a selected method to one\nor more metrics.\n\n### Parser\n\n public static MessageParser\u003cQuota\u003e Parser { get; }\n\nMethods\n-------\n\n### CalculateSize()\n\n public int CalculateSize()\n\n### Clone()\n\n public Quota Clone()\n\n### Equals(Quota)\n\n public bool Equals(Quota other)\n\n### Equals(object)\n\n public override bool Equals(object other)\n\n**Overrides** \n[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object))\n\n### GetHashCode()\n\n public override int GetHashCode()\n\n**Overrides** \n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode)\n\n### MergeFrom(Quota)\n\n public void MergeFrom(Quota other)\n\n### MergeFrom(CodedInputStream)\n\n public void MergeFrom(CodedInputStream input)\n\n### ToString()\n\n public override string ToString()\n\n**Overrides** \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\n### WriteTo(CodedOutputStream)\n\n public void WriteTo(CodedOutputStream output)"]]