public static final class Quota.Builder extends GeneratedMessageV3.Builder<Quota.Builder> implements QuotaOrBuilder
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
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
Inherited Members
com.google.protobuf.GeneratedMessageV3.Builder.getUnknownFieldSetBuilder()
com.google.protobuf.GeneratedMessageV3.Builder.mergeUnknownLengthDelimitedField(int,com.google.protobuf.ByteString)
com.google.protobuf.GeneratedMessageV3.Builder.mergeUnknownVarintField(int,int)
com.google.protobuf.GeneratedMessageV3.Builder.parseUnknownField(com.google.protobuf.CodedInputStream,com.google.protobuf.ExtensionRegistryLite,int)
com.google.protobuf.GeneratedMessageV3.Builder.setUnknownFieldSetBuilder(com.google.protobuf.UnknownFieldSet.Builder)
Static Methods
getDescriptor()
public static final Descriptors.Descriptor getDescriptor()
Returns
Methods
addAllLimits(Iterable<? extends QuotaLimit> values)
public Quota.Builder addAllLimits(Iterable<? extends QuotaLimit> values)
List of QuotaLimit definitions for the service.
repeated .google.api.QuotaLimit limits = 3;
Parameter
Name | Description |
values | Iterable<? extends com.google.api.QuotaLimit>
|
Returns
addAllMetricRules(Iterable<? extends MetricRule> values)
public Quota.Builder addAllMetricRules(Iterable<? extends MetricRule> values)
List of MetricRule definitions, each one mapping a selected method to one
or more metrics.
repeated .google.api.MetricRule metric_rules = 4;
Parameter
Name | Description |
values | Iterable<? extends com.google.api.MetricRule>
|
Returns
addLimits(QuotaLimit value)
public Quota.Builder addLimits(QuotaLimit value)
List of QuotaLimit definitions for the service.
repeated .google.api.QuotaLimit limits = 3;
Parameter
Returns
addLimits(QuotaLimit.Builder builderForValue)
public Quota.Builder addLimits(QuotaLimit.Builder builderForValue)
List of QuotaLimit definitions for the service.
repeated .google.api.QuotaLimit limits = 3;
Parameter
Returns
addLimits(int index, QuotaLimit value)
public Quota.Builder addLimits(int index, QuotaLimit value)
List of QuotaLimit definitions for the service.
repeated .google.api.QuotaLimit limits = 3;
Parameters
Returns
addLimits(int index, QuotaLimit.Builder builderForValue)
public Quota.Builder addLimits(int index, QuotaLimit.Builder builderForValue)
List of QuotaLimit definitions for the service.
repeated .google.api.QuotaLimit limits = 3;
Parameters
Returns
addLimitsBuilder()
public QuotaLimit.Builder addLimitsBuilder()
List of QuotaLimit definitions for the service.
repeated .google.api.QuotaLimit limits = 3;
Returns
addLimitsBuilder(int index)
public QuotaLimit.Builder addLimitsBuilder(int index)
List of QuotaLimit definitions for the service.
repeated .google.api.QuotaLimit limits = 3;
Parameter
Returns
addMetricRules(MetricRule value)
public Quota.Builder addMetricRules(MetricRule value)
List of MetricRule definitions, each one mapping a selected method to one
or more metrics.
repeated .google.api.MetricRule metric_rules = 4;
Parameter
Returns
addMetricRules(MetricRule.Builder builderForValue)
public Quota.Builder addMetricRules(MetricRule.Builder builderForValue)
List of MetricRule definitions, each one mapping a selected method to one
or more metrics.
repeated .google.api.MetricRule metric_rules = 4;
Parameter
Returns
addMetricRules(int index, MetricRule value)
public Quota.Builder addMetricRules(int index, MetricRule value)
List of MetricRule definitions, each one mapping a selected method to one
or more metrics.
repeated .google.api.MetricRule metric_rules = 4;
Parameters
Returns
addMetricRules(int index, MetricRule.Builder builderForValue)
public Quota.Builder addMetricRules(int index, MetricRule.Builder builderForValue)
List of MetricRule definitions, each one mapping a selected method to one
or more metrics.
repeated .google.api.MetricRule metric_rules = 4;
Parameters
Returns
addMetricRulesBuilder()
public MetricRule.Builder addMetricRulesBuilder()
List of MetricRule definitions, each one mapping a selected method to one
or more metrics.
repeated .google.api.MetricRule metric_rules = 4;
Returns
addMetricRulesBuilder(int index)
public MetricRule.Builder addMetricRulesBuilder(int index)
List of MetricRule definitions, each one mapping a selected method to one
or more metrics.
repeated .google.api.MetricRule metric_rules = 4;
Parameter
Returns
addRepeatedField(Descriptors.FieldDescriptor field, Object value)
public Quota.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
Returns
Overrides
build()
Returns
buildPartial()
public Quota buildPartial()
Returns
clear()
public Quota.Builder clear()
Returns
Overrides
clearField(Descriptors.FieldDescriptor field)
public Quota.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
Returns
Overrides
clearLimits()
public Quota.Builder clearLimits()
List of QuotaLimit definitions for the service.
repeated .google.api.QuotaLimit limits = 3;
Returns
clearMetricRules()
public Quota.Builder clearMetricRules()
List of MetricRule definitions, each one mapping a selected method to one
or more metrics.
repeated .google.api.MetricRule metric_rules = 4;
Returns
clearOneof(Descriptors.OneofDescriptor oneof)
public Quota.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
Returns
Overrides
clone()
public Quota.Builder clone()
Returns
Overrides
getDefaultInstanceForType()
public Quota getDefaultInstanceForType()
Returns
getDescriptorForType()
public Descriptors.Descriptor getDescriptorForType()
Returns
Overrides
getLimits(int index)
public QuotaLimit getLimits(int index)
List of QuotaLimit definitions for the service.
repeated .google.api.QuotaLimit limits = 3;
Parameter
Returns
getLimitsBuilder(int index)
public QuotaLimit.Builder getLimitsBuilder(int index)
List of QuotaLimit definitions for the service.
repeated .google.api.QuotaLimit limits = 3;
Parameter
Returns
getLimitsBuilderList()
public List<QuotaLimit.Builder> getLimitsBuilderList()
List of QuotaLimit definitions for the service.
repeated .google.api.QuotaLimit limits = 3;
Returns
getLimitsCount()
public int getLimitsCount()
List of QuotaLimit definitions for the service.
repeated .google.api.QuotaLimit limits = 3;
Returns
getLimitsList()
public List<QuotaLimit> getLimitsList()
List of QuotaLimit definitions for the service.
repeated .google.api.QuotaLimit limits = 3;
Returns
getLimitsOrBuilder(int index)
public QuotaLimitOrBuilder getLimitsOrBuilder(int index)
List of QuotaLimit definitions for the service.
repeated .google.api.QuotaLimit limits = 3;
Parameter
Returns
getLimitsOrBuilderList()
public List<? extends QuotaLimitOrBuilder> getLimitsOrBuilderList()
List of QuotaLimit definitions for the service.
repeated .google.api.QuotaLimit limits = 3;
Returns
Type | Description |
List<? extends com.google.api.QuotaLimitOrBuilder> | |
getMetricRules(int index)
public 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;
Parameter
Returns
getMetricRulesBuilder(int index)
public MetricRule.Builder getMetricRulesBuilder(int index)
List of MetricRule definitions, each one mapping a selected method to one
or more metrics.
repeated .google.api.MetricRule metric_rules = 4;
Parameter
Returns
getMetricRulesBuilderList()
public List<MetricRule.Builder> getMetricRulesBuilderList()
List of MetricRule definitions, each one mapping a selected method to one
or more metrics.
repeated .google.api.MetricRule metric_rules = 4;
Returns
getMetricRulesCount()
public int getMetricRulesCount()
List of MetricRule definitions, each one mapping a selected method to one
or more metrics.
repeated .google.api.MetricRule metric_rules = 4;
Returns
getMetricRulesList()
public 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;
Returns
getMetricRulesOrBuilder(int index)
public 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;
Parameter
Returns
getMetricRulesOrBuilderList()
public 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;
Returns
Type | Description |
List<? extends com.google.api.MetricRuleOrBuilder> | |
internalGetFieldAccessorTable()
protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Overrides
isInitialized()
public final boolean isInitialized()
Returns
Overrides
mergeFrom(Quota other)
public Quota.Builder mergeFrom(Quota other)
Parameter
Name | Description |
other | Quota
|
Returns
public Quota.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Returns
Overrides
Exceptions
mergeFrom(Message other)
public Quota.Builder mergeFrom(Message other)
Parameter
Returns
Overrides
mergeUnknownFields(UnknownFieldSet unknownFields)
public final Quota.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
Returns
Overrides
removeLimits(int index)
public Quota.Builder removeLimits(int index)
List of QuotaLimit definitions for the service.
repeated .google.api.QuotaLimit limits = 3;
Parameter
Returns
removeMetricRules(int index)
public Quota.Builder removeMetricRules(int index)
List of MetricRule definitions, each one mapping a selected method to one
or more metrics.
repeated .google.api.MetricRule metric_rules = 4;
Parameter
Returns
setField(Descriptors.FieldDescriptor field, Object value)
public Quota.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
Returns
Overrides
setLimits(int index, QuotaLimit value)
public Quota.Builder setLimits(int index, QuotaLimit value)
List of QuotaLimit definitions for the service.
repeated .google.api.QuotaLimit limits = 3;
Parameters
Returns
setLimits(int index, QuotaLimit.Builder builderForValue)
public Quota.Builder setLimits(int index, QuotaLimit.Builder builderForValue)
List of QuotaLimit definitions for the service.
repeated .google.api.QuotaLimit limits = 3;
Parameters
Returns
setMetricRules(int index, MetricRule value)
public Quota.Builder setMetricRules(int index, MetricRule value)
List of MetricRule definitions, each one mapping a selected method to one
or more metrics.
repeated .google.api.MetricRule metric_rules = 4;
Parameters
Returns
setMetricRules(int index, MetricRule.Builder builderForValue)
public Quota.Builder setMetricRules(int index, MetricRule.Builder builderForValue)
List of MetricRule definitions, each one mapping a selected method to one
or more metrics.
repeated .google.api.MetricRule metric_rules = 4;
Parameters
Returns
setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
public Quota.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
Returns
Overrides
setUnknownFields(UnknownFieldSet unknownFields)
public final Quota.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
Returns
Overrides