Class Quota.Builder (2.11.0)

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

Implements

QuotaOrBuilder

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
TypeDescription
Descriptor

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
NameDescription
valuesIterable<? extends com.google.api.QuotaLimit>
Returns
TypeDescription
Quota.Builder

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
NameDescription
valuesIterable<? extends com.google.api.MetricRule>
Returns
TypeDescription
Quota.Builder

addLimits(QuotaLimit value)

public Quota.Builder addLimits(QuotaLimit value)

List of QuotaLimit definitions for the service.

repeated .google.api.QuotaLimit limits = 3;

Parameter
NameDescription
valueQuotaLimit
Returns
TypeDescription
Quota.Builder

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
NameDescription
builderForValueQuotaLimit.Builder
Returns
TypeDescription
Quota.Builder

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
NameDescription
indexint
valueQuotaLimit
Returns
TypeDescription
Quota.Builder

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
NameDescription
indexint
builderForValueQuotaLimit.Builder
Returns
TypeDescription
Quota.Builder

addLimitsBuilder()

public QuotaLimit.Builder addLimitsBuilder()

List of QuotaLimit definitions for the service.

repeated .google.api.QuotaLimit limits = 3;

Returns
TypeDescription
QuotaLimit.Builder

addLimitsBuilder(int index)

public QuotaLimit.Builder addLimitsBuilder(int index)

List of QuotaLimit definitions for the service.

repeated .google.api.QuotaLimit limits = 3;

Parameter
NameDescription
indexint
Returns
TypeDescription
QuotaLimit.Builder

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
NameDescription
valueMetricRule
Returns
TypeDescription
Quota.Builder

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
NameDescription
builderForValueMetricRule.Builder
Returns
TypeDescription
Quota.Builder

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
NameDescription
indexint
valueMetricRule
Returns
TypeDescription
Quota.Builder

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
NameDescription
indexint
builderForValueMetricRule.Builder
Returns
TypeDescription
Quota.Builder

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
TypeDescription
MetricRule.Builder

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
NameDescription
indexint
Returns
TypeDescription
MetricRule.Builder

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public Quota.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
Quota.Builder
Overrides

build()

public Quota build()
Returns
TypeDescription
Quota

buildPartial()

public Quota buildPartial()
Returns
TypeDescription
Quota

clear()

public Quota.Builder clear()
Returns
TypeDescription
Quota.Builder
Overrides

clearField(Descriptors.FieldDescriptor field)

public Quota.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
NameDescription
fieldFieldDescriptor
Returns
TypeDescription
Quota.Builder
Overrides

clearLimits()

public Quota.Builder clearLimits()

List of QuotaLimit definitions for the service.

repeated .google.api.QuotaLimit limits = 3;

Returns
TypeDescription
Quota.Builder

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
TypeDescription
Quota.Builder

clearOneof(Descriptors.OneofDescriptor oneof)

public Quota.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
NameDescription
oneofOneofDescriptor
Returns
TypeDescription
Quota.Builder
Overrides

clone()

public Quota.Builder clone()
Returns
TypeDescription
Quota.Builder
Overrides

getDefaultInstanceForType()

public Quota getDefaultInstanceForType()
Returns
TypeDescription
Quota

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
TypeDescription
Descriptor
Overrides

getLimits(int index)

public QuotaLimit getLimits(int index)

List of QuotaLimit definitions for the service.

repeated .google.api.QuotaLimit limits = 3;

Parameter
NameDescription
indexint
Returns
TypeDescription
QuotaLimit

getLimitsBuilder(int index)

public QuotaLimit.Builder getLimitsBuilder(int index)

List of QuotaLimit definitions for the service.

repeated .google.api.QuotaLimit limits = 3;

Parameter
NameDescription
indexint
Returns
TypeDescription
QuotaLimit.Builder

getLimitsBuilderList()

public List<QuotaLimit.Builder> getLimitsBuilderList()

List of QuotaLimit definitions for the service.

repeated .google.api.QuotaLimit limits = 3;

Returns
TypeDescription
List<Builder>

getLimitsCount()

public int getLimitsCount()

List of QuotaLimit definitions for the service.

repeated .google.api.QuotaLimit limits = 3;

Returns
TypeDescription
int

getLimitsList()

public List<QuotaLimit> getLimitsList()

List of QuotaLimit definitions for the service.

repeated .google.api.QuotaLimit limits = 3;

Returns
TypeDescription
List<QuotaLimit>

getLimitsOrBuilder(int index)

public QuotaLimitOrBuilder getLimitsOrBuilder(int index)

List of QuotaLimit definitions for the service.

repeated .google.api.QuotaLimit limits = 3;

Parameter
NameDescription
indexint
Returns
TypeDescription
QuotaLimitOrBuilder

getLimitsOrBuilderList()

public List<? extends QuotaLimitOrBuilder> getLimitsOrBuilderList()

List of QuotaLimit definitions for the service.

repeated .google.api.QuotaLimit limits = 3;

Returns
TypeDescription
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
NameDescription
indexint
Returns
TypeDescription
MetricRule

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
NameDescription
indexint
Returns
TypeDescription
MetricRule.Builder

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
TypeDescription
List<Builder>

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
TypeDescription
int

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
TypeDescription
List<MetricRule>

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
NameDescription
indexint
Returns
TypeDescription
MetricRuleOrBuilder

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
TypeDescription
List<? extends com.google.api.MetricRuleOrBuilder>

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

mergeFrom(Quota other)

public Quota.Builder mergeFrom(Quota other)
Parameter
NameDescription
otherQuota
Returns
TypeDescription
Quota.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public Quota.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputCodedInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Quota.Builder
Overrides Exceptions
TypeDescription
IOException

mergeFrom(Message other)

public Quota.Builder mergeFrom(Message other)
Parameter
NameDescription
otherMessage
Returns
TypeDescription
Quota.Builder
Overrides

mergeUnknownFields(UnknownFieldSet unknownFields)

public final Quota.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
Quota.Builder
Overrides

removeLimits(int index)

public Quota.Builder removeLimits(int index)

List of QuotaLimit definitions for the service.

repeated .google.api.QuotaLimit limits = 3;

Parameter
NameDescription
indexint
Returns
TypeDescription
Quota.Builder

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
NameDescription
indexint
Returns
TypeDescription
Quota.Builder

setField(Descriptors.FieldDescriptor field, Object value)

public Quota.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
Quota.Builder
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
NameDescription
indexint
valueQuotaLimit
Returns
TypeDescription
Quota.Builder

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
NameDescription
indexint
builderForValueQuotaLimit.Builder
Returns
TypeDescription
Quota.Builder

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
NameDescription
indexint
valueMetricRule
Returns
TypeDescription
Quota.Builder

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
NameDescription
indexint
builderForValueMetricRule.Builder
Returns
TypeDescription
Quota.Builder

setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

public Quota.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
NameDescription
fieldFieldDescriptor
indexint
valueObject
Returns
TypeDescription
Quota.Builder
Overrides

setUnknownFields(UnknownFieldSet unknownFields)

public final Quota.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
Quota.Builder
Overrides