public final class Quota extends com.google.protobuf.GeneratedMessageV3 implements QuotaOrBuilder
Quota configuration helps to achieve fairness and budgeting in service
usage.
The 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
Corresponding Metric definition:
metrics:
- name: library.googleapis.com/read_calls
display_name: Read requests
metric_kind: DELTA
value_type: INT64
- name: library.googleapis.com/write_calls
display_name: Write requests
metric_kind: DELTA
value_type: INT64
Protobuf type google.api.Quota| Modifier and Type | Class and Description |
|---|---|
static class |
Quota.Builder
Quota configuration helps to achieve fairness and budgeting in service
usage.
|
com.google.protobuf.GeneratedMessageV3.BuilderParent, com.google.protobuf.GeneratedMessageV3.ExtendableBuilder<MessageType extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage,BuilderType extends com.google.protobuf.GeneratedMessageV3.ExtendableBuilder<MessageType,BuilderType>>, com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageType extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage>, com.google.protobuf.GeneratedMessageV3.ExtendableMessageOrBuilder<MessageType extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage>, com.google.protobuf.GeneratedMessageV3.FieldAccessorTable| Modifier and Type | Field and Description |
|---|---|
static int |
LIMITS_FIELD_NUMBER |
static int |
METRIC_RULES_FIELD_NUMBER |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
static Quota |
getDefaultInstance() |
Quota |
getDefaultInstanceForType() |
static com.google.protobuf.Descriptors.Descriptor |
getDescriptor() |
QuotaLimit |
getLimits(int index)
List of `QuotaLimit` definitions for the service.
|
int |
getLimitsCount()
List of `QuotaLimit` definitions for the service.
|
java.util.List<QuotaLimit> |
getLimitsList()
List of `QuotaLimit` definitions for the service.
|
QuotaLimitOrBuilder |
getLimitsOrBuilder(int index)
List of `QuotaLimit` definitions for the service.
|
java.util.List<? extends QuotaLimitOrBuilder> |
getLimitsOrBuilderList()
List of `QuotaLimit` definitions for the service.
|
MetricRule |
getMetricRules(int index)
List of `MetricRule` definitions, each one mapping a selected method to one
or more metrics.
|
int |
getMetricRulesCount()
List of `MetricRule` definitions, each one mapping a selected method to one
or more metrics.
|
java.util.List<MetricRule> |
getMetricRulesList()
List of `MetricRule` definitions, each one mapping a selected method to one
or more metrics.
|
MetricRuleOrBuilder |
getMetricRulesOrBuilder(int index)
List of `MetricRule` definitions, each one mapping a selected method to one
or more metrics.
|
java.util.List<? extends MetricRuleOrBuilder> |
getMetricRulesOrBuilderList()
List of `MetricRule` definitions, each one mapping a selected method to one
or more metrics.
|
com.google.protobuf.Parser<Quota> |
getParserForType() |
int |
getSerializedSize() |
com.google.protobuf.UnknownFieldSet |
getUnknownFields() |
int |
hashCode() |
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable |
internalGetFieldAccessorTable() |
boolean |
isInitialized() |
static Quota.Builder |
newBuilder() |
static Quota.Builder |
newBuilder(Quota prototype) |
Quota.Builder |
newBuilderForType() |
protected Quota.Builder |
newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) |
static Quota |
parseDelimitedFrom(java.io.InputStream input) |
static Quota |
parseDelimitedFrom(java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static Quota |
parseFrom(byte[] data) |
static Quota |
parseFrom(byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static Quota |
parseFrom(java.nio.ByteBuffer data) |
static Quota |
parseFrom(java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static Quota |
parseFrom(com.google.protobuf.ByteString data) |
static Quota |
parseFrom(com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static Quota |
parseFrom(com.google.protobuf.CodedInputStream input) |
static Quota |
parseFrom(com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static Quota |
parseFrom(java.io.InputStream input) |
static Quota |
parseFrom(java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static com.google.protobuf.Parser<Quota> |
parser() |
Quota.Builder |
toBuilder() |
void |
writeTo(com.google.protobuf.CodedOutputStream output) |
canUseUnsafe, computeStringSize, computeStringSizeNoTag, getAllFields, getDescriptorForType, getField, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, hasField, hasOneof, internalGetMapField, makeExtensionsImmutable, newBuilderForType, parseDelimitedWithIOException, parseDelimitedWithIOException, parseUnknownField, parseUnknownFieldProto3, parseWithIOException, parseWithIOException, parseWithIOException, parseWithIOException, serializeBooleanMapTo, serializeIntegerMapTo, serializeLongMapTo, serializeStringMapTo, writeReplace, writeString, writeStringNoTagfindInitializationErrors, getInitializationErrorString, hashBoolean, hashEnum, hashEnumList, hashFields, hashLong, toStringaddAll, addAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeToclone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic static final int LIMITS_FIELD_NUMBER
public static final int METRIC_RULES_FIELD_NUMBER
public final com.google.protobuf.UnknownFieldSet getUnknownFields()
getUnknownFields in interface com.google.protobuf.MessageOrBuildergetUnknownFields in class com.google.protobuf.GeneratedMessageV3public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3public java.util.List<QuotaLimit> getLimitsList()
List of `QuotaLimit` definitions for the service.
repeated .google.api.QuotaLimit limits = 3;getLimitsList in interface QuotaOrBuilderpublic java.util.List<? extends QuotaLimitOrBuilder> getLimitsOrBuilderList()
List of `QuotaLimit` definitions for the service.
repeated .google.api.QuotaLimit limits = 3;getLimitsOrBuilderList in interface QuotaOrBuilderpublic int getLimitsCount()
List of `QuotaLimit` definitions for the service.
repeated .google.api.QuotaLimit limits = 3;getLimitsCount in interface QuotaOrBuilderpublic QuotaLimit getLimits(int index)
List of `QuotaLimit` definitions for the service.
repeated .google.api.QuotaLimit limits = 3;getLimits in interface QuotaOrBuilderpublic QuotaLimitOrBuilder getLimitsOrBuilder(int index)
List of `QuotaLimit` definitions for the service.
repeated .google.api.QuotaLimit limits = 3;getLimitsOrBuilder in interface QuotaOrBuilderpublic java.util.List<MetricRule> getMetricRulesList()
List of `MetricRule` definitions, each one mapping a selected method to one or more metrics.
repeated .google.api.MetricRule metric_rules = 4;getMetricRulesList in interface QuotaOrBuilderpublic java.util.List<? extends MetricRuleOrBuilder> getMetricRulesOrBuilderList()
List of `MetricRule` definitions, each one mapping a selected method to one or more metrics.
repeated .google.api.MetricRule metric_rules = 4;getMetricRulesOrBuilderList in interface QuotaOrBuilderpublic int getMetricRulesCount()
List of `MetricRule` definitions, each one mapping a selected method to one or more metrics.
repeated .google.api.MetricRule metric_rules = 4;getMetricRulesCount in interface QuotaOrBuilderpublic MetricRule getMetricRules(int index)
List of `MetricRule` definitions, each one mapping a selected method to one or more metrics.
repeated .google.api.MetricRule metric_rules = 4;getMetricRules in interface QuotaOrBuilderpublic MetricRuleOrBuilder getMetricRulesOrBuilder(int index)
List of `MetricRule` definitions, each one mapping a selected method to one or more metrics.
repeated .google.api.MetricRule metric_rules = 4;getMetricRulesOrBuilder in interface QuotaOrBuilderpublic final boolean isInitialized()
isInitialized in interface com.google.protobuf.MessageLiteOrBuilderisInitialized in class com.google.protobuf.GeneratedMessageV3public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException
writeTo in interface com.google.protobuf.MessageLitewriteTo in class com.google.protobuf.GeneratedMessageV3java.io.IOExceptionpublic int getSerializedSize()
getSerializedSize in interface com.google.protobuf.MessageLitegetSerializedSize in class com.google.protobuf.GeneratedMessageV3public boolean equals(java.lang.Object obj)
equals in interface com.google.protobuf.Messageequals in class com.google.protobuf.AbstractMessagepublic int hashCode()
hashCode in interface com.google.protobuf.MessagehashCode in class com.google.protobuf.AbstractMessagepublic static Quota parseFrom(java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static Quota parseFrom(java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static Quota parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static Quota parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static Quota parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static Quota parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static Quota parseFrom(java.io.InputStream input) throws java.io.IOException
java.io.IOExceptionpublic static Quota parseFrom(java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException
java.io.IOExceptionpublic static Quota parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException
java.io.IOExceptionpublic static Quota parseDelimitedFrom(java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException
java.io.IOExceptionpublic static Quota parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException
java.io.IOExceptionpublic static Quota parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException
java.io.IOExceptionpublic Quota.Builder newBuilderForType()
newBuilderForType in interface com.google.protobuf.MessagenewBuilderForType in interface com.google.protobuf.MessageLitepublic static Quota.Builder newBuilder()
public static Quota.Builder newBuilder(Quota prototype)
public Quota.Builder toBuilder()
toBuilder in interface com.google.protobuf.MessagetoBuilder in interface com.google.protobuf.MessageLiteprotected Quota.Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
newBuilderForType in class com.google.protobuf.GeneratedMessageV3public static Quota getDefaultInstance()
public static com.google.protobuf.Parser<Quota> parser()
public com.google.protobuf.Parser<Quota> getParserForType()
getParserForType in interface com.google.protobuf.MessagegetParserForType in interface com.google.protobuf.MessageLitegetParserForType in class com.google.protobuf.GeneratedMessageV3public Quota getDefaultInstanceForType()
getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuildergetDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder