com.google.api.quota.Quota.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pekko-connectors-google-cloud-bigquery-storage_3 Show documentation
Show all versions of pekko-connectors-google-cloud-bigquery-storage_3 Show documentation
Apache Pekko Connectors is a Reactive Enterprise Integration library for Java and Scala, based on Reactive Streams and Pekko.
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO3
package com.google.api.quota
/** 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
*
* @param limits
* List of QuotaLimit definitions for the service.
* @param metricRules
* List of MetricRule definitions, each one mapping a selected method to one
* or more metrics.
*/
@SerialVersionUID(0L)
final case class Quota(
limits: _root_.scala.Seq[com.google.api.quota.QuotaLimit] = _root_.scala.Seq.empty,
metricRules: _root_.scala.Seq[com.google.api.quota.MetricRule] = _root_.scala.Seq.empty,
unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[Quota] {
@transient
private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
private[this] def __computeSerializedSize(): _root_.scala.Int = {
var __size = 0
limits.foreach { __item =>
val __value = __item
__size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
}
metricRules.foreach { __item =>
val __value = __item
__size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
}
__size += unknownFields.serializedSize
__size
}
override def serializedSize: _root_.scala.Int = {
var __size = __serializedSizeMemoized
if (__size == 0) {
__size = __computeSerializedSize() + 1
__serializedSizeMemoized = __size
}
__size - 1
}
def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = {
limits.foreach { __v =>
val __m = __v
_output__.writeTag(3, 2)
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
metricRules.foreach { __v =>
val __m = __v
_output__.writeTag(4, 2)
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
unknownFields.writeTo(_output__)
}
def clearLimits = copy(limits = _root_.scala.Seq.empty)
def addLimits(__vs: com.google.api.quota.QuotaLimit *): Quota = addAllLimits(__vs)
def addAllLimits(__vs: Iterable[com.google.api.quota.QuotaLimit]): Quota = copy(limits = limits ++ __vs)
def withLimits(__v: _root_.scala.Seq[com.google.api.quota.QuotaLimit]): Quota = copy(limits = __v)
def clearMetricRules = copy(metricRules = _root_.scala.Seq.empty)
def addMetricRules(__vs: com.google.api.quota.MetricRule *): Quota = addAllMetricRules(__vs)
def addAllMetricRules(__vs: Iterable[com.google.api.quota.MetricRule]): Quota = copy(metricRules = metricRules ++ __vs)
def withMetricRules(__v: _root_.scala.Seq[com.google.api.quota.MetricRule]): Quota = copy(metricRules = __v)
def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v)
def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty)
def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = {
(__fieldNumber: @_root_.scala.unchecked) match {
case 3 => limits
case 4 => metricRules
}
}
def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = {
_root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor)
(__field.number: @_root_.scala.unchecked) match {
case 3 => _root_.scalapb.descriptors.PRepeated(limits.iterator.map(_.toPMessage).toVector)
case 4 => _root_.scalapb.descriptors.PRepeated(metricRules.iterator.map(_.toPMessage).toVector)
}
}
def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
def companion: com.google.api.quota.Quota.type = com.google.api.quota.Quota
// @@protoc_insertion_point(GeneratedMessage[google.api.Quota])
}
object Quota extends scalapb.GeneratedMessageCompanion[com.google.api.quota.Quota] {
implicit def messageCompanion: scalapb.GeneratedMessageCompanion[com.google.api.quota.Quota] = this
def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): com.google.api.quota.Quota = {
val __limits: _root_.scala.collection.immutable.VectorBuilder[com.google.api.quota.QuotaLimit] = new _root_.scala.collection.immutable.VectorBuilder[com.google.api.quota.QuotaLimit]
val __metricRules: _root_.scala.collection.immutable.VectorBuilder[com.google.api.quota.MetricRule] = new _root_.scala.collection.immutable.VectorBuilder[com.google.api.quota.MetricRule]
var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
var _done__ = false
while (!_done__) {
val _tag__ = _input__.readTag()
_tag__ match {
case 0 => _done__ = true
case 26 =>
__limits += _root_.scalapb.LiteParser.readMessage[com.google.api.quota.QuotaLimit](_input__)
case 34 =>
__metricRules += _root_.scalapb.LiteParser.readMessage[com.google.api.quota.MetricRule](_input__)
case tag =>
if (_unknownFields__ == null) {
_unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
}
_unknownFields__.parseField(tag, _input__)
}
}
com.google.api.quota.Quota(
limits = __limits.result(),
metricRules = __metricRules.result(),
unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
)
}
implicit def messageReads: _root_.scalapb.descriptors.Reads[com.google.api.quota.Quota] = _root_.scalapb.descriptors.Reads{
case _root_.scalapb.descriptors.PMessage(__fieldsMap) =>
_root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.")
com.google.api.quota.Quota(
limits = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Seq[com.google.api.quota.QuotaLimit]]).getOrElse(_root_.scala.Seq.empty),
metricRules = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scala.Seq[com.google.api.quota.MetricRule]]).getOrElse(_root_.scala.Seq.empty)
)
case _ => throw new RuntimeException("Expected PMessage")
}
def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = QuotaProto.javaDescriptor.getMessageTypes().get(0)
def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = QuotaProto.scalaDescriptor.messages(0)
def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
(__number: @_root_.scala.unchecked) match {
case 3 => __out = com.google.api.quota.QuotaLimit
case 4 => __out = com.google.api.quota.MetricRule
}
__out
}
lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty
def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber)
lazy val defaultInstance = com.google.api.quota.Quota(
limits = _root_.scala.Seq.empty,
metricRules = _root_.scala.Seq.empty
)
implicit class QuotaLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, com.google.api.quota.Quota]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, com.google.api.quota.Quota](_l) {
def limits: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[com.google.api.quota.QuotaLimit]] = field(_.limits)((c_, f_) => c_.copy(limits = f_))
def metricRules: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[com.google.api.quota.MetricRule]] = field(_.metricRules)((c_, f_) => c_.copy(metricRules = f_))
}
final val LIMITS_FIELD_NUMBER = 3
final val METRIC_RULES_FIELD_NUMBER = 4
def of(
limits: _root_.scala.Seq[com.google.api.quota.QuotaLimit],
metricRules: _root_.scala.Seq[com.google.api.quota.MetricRule]
): _root_.com.google.api.quota.Quota = _root_.com.google.api.quota.Quota(
limits,
metricRules
)
// @@protoc_insertion_point(GeneratedMessageCompanion[google.api.Quota])
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy