Class MetricRule.Builder (2.39.1)

public static final class MetricRule.Builder extends GeneratedMessageV3.Builder<MetricRule.Builder> implements MetricRuleOrBuilder

Bind API methods to metrics. Binding a method to a metric causes that metric's configured quota behaviors to apply to the method call.

Protobuf type google.api.MetricRule

Implements

MetricRuleOrBuilder

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptor

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public MetricRule.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
MetricRule.Builder
Overrides

build()

public MetricRule build()
Returns
Type Description
MetricRule

buildPartial()

public MetricRule buildPartial()
Returns
Type Description
MetricRule

clear()

public MetricRule.Builder clear()
Returns
Type Description
MetricRule.Builder
Overrides

clearField(Descriptors.FieldDescriptor field)

public MetricRule.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
Name Description
field FieldDescriptor
Returns
Type Description
MetricRule.Builder
Overrides

clearMetricCosts()

public MetricRule.Builder clearMetricCosts()
Returns
Type Description
MetricRule.Builder

clearOneof(Descriptors.OneofDescriptor oneof)

public MetricRule.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
Name Description
oneof OneofDescriptor
Returns
Type Description
MetricRule.Builder
Overrides

clearSelector()

public MetricRule.Builder clearSelector()

Selects the methods to which this rule applies.

Refer to selector for syntax details.

string selector = 1;

Returns
Type Description
MetricRule.Builder

This builder for chaining.

clone()

public MetricRule.Builder clone()
Returns
Type Description
MetricRule.Builder
Overrides

containsMetricCosts(String key)

public boolean containsMetricCosts(String key)

Metrics to update when the selected methods are called, and the associated cost applied to each metric.

The key of the map is the metric name, and the values are the amount increased for the metric against which the quota limits are defined. The value must not be negative.

map<string, int64> metric_costs = 2;

Parameter
Name Description
key String
Returns
Type Description
boolean

getDefaultInstanceForType()

public MetricRule getDefaultInstanceForType()
Returns
Type Description
MetricRule

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
Type Description
Descriptor
Overrides

getMetricCosts() (deprecated)

public Map<String,Long> getMetricCosts()

Use #getMetricCostsMap() instead.

Returns
Type Description
Map<String,Long>

getMetricCostsCount()

public int getMetricCostsCount()

Metrics to update when the selected methods are called, and the associated cost applied to each metric.

The key of the map is the metric name, and the values are the amount increased for the metric against which the quota limits are defined. The value must not be negative.

map<string, int64> metric_costs = 2;

Returns
Type Description
int

getMetricCostsMap()

public Map<String,Long> getMetricCostsMap()

Metrics to update when the selected methods are called, and the associated cost applied to each metric.

The key of the map is the metric name, and the values are the amount increased for the metric against which the quota limits are defined. The value must not be negative.

map<string, int64> metric_costs = 2;

Returns
Type Description
Map<String,Long>

getMetricCostsOrDefault(String key, long defaultValue)

public long getMetricCostsOrDefault(String key, long defaultValue)

Metrics to update when the selected methods are called, and the associated cost applied to each metric.

The key of the map is the metric name, and the values are the amount increased for the metric against which the quota limits are defined. The value must not be negative.

map<string, int64> metric_costs = 2;

Parameters
Name Description
key String
defaultValue long
Returns
Type Description
long

getMetricCostsOrThrow(String key)

public long getMetricCostsOrThrow(String key)

Metrics to update when the selected methods are called, and the associated cost applied to each metric.

The key of the map is the metric name, and the values are the amount increased for the metric against which the quota limits are defined. The value must not be negative.

map<string, int64> metric_costs = 2;

Parameter
Name Description
key String
Returns
Type Description
long

getMutableMetricCosts() (deprecated)

public Map<String,Long> getMutableMetricCosts()

Use alternate mutation accessors instead.

Returns
Type Description
Map<String,Long>

getSelector()

public String getSelector()

Selects the methods to which this rule applies.

Refer to selector for syntax details.

string selector = 1;

Returns
Type Description
String

The selector.

getSelectorBytes()

public ByteString getSelectorBytes()

Selects the methods to which this rule applies.

Refer to selector for syntax details.

string selector = 1;

Returns
Type Description
ByteString

The bytes for selector.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

internalGetMapFieldReflection(int number)

protected MapFieldReflectionAccessor internalGetMapFieldReflection(int number)
Parameter
Name Description
number int
Returns
Type Description
com.google.protobuf.MapFieldReflectionAccessor
Overrides
com.google.protobuf.GeneratedMessageV3.Builder.internalGetMapFieldReflection(int)

internalGetMutableMapFieldReflection(int number)

protected MapFieldReflectionAccessor internalGetMutableMapFieldReflection(int number)
Parameter
Name Description
number int
Returns
Type Description
com.google.protobuf.MapFieldReflectionAccessor
Overrides
com.google.protobuf.GeneratedMessageV3.Builder.internalGetMutableMapFieldReflection(int)

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

mergeFrom(MetricRule other)

public MetricRule.Builder mergeFrom(MetricRule other)
Parameter
Name Description
other MetricRule
Returns
Type Description
MetricRule.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public MetricRule.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
MetricRule.Builder
Overrides
Exceptions
Type Description
IOException

mergeFrom(Message other)

public MetricRule.Builder mergeFrom(Message other)
Parameter
Name Description
other Message
Returns
Type Description
MetricRule.Builder
Overrides

mergeUnknownFields(UnknownFieldSet unknownFields)

public final MetricRule.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
MetricRule.Builder
Overrides

putAllMetricCosts(Map<String,Long> values)

public MetricRule.Builder putAllMetricCosts(Map<String,Long> values)

Metrics to update when the selected methods are called, and the associated cost applied to each metric.

The key of the map is the metric name, and the values are the amount increased for the metric against which the quota limits are defined. The value must not be negative.

map<string, int64> metric_costs = 2;

Parameter
Name Description
values Map<String,Long>
Returns
Type Description
MetricRule.Builder

putMetricCosts(String key, long value)

public MetricRule.Builder putMetricCosts(String key, long value)

Metrics to update when the selected methods are called, and the associated cost applied to each metric.

The key of the map is the metric name, and the values are the amount increased for the metric against which the quota limits are defined. The value must not be negative.

map<string, int64> metric_costs = 2;

Parameters
Name Description
key String
value long
Returns
Type Description
MetricRule.Builder

removeMetricCosts(String key)

public MetricRule.Builder removeMetricCosts(String key)

Metrics to update when the selected methods are called, and the associated cost applied to each metric.

The key of the map is the metric name, and the values are the amount increased for the metric against which the quota limits are defined. The value must not be negative.

map<string, int64> metric_costs = 2;

Parameter
Name Description
key String
Returns
Type Description
MetricRule.Builder

setField(Descriptors.FieldDescriptor field, Object value)

public MetricRule.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
MetricRule.Builder
Overrides

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

public MetricRule.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
Name Description
field FieldDescriptor
index int
value Object
Returns
Type Description
MetricRule.Builder
Overrides

setSelector(String value)

public MetricRule.Builder setSelector(String value)

Selects the methods to which this rule applies.

Refer to selector for syntax details.

string selector = 1;

Parameter
Name Description
value String

The selector to set.

Returns
Type Description
MetricRule.Builder

This builder for chaining.

setSelectorBytes(ByteString value)

public MetricRule.Builder setSelectorBytes(ByteString value)

Selects the methods to which this rule applies.

Refer to selector for syntax details.

string selector = 1;

Parameter
Name Description
value ByteString

The bytes for selector to set.

Returns
Type Description
MetricRule.Builder

This builder for chaining.

setUnknownFields(UnknownFieldSet unknownFields)

public final MetricRule.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
MetricRule.Builder
Overrides