com.google.api.QuotaKt.kt Maven / Gradle / Ivy
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/api/quota.proto
// Generated files should ignore deprecation warnings
@file:Suppress("DEPRECATION")
package com.google.api;
@kotlin.jvm.JvmName("-initializequota")
public inline fun quota(block: com.google.api.QuotaKt.Dsl.() -> kotlin.Unit): com.google.api.Quota =
com.google.api.QuotaKt.Dsl._create(com.google.api.Quota.newBuilder()).apply { block() }._build()
/**
* ```
* Quota configuration helps to achieve fairness and budgeting in service
* usage.
*
* The 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
* ```
*
* Protobuf type `google.api.Quota`
*/
public object QuotaKt {
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
@com.google.protobuf.kotlin.ProtoDslMarker
public class Dsl private constructor(
private val _builder: com.google.api.Quota.Builder
) {
public companion object {
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _create(builder: com.google.api.Quota.Builder): Dsl = Dsl(builder)
}
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _build(): com.google.api.Quota = _builder.build()
/**
* An uninstantiable, behaviorless type to represent the field in
* generics.
*/
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
public class LimitsProxy private constructor() : com.google.protobuf.kotlin.DslProxy()
/**
* ```
* List of `QuotaLimit` definitions for the service.
*
* Used by metric-based quotas only.
* ```
*
* `repeated .google.api.QuotaLimit limits = 3;`
*/
public val limits: com.google.protobuf.kotlin.DslList
@kotlin.jvm.JvmSynthetic
get() = com.google.protobuf.kotlin.DslList(
_builder.getLimitsList()
)
/**
* ```
* List of `QuotaLimit` definitions for the service.
*
* Used by metric-based quotas only.
* ```
*
* `repeated .google.api.QuotaLimit limits = 3;`
* @param value The limits to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("addLimits")
public fun com.google.protobuf.kotlin.DslList.add(value: com.google.api.QuotaLimit) {
_builder.addLimits(value)
}
/**
* ```
* List of `QuotaLimit` definitions for the service.
*
* Used by metric-based quotas only.
* ```
*
* `repeated .google.api.QuotaLimit limits = 3;`
* @param value The limits to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("plusAssignLimits")
@Suppress("NOTHING_TO_INLINE")
public inline operator fun com.google.protobuf.kotlin.DslList.plusAssign(value: com.google.api.QuotaLimit) {
add(value)
}
/**
* ```
* List of `QuotaLimit` definitions for the service.
*
* Used by metric-based quotas only.
* ```
*
* `repeated .google.api.QuotaLimit limits = 3;`
* @param values The limits to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("addAllLimits")
public fun com.google.protobuf.kotlin.DslList.addAll(values: kotlin.collections.Iterable) {
_builder.addAllLimits(values)
}
/**
* ```
* List of `QuotaLimit` definitions for the service.
*
* Used by metric-based quotas only.
* ```
*
* `repeated .google.api.QuotaLimit limits = 3;`
* @param values The limits to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("plusAssignAllLimits")
@Suppress("NOTHING_TO_INLINE")
public inline operator fun com.google.protobuf.kotlin.DslList.plusAssign(values: kotlin.collections.Iterable) {
addAll(values)
}
/**
* ```
* List of `QuotaLimit` definitions for the service.
*
* Used by metric-based quotas only.
* ```
*
* `repeated .google.api.QuotaLimit limits = 3;`
* @param index The index to set the value at.
* @param value The limits to set.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("setLimits")
public operator fun com.google.protobuf.kotlin.DslList.set(index: kotlin.Int, value: com.google.api.QuotaLimit) {
_builder.setLimits(index, value)
}
/**
* ```
* List of `QuotaLimit` definitions for the service.
*
* Used by metric-based quotas only.
* ```
*
* `repeated .google.api.QuotaLimit limits = 3;`
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("clearLimits")
public fun com.google.protobuf.kotlin.DslList.clear() {
_builder.clearLimits()
}
/**
* An uninstantiable, behaviorless type to represent the field in
* generics.
*/
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
public class MetricRulesProxy private constructor() : com.google.protobuf.kotlin.DslProxy()
/**
* ```
* List of `MetricRule` definitions, each one mapping a selected method to one
* or more metrics.
*
* Used by metric-based quotas only.
* ```
*
* `repeated .google.api.MetricRule metric_rules = 4;`
*/
public val metricRules: com.google.protobuf.kotlin.DslList
@kotlin.jvm.JvmSynthetic
get() = com.google.protobuf.kotlin.DslList(
_builder.getMetricRulesList()
)
/**
* ```
* List of `MetricRule` definitions, each one mapping a selected method to one
* or more metrics.
*
* Used by metric-based quotas only.
* ```
*
* `repeated .google.api.MetricRule metric_rules = 4;`
* @param value The metricRules to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("addMetricRules")
public fun com.google.protobuf.kotlin.DslList.add(value: com.google.api.MetricRule) {
_builder.addMetricRules(value)
}
/**
* ```
* List of `MetricRule` definitions, each one mapping a selected method to one
* or more metrics.
*
* Used by metric-based quotas only.
* ```
*
* `repeated .google.api.MetricRule metric_rules = 4;`
* @param value The metricRules to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("plusAssignMetricRules")
@Suppress("NOTHING_TO_INLINE")
public inline operator fun com.google.protobuf.kotlin.DslList.plusAssign(value: com.google.api.MetricRule) {
add(value)
}
/**
* ```
* List of `MetricRule` definitions, each one mapping a selected method to one
* or more metrics.
*
* Used by metric-based quotas only.
* ```
*
* `repeated .google.api.MetricRule metric_rules = 4;`
* @param values The metricRules to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("addAllMetricRules")
public fun com.google.protobuf.kotlin.DslList.addAll(values: kotlin.collections.Iterable) {
_builder.addAllMetricRules(values)
}
/**
* ```
* List of `MetricRule` definitions, each one mapping a selected method to one
* or more metrics.
*
* Used by metric-based quotas only.
* ```
*
* `repeated .google.api.MetricRule metric_rules = 4;`
* @param values The metricRules to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("plusAssignAllMetricRules")
@Suppress("NOTHING_TO_INLINE")
public inline operator fun com.google.protobuf.kotlin.DslList.plusAssign(values: kotlin.collections.Iterable) {
addAll(values)
}
/**
* ```
* List of `MetricRule` definitions, each one mapping a selected method to one
* or more metrics.
*
* Used by metric-based quotas only.
* ```
*
* `repeated .google.api.MetricRule metric_rules = 4;`
* @param index The index to set the value at.
* @param value The metricRules to set.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("setMetricRules")
public operator fun com.google.protobuf.kotlin.DslList.set(index: kotlin.Int, value: com.google.api.MetricRule) {
_builder.setMetricRules(index, value)
}
/**
* ```
* List of `MetricRule` definitions, each one mapping a selected method to one
* or more metrics.
*
* Used by metric-based quotas only.
* ```
*
* `repeated .google.api.MetricRule metric_rules = 4;`
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("clearMetricRules")
public fun com.google.protobuf.kotlin.DslList.clear() {
_builder.clearMetricRules()
}
}
}
@kotlin.jvm.JvmSynthetic
public inline fun com.google.api.Quota.copy(block: `com.google.api`.QuotaKt.Dsl.() -> kotlin.Unit): com.google.api.Quota =
`com.google.api`.QuotaKt.Dsl._create(this.toBuilder()).apply { block() }._build()