Class QuotaLimit.Builder (2.24.0)

public static final class QuotaLimit.Builder extends GeneratedMessageV3.Builder<QuotaLimit.Builder> implements QuotaLimitOrBuilder

QuotaLimit defines a specific limit that applies over a specified duration for a limit type. There can be at most one limit for a duration and limit type combination defined within a QuotaGroup.

Protobuf type google.api.QuotaLimit

Implements

QuotaLimitOrBuilder

Static Methods

getDescriptor()

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

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

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

build()

public QuotaLimit build()
Returns
TypeDescription
QuotaLimit

buildPartial()

public QuotaLimit buildPartial()
Returns
TypeDescription
QuotaLimit

clear()

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

clearDefaultLimit()

public QuotaLimit.Builder clearDefaultLimit()

Default number of tokens that can be consumed during the specified duration. This is the number of tokens assigned when a client application developer activates the service for his/her project.

Specifying a value of 0 will block all requests. This can be used if you are provisioning quota to selected consumers and blocking others. Similarly, a value of -1 will indicate an unlimited quota. No other negative values are allowed.

Used by group-based quotas only.

int64 default_limit = 3;

Returns
TypeDescription
QuotaLimit.Builder

This builder for chaining.

clearDescription()

public QuotaLimit.Builder clearDescription()

Optional. User-visible, extended description for this quota limit. Should be used only when more context is needed to understand this limit than provided by the limit's display name (see: display_name).

string description = 2;

Returns
TypeDescription
QuotaLimit.Builder

This builder for chaining.

clearDisplayName()

public QuotaLimit.Builder clearDisplayName()

User-visible display name for this limit. Optional. If not set, the UI will provide a default display name based on the quota configuration. This field can be used to override the default display name generated from the configuration.

string display_name = 12;

Returns
TypeDescription
QuotaLimit.Builder

This builder for chaining.

clearDuration()

public QuotaLimit.Builder clearDuration()

Duration of this limit in textual notation. Must be "100s" or "1d".

Used by group-based quotas only.

string duration = 5;

Returns
TypeDescription
QuotaLimit.Builder

This builder for chaining.

clearField(Descriptors.FieldDescriptor field)

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

clearFreeTier()

public QuotaLimit.Builder clearFreeTier()

Free tier value displayed in the Developers Console for this limit. The free tier is the number of tokens that will be subtracted from the billed amount when billing is enabled. This field can only be set on a limit with duration "1d", in a billable group; it is invalid on any other limit. If this field is not set, it defaults to 0, indicating that there is no free tier for this service.

Used by group-based quotas only.

int64 free_tier = 7;

Returns
TypeDescription
QuotaLimit.Builder

This builder for chaining.

clearMaxLimit()

public QuotaLimit.Builder clearMaxLimit()

Maximum number of tokens that can be consumed during the specified duration. Client application developers can override the default limit up to this maximum. If specified, this value cannot be set to a value less than the default limit. If not specified, it is set to the default limit.

To allow clients to apply overrides with no upper bound, set this to -1, indicating unlimited maximum quota.

Used by group-based quotas only.

int64 max_limit = 4;

Returns
TypeDescription
QuotaLimit.Builder

This builder for chaining.

clearMetric()

public QuotaLimit.Builder clearMetric()

The name of the metric this quota limit applies to. The quota limits with the same metric will be checked together during runtime. The metric must be defined within the service config.

string metric = 8;

Returns
TypeDescription
QuotaLimit.Builder

This builder for chaining.

clearName()

public QuotaLimit.Builder clearName()

Name of the quota limit.

The name must be provided, and it must be unique within the service. The name can only include alphanumeric characters as well as '-'.

The maximum length of the limit name is 64 characters.

string name = 6;

Returns
TypeDescription
QuotaLimit.Builder

This builder for chaining.

clearOneof(Descriptors.OneofDescriptor oneof)

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

clearUnit()

public QuotaLimit.Builder clearUnit()

Specify the unit of the quota limit. It uses the same syntax as [Metric.unit][]. The supported unit kinds are determined by the quota backend system.

Here are some examples:

  • "1/min/{project}" for quota per minute per project.

    Note: the order of unit components is insignificant. The "1" at the beginning is required to follow the metric unit syntax.

string unit = 9;

Returns
TypeDescription
QuotaLimit.Builder

This builder for chaining.

clearValues()

public QuotaLimit.Builder clearValues()
Returns
TypeDescription
QuotaLimit.Builder

clone()

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

containsValues(String key)

public boolean containsValues(String key)

Tiered limit values. You must specify this as a key:value pair, with an integer value that is the maximum number of requests allowed for the specified unit. Currently only STANDARD is supported.

map<string, int64> values = 10;

Parameter
NameDescription
keyString
Returns
TypeDescription
boolean

getDefaultInstanceForType()

public QuotaLimit getDefaultInstanceForType()
Returns
TypeDescription
QuotaLimit

getDefaultLimit()

public long getDefaultLimit()

Default number of tokens that can be consumed during the specified duration. This is the number of tokens assigned when a client application developer activates the service for his/her project.

Specifying a value of 0 will block all requests. This can be used if you are provisioning quota to selected consumers and blocking others. Similarly, a value of -1 will indicate an unlimited quota. No other negative values are allowed.

Used by group-based quotas only.

int64 default_limit = 3;

Returns
TypeDescription
long

The defaultLimit.

getDescription()

public String getDescription()

Optional. User-visible, extended description for this quota limit. Should be used only when more context is needed to understand this limit than provided by the limit's display name (see: display_name).

string description = 2;

Returns
TypeDescription
String

The description.

getDescriptionBytes()

public ByteString getDescriptionBytes()

Optional. User-visible, extended description for this quota limit. Should be used only when more context is needed to understand this limit than provided by the limit's display name (see: display_name).

string description = 2;

Returns
TypeDescription
ByteString

The bytes for description.

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
TypeDescription
Descriptor
Overrides

getDisplayName()

public String getDisplayName()

User-visible display name for this limit. Optional. If not set, the UI will provide a default display name based on the quota configuration. This field can be used to override the default display name generated from the configuration.

string display_name = 12;

Returns
TypeDescription
String

The displayName.

getDisplayNameBytes()

public ByteString getDisplayNameBytes()

User-visible display name for this limit. Optional. If not set, the UI will provide a default display name based on the quota configuration. This field can be used to override the default display name generated from the configuration.

string display_name = 12;

Returns
TypeDescription
ByteString

The bytes for displayName.

getDuration()

public String getDuration()

Duration of this limit in textual notation. Must be "100s" or "1d".

Used by group-based quotas only.

string duration = 5;

Returns
TypeDescription
String

The duration.

getDurationBytes()

public ByteString getDurationBytes()

Duration of this limit in textual notation. Must be "100s" or "1d".

Used by group-based quotas only.

string duration = 5;

Returns
TypeDescription
ByteString

The bytes for duration.

getFreeTier()

public long getFreeTier()

Free tier value displayed in the Developers Console for this limit. The free tier is the number of tokens that will be subtracted from the billed amount when billing is enabled. This field can only be set on a limit with duration "1d", in a billable group; it is invalid on any other limit. If this field is not set, it defaults to 0, indicating that there is no free tier for this service.

Used by group-based quotas only.

int64 free_tier = 7;

Returns
TypeDescription
long

The freeTier.

getMaxLimit()

public long getMaxLimit()

Maximum number of tokens that can be consumed during the specified duration. Client application developers can override the default limit up to this maximum. If specified, this value cannot be set to a value less than the default limit. If not specified, it is set to the default limit.

To allow clients to apply overrides with no upper bound, set this to -1, indicating unlimited maximum quota.

Used by group-based quotas only.

int64 max_limit = 4;

Returns
TypeDescription
long

The maxLimit.

getMetric()

public String getMetric()

The name of the metric this quota limit applies to. The quota limits with the same metric will be checked together during runtime. The metric must be defined within the service config.

string metric = 8;

Returns
TypeDescription
String

The metric.

getMetricBytes()

public ByteString getMetricBytes()

The name of the metric this quota limit applies to. The quota limits with the same metric will be checked together during runtime. The metric must be defined within the service config.

string metric = 8;

Returns
TypeDescription
ByteString

The bytes for metric.

getMutableValues()

public Map<String,Long> getMutableValues()

Use alternate mutation accessors instead.

Returns
TypeDescription
Map<String,Long>

getName()

public String getName()

Name of the quota limit.

The name must be provided, and it must be unique within the service. The name can only include alphanumeric characters as well as '-'.

The maximum length of the limit name is 64 characters.

string name = 6;

Returns
TypeDescription
String

The name.

getNameBytes()

public ByteString getNameBytes()

Name of the quota limit.

The name must be provided, and it must be unique within the service. The name can only include alphanumeric characters as well as '-'.

The maximum length of the limit name is 64 characters.

string name = 6;

Returns
TypeDescription
ByteString

The bytes for name.

getUnit()

public String getUnit()

Specify the unit of the quota limit. It uses the same syntax as [Metric.unit][]. The supported unit kinds are determined by the quota backend system.

Here are some examples:

  • "1/min/{project}" for quota per minute per project.

    Note: the order of unit components is insignificant. The "1" at the beginning is required to follow the metric unit syntax.

string unit = 9;

Returns
TypeDescription
String

The unit.

getUnitBytes()

public ByteString getUnitBytes()

Specify the unit of the quota limit. It uses the same syntax as [Metric.unit][]. The supported unit kinds are determined by the quota backend system.

Here are some examples:

  • "1/min/{project}" for quota per minute per project.

    Note: the order of unit components is insignificant. The "1" at the beginning is required to follow the metric unit syntax.

string unit = 9;

Returns
TypeDescription
ByteString

The bytes for unit.

getValues()

public Map<String,Long> getValues()

Use #getValuesMap() instead.

Returns
TypeDescription
Map<String,Long>

getValuesCount()

public int getValuesCount()

Tiered limit values. You must specify this as a key:value pair, with an integer value that is the maximum number of requests allowed for the specified unit. Currently only STANDARD is supported.

map<string, int64> values = 10;

Returns
TypeDescription
int

getValuesMap()

public Map<String,Long> getValuesMap()

Tiered limit values. You must specify this as a key:value pair, with an integer value that is the maximum number of requests allowed for the specified unit. Currently only STANDARD is supported.

map<string, int64> values = 10;

Returns
TypeDescription
Map<String,Long>

getValuesOrDefault(String key, long defaultValue)

public long getValuesOrDefault(String key, long defaultValue)

Tiered limit values. You must specify this as a key:value pair, with an integer value that is the maximum number of requests allowed for the specified unit. Currently only STANDARD is supported.

map<string, int64> values = 10;

Parameters
NameDescription
keyString
defaultValuelong
Returns
TypeDescription
long

getValuesOrThrow(String key)

public long getValuesOrThrow(String key)

Tiered limit values. You must specify this as a key:value pair, with an integer value that is the maximum number of requests allowed for the specified unit. Currently only STANDARD is supported.

map<string, int64> values = 10;

Parameter
NameDescription
keyString
Returns
TypeDescription
long

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

internalGetMapField(int number)

protected MapField internalGetMapField(int number)
Parameter
NameDescription
numberint
Returns
TypeDescription
MapField
Overrides

internalGetMutableMapField(int number)

protected MapField internalGetMutableMapField(int number)
Parameter
NameDescription
numberint
Returns
TypeDescription
MapField
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

mergeFrom(QuotaLimit other)

public QuotaLimit.Builder mergeFrom(QuotaLimit other)
Parameter
NameDescription
otherQuotaLimit
Returns
TypeDescription
QuotaLimit.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

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

mergeFrom(Message other)

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

mergeUnknownFields(UnknownFieldSet unknownFields)

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

putAllValues(Map<String,Long> values)

public QuotaLimit.Builder putAllValues(Map<String,Long> values)

Tiered limit values. You must specify this as a key:value pair, with an integer value that is the maximum number of requests allowed for the specified unit. Currently only STANDARD is supported.

map<string, int64> values = 10;

Parameter
NameDescription
valuesMap<String,Long>
Returns
TypeDescription
QuotaLimit.Builder

putValues(String key, long value)

public QuotaLimit.Builder putValues(String key, long value)

Tiered limit values. You must specify this as a key:value pair, with an integer value that is the maximum number of requests allowed for the specified unit. Currently only STANDARD is supported.

map<string, int64> values = 10;

Parameters
NameDescription
keyString
valuelong
Returns
TypeDescription
QuotaLimit.Builder

removeValues(String key)

public QuotaLimit.Builder removeValues(String key)

Tiered limit values. You must specify this as a key:value pair, with an integer value that is the maximum number of requests allowed for the specified unit. Currently only STANDARD is supported.

map<string, int64> values = 10;

Parameter
NameDescription
keyString
Returns
TypeDescription
QuotaLimit.Builder

setDefaultLimit(long value)

public QuotaLimit.Builder setDefaultLimit(long value)

Default number of tokens that can be consumed during the specified duration. This is the number of tokens assigned when a client application developer activates the service for his/her project.

Specifying a value of 0 will block all requests. This can be used if you are provisioning quota to selected consumers and blocking others. Similarly, a value of -1 will indicate an unlimited quota. No other negative values are allowed.

Used by group-based quotas only.

int64 default_limit = 3;

Parameter
NameDescription
valuelong

The defaultLimit to set.

Returns
TypeDescription
QuotaLimit.Builder

This builder for chaining.

setDescription(String value)

public QuotaLimit.Builder setDescription(String value)

Optional. User-visible, extended description for this quota limit. Should be used only when more context is needed to understand this limit than provided by the limit's display name (see: display_name).

string description = 2;

Parameter
NameDescription
valueString

The description to set.

Returns
TypeDescription
QuotaLimit.Builder

This builder for chaining.

setDescriptionBytes(ByteString value)

public QuotaLimit.Builder setDescriptionBytes(ByteString value)

Optional. User-visible, extended description for this quota limit. Should be used only when more context is needed to understand this limit than provided by the limit's display name (see: display_name).

string description = 2;

Parameter
NameDescription
valueByteString

The bytes for description to set.

Returns
TypeDescription
QuotaLimit.Builder

This builder for chaining.

setDisplayName(String value)

public QuotaLimit.Builder setDisplayName(String value)

User-visible display name for this limit. Optional. If not set, the UI will provide a default display name based on the quota configuration. This field can be used to override the default display name generated from the configuration.

string display_name = 12;

Parameter
NameDescription
valueString

The displayName to set.

Returns
TypeDescription
QuotaLimit.Builder

This builder for chaining.

setDisplayNameBytes(ByteString value)

public QuotaLimit.Builder setDisplayNameBytes(ByteString value)

User-visible display name for this limit. Optional. If not set, the UI will provide a default display name based on the quota configuration. This field can be used to override the default display name generated from the configuration.

string display_name = 12;

Parameter
NameDescription
valueByteString

The bytes for displayName to set.

Returns
TypeDescription
QuotaLimit.Builder

This builder for chaining.

setDuration(String value)

public QuotaLimit.Builder setDuration(String value)

Duration of this limit in textual notation. Must be "100s" or "1d".

Used by group-based quotas only.

string duration = 5;

Parameter
NameDescription
valueString

The duration to set.

Returns
TypeDescription
QuotaLimit.Builder

This builder for chaining.

setDurationBytes(ByteString value)

public QuotaLimit.Builder setDurationBytes(ByteString value)

Duration of this limit in textual notation. Must be "100s" or "1d".

Used by group-based quotas only.

string duration = 5;

Parameter
NameDescription
valueByteString

The bytes for duration to set.

Returns
TypeDescription
QuotaLimit.Builder

This builder for chaining.

setField(Descriptors.FieldDescriptor field, Object value)

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

setFreeTier(long value)

public QuotaLimit.Builder setFreeTier(long value)

Free tier value displayed in the Developers Console for this limit. The free tier is the number of tokens that will be subtracted from the billed amount when billing is enabled. This field can only be set on a limit with duration "1d", in a billable group; it is invalid on any other limit. If this field is not set, it defaults to 0, indicating that there is no free tier for this service.

Used by group-based quotas only.

int64 free_tier = 7;

Parameter
NameDescription
valuelong

The freeTier to set.

Returns
TypeDescription
QuotaLimit.Builder

This builder for chaining.

setMaxLimit(long value)

public QuotaLimit.Builder setMaxLimit(long value)

Maximum number of tokens that can be consumed during the specified duration. Client application developers can override the default limit up to this maximum. If specified, this value cannot be set to a value less than the default limit. If not specified, it is set to the default limit.

To allow clients to apply overrides with no upper bound, set this to -1, indicating unlimited maximum quota.

Used by group-based quotas only.

int64 max_limit = 4;

Parameter
NameDescription
valuelong

The maxLimit to set.

Returns
TypeDescription
QuotaLimit.Builder

This builder for chaining.

setMetric(String value)

public QuotaLimit.Builder setMetric(String value)

The name of the metric this quota limit applies to. The quota limits with the same metric will be checked together during runtime. The metric must be defined within the service config.

string metric = 8;

Parameter
NameDescription
valueString

The metric to set.

Returns
TypeDescription
QuotaLimit.Builder

This builder for chaining.

setMetricBytes(ByteString value)

public QuotaLimit.Builder setMetricBytes(ByteString value)

The name of the metric this quota limit applies to. The quota limits with the same metric will be checked together during runtime. The metric must be defined within the service config.

string metric = 8;

Parameter
NameDescription
valueByteString

The bytes for metric to set.

Returns
TypeDescription
QuotaLimit.Builder

This builder for chaining.

setName(String value)

public QuotaLimit.Builder setName(String value)

Name of the quota limit.

The name must be provided, and it must be unique within the service. The name can only include alphanumeric characters as well as '-'.

The maximum length of the limit name is 64 characters.

string name = 6;

Parameter
NameDescription
valueString

The name to set.

Returns
TypeDescription
QuotaLimit.Builder

This builder for chaining.

setNameBytes(ByteString value)

public QuotaLimit.Builder setNameBytes(ByteString value)

Name of the quota limit.

The name must be provided, and it must be unique within the service. The name can only include alphanumeric characters as well as '-'.

The maximum length of the limit name is 64 characters.

string name = 6;

Parameter
NameDescription
valueByteString

The bytes for name to set.

Returns
TypeDescription
QuotaLimit.Builder

This builder for chaining.

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

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

setUnit(String value)

public QuotaLimit.Builder setUnit(String value)

Specify the unit of the quota limit. It uses the same syntax as [Metric.unit][]. The supported unit kinds are determined by the quota backend system.

Here are some examples:

  • "1/min/{project}" for quota per minute per project.

    Note: the order of unit components is insignificant. The "1" at the beginning is required to follow the metric unit syntax.

string unit = 9;

Parameter
NameDescription
valueString

The unit to set.

Returns
TypeDescription
QuotaLimit.Builder

This builder for chaining.

setUnitBytes(ByteString value)

public QuotaLimit.Builder setUnitBytes(ByteString value)

Specify the unit of the quota limit. It uses the same syntax as [Metric.unit][]. The supported unit kinds are determined by the quota backend system.

Here are some examples:

  • "1/min/{project}" for quota per minute per project.

    Note: the order of unit components is insignificant. The "1" at the beginning is required to follow the metric unit syntax.

string unit = 9;

Parameter
NameDescription
valueByteString

The bytes for unit to set.

Returns
TypeDescription
QuotaLimit.Builder

This builder for chaining.

setUnknownFields(UnknownFieldSet unknownFields)

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