Class MetricRule.Builder (2.14.2)

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

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

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

build()

public MetricRule build()
Returns
TypeDescription
MetricRule

buildPartial()

public MetricRule buildPartial()
Returns
TypeDescription
MetricRule

clear()

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

clearField(Descriptors.FieldDescriptor field)

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

clearMetricCosts()

public MetricRule.Builder clearMetricCosts()
Returns
TypeDescription
MetricRule.Builder

clearOneof(Descriptors.OneofDescriptor oneof)

public MetricRule.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
NameDescription
oneofOneofDescriptor
Returns
TypeDescription
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
TypeDescription
MetricRule.Builder

This builder for chaining.

clone()

public MetricRule.Builder clone()
Returns
TypeDescription
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
NameDescription
keyString
Returns
TypeDescription
boolean

getDefaultInstanceForType()

public MetricRule getDefaultInstanceForType()
Returns
TypeDescription
MetricRule

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
TypeDescription
Descriptor
Overrides

getMetricCosts()

public Map<String,Long> getMetricCosts()

Use #getMetricCostsMap() instead.

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
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
NameDescription
keyString
defaultValuelong
Returns
TypeDescription
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
NameDescription
keyString
Returns
TypeDescription
long

getMutableMetricCosts()

public Map<String,Long> getMutableMetricCosts()

Use alternate mutation accessors instead.

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
ByteString

The bytes for selector.

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(MetricRule other)

public MetricRule.Builder mergeFrom(MetricRule other)
Parameter
NameDescription
otherMetricRule
Returns
TypeDescription
MetricRule.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

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

mergeFrom(Message other)

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

mergeUnknownFields(UnknownFieldSet unknownFields)

public final MetricRule.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
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
NameDescription
valuesMap<String,Long>
Returns
TypeDescription
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
NameDescription
keyString
valuelong
Returns
TypeDescription
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
NameDescription
keyString
Returns
TypeDescription
MetricRule.Builder

setField(Descriptors.FieldDescriptor field, Object value)

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

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

public MetricRule.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
NameDescription
fieldFieldDescriptor
indexint
valueObject
Returns
TypeDescription
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
NameDescription
valueString

The selector to set.

Returns
TypeDescription
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
NameDescription
valueByteString

The bytes for selector to set.

Returns
TypeDescription
MetricRule.Builder

This builder for chaining.

setUnknownFields(UnknownFieldSet unknownFields)

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