Class MetricRule

public final class MetricRule extends GeneratedMessageV3 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 Fields

METRIC_COSTS_FIELD_NUMBER

public static final int METRIC_COSTS_FIELD_NUMBER
Field Value
TypeDescription
int

SELECTOR_FIELD_NUMBER

public static final int SELECTOR_FIELD_NUMBER
Field Value
TypeDescription
int

Static Methods

getDefaultInstance()

public static MetricRule getDefaultInstance()
Returns
TypeDescription
MetricRule

getDescriptor()

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

newBuilder()

public static MetricRule.Builder newBuilder()
Returns
TypeDescription
MetricRule.Builder

newBuilder(MetricRule prototype)

public static MetricRule.Builder newBuilder(MetricRule prototype)
Parameter
NameDescription
prototypeMetricRule
Returns
TypeDescription
MetricRule.Builder

parseDelimitedFrom(InputStream input)

public static MetricRule parseDelimitedFrom(InputStream input)
Parameter
NameDescription
inputInputStream
Returns
TypeDescription
MetricRule
Exceptions
TypeDescription
IOException

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static MetricRule parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
MetricRule
Exceptions
TypeDescription
IOException

parseFrom(byte[] data)

public static MetricRule parseFrom(byte[] data)
Parameter
NameDescription
databyte[]
Returns
TypeDescription
MetricRule
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

public static MetricRule parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
databyte[]
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
MetricRule
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteString data)

public static MetricRule parseFrom(ByteString data)
Parameter
NameDescription
dataByteString
Returns
TypeDescription
MetricRule
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

public static MetricRule parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
dataByteString
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
MetricRule
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(CodedInputStream input)

public static MetricRule parseFrom(CodedInputStream input)
Parameter
NameDescription
inputCodedInputStream
Returns
TypeDescription
MetricRule
Exceptions
TypeDescription
IOException

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public static MetricRule parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputCodedInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
MetricRule
Exceptions
TypeDescription
IOException

parseFrom(InputStream input)

public static MetricRule parseFrom(InputStream input)
Parameter
NameDescription
inputInputStream
Returns
TypeDescription
MetricRule
Exceptions
TypeDescription
IOException

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static MetricRule parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
MetricRule
Exceptions
TypeDescription
IOException

parseFrom(ByteBuffer data)

public static MetricRule parseFrom(ByteBuffer data)
Parameter
NameDescription
dataByteBuffer
Returns
TypeDescription
MetricRule
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

public static MetricRule parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
dataByteBuffer
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
MetricRule
Exceptions
TypeDescription
InvalidProtocolBufferException

parser()

public static Parser<MetricRule> parser()
Returns
TypeDescription
Parser<MetricRule>

Methods

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

equals(Object obj)

public boolean equals(Object obj)
Parameter
NameDescription
objObject
Returns
TypeDescription
boolean
Overrides

getDefaultInstanceForType()

public MetricRule getDefaultInstanceForType()
Returns
TypeDescription
MetricRule

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

getParserForType()

public Parser<MetricRule> getParserForType()
Returns
TypeDescription
Parser<MetricRule>
Overrides

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.

getSerializedSize()

public int getSerializedSize()
Returns
TypeDescription
int
Overrides

getUnknownFields()

public final UnknownFieldSet getUnknownFields()
Returns
TypeDescription
UnknownFieldSet
Overrides

hashCode()

public int hashCode()
Returns
TypeDescription
int
Overrides

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

internalGetMapField(int number)

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

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

newBuilderForType()

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

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

protected MetricRule.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Parameter
NameDescription
parentBuilderParent
Returns
TypeDescription
MetricRule.Builder
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Parameter
NameDescription
unusedUnusedPrivateParameter
Returns
TypeDescription
Object
Overrides

toBuilder()

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

writeTo(CodedOutputStream output)

public void writeTo(CodedOutputStream output)
Parameter
NameDescription
outputCodedOutputStream
Overrides Exceptions
TypeDescription
IOException