--- title: Quota description: A template that represents a quota allocation request location: https://istio.io/docs/reference/config/policy-and-telemetry/templates/quota.html layout: protoc-gen-docs generator: protoc-gen-docs aliases: - /docs/reference/config/template/quota.html number_of_entries: 2 ---

The `quota` template represents an item for which to check quota.

Example config:

    apiVersion: "config.istio.io/v1alpha2"
    kind: quota
    metadata:
      name: requestcount
      namespace: istio-system
    spec:
      dimensions:
        source: source.labels["app"] | source.service | "unknown"
        sourceVersion: source.labels["version"] | "unknown"
        destination: destination.labels["app"] | destination.service | "unknown"
        destinationVersion: destination.labels["version"] | "unknown"

## Template

The `quota` template represents a piece of data to check Quota for.

When writing the configuration, the value for the fields associated with this template can either be a literal or an expression. Please note that if the datatype of a field is not istio.policy.v1beta1.Value, then the expression’s inferred type must match the datatype of the field.

Field | Type | Description
--- | --- | ---
`dimensions` | `map<string, istio.policy.v1beta1.Value>` | The unique identity of the particular quota to manipulate.

## istio.policy.v1beta1.Value

An instance field of type Value denotes that the expression for the field is of dynamic type and can evalaute to any ValueType enum values. For example, when authoring an instance configuration for a template that has a field `data` of type `istio.policy.v1beta1.Value`, both of the following expressions are valid `data: source.ip | ip("0.0.0.0")`, `data: request.id | ""`; the resulting type is either ValueType.IP_ADDRESS or ValueType.STRING for the two cases respectively.

Objects of type Value are also passed to the adapters during request-time. There is a 1:1 mapping between oneof fields in `Value` and enum values inside `ValueType`. Depending on the expression’s evaluated `ValueType`, the equivalent oneof field in `Value` is populated by Mixer and passed to the adapters.

Field | Type | Description
--- | --- | ---
`stringValue` | `string (oneof)` | Used for values of type STRING
`int64Value` | `int64 (oneof)` | Used for values of type INT64
`doubleValue` | `double (oneof)` | Used for values of type DOUBLE
`boolValue` | `bool (oneof)` | Used for values of type BOOL
`ipAddressValue` | `istio.policy.v1beta1.IPAddress (oneof)` | Used for values of type IPAddress
`timestampValue` | `istio.policy.v1beta1.TimeStamp (oneof)` | Used for values of type TIMESTAMP
`durationValue` | `istio.policy.v1beta1.Duration (oneof)` | Used for values of type DURATION
`emailAddressValue` | `istio.policy.v1beta1.EmailAddress (oneof)` | Used for values of type EmailAddress
`dnsNameValue` | `istio.policy.v1beta1.DNSName (oneof)` | Used for values of type DNSName
`uriValue` | `istio.policy.v1beta1.Uri (oneof)` | Used for values of type Uri