final case class Quota(limits: Seq[QuotaLimit] = _root_.scala.Seq.empty, metricRules: Seq[MetricRule] = _root_.scala.Seq.empty, unknownFields: UnknownFieldSet = ...) extends GeneratedMessage with Updatable[Quota] with Product with Serializable
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
- limits
List of
QuotaLimitdefinitions for the service.- metricRules
List of
MetricRuledefinitions, each one mapping a selected method to one or more metrics.
- Annotations
- @SerialVersionUID()
- Alphabetic
- By Inheritance
- Quota
- Product
- Equals
- Updatable
- GeneratedMessage
- Serializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
Quota(limits: Seq[QuotaLimit] = _root_.scala.Seq.empty, metricRules: Seq[MetricRule] = _root_.scala.Seq.empty, unknownFields: UnknownFieldSet = ...)
- limits
List of
QuotaLimitdefinitions for the service.- metricRules
List of
MetricRuledefinitions, each one mapping a selected method to one or more metrics.
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def addAllLimits(__vs: Iterable[QuotaLimit]): Quota
- def addAllMetricRules(__vs: Iterable[MetricRule]): Quota
- def addLimits(__vs: QuotaLimit*): Quota
- def addMetricRules(__vs: MetricRule*): Quota
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clearLimits: Quota
- def clearMetricRules: Quota
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
companion: Quota.type
- Definition Classes
- Quota → GeneratedMessage
- def discardUnknownFields: Quota
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
getField(__field: FieldDescriptor): PValue
- Definition Classes
- Quota → GeneratedMessage
-
def
getFieldByNumber(__fieldNumber: Int): Any
- Definition Classes
- Quota → GeneratedMessage
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- val limits: Seq[QuotaLimit]
- val metricRules: Seq[MetricRule]
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
serializedSize: Int
- Definition Classes
- Quota → GeneratedMessage
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
final
def
toByteArray: Array[Byte]
- Definition Classes
- GeneratedMessage
-
final
def
toByteString: ByteString
- Definition Classes
- GeneratedMessage
-
final
def
toPMessage: PMessage
- Definition Classes
- GeneratedMessage
-
def
toProtoString: String
- Definition Classes
- Quota → GeneratedMessage
- val unknownFields: UnknownFieldSet
-
def
update(ms: (Lens[Quota, Quota]) ⇒ Mutation[Quota]*): Quota
- Definition Classes
- Updatable
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
- def withLimits(__v: Seq[QuotaLimit]): Quota
- def withMetricRules(__v: Seq[MetricRule]): Quota
- def withUnknownFields(__v: UnknownFieldSet): Quota
-
final
def
writeDelimitedTo(output: OutputStream): Unit
- Definition Classes
- GeneratedMessage
-
def
writeTo(_output__: CodedOutputStream): Unit
- Definition Classes
- Quota → GeneratedMessage
-
final
def
writeTo(output: OutputStream): Unit
- Definition Classes
- GeneratedMessage