EvaluationSpec holds rules for evaluating the value of a flag.
| JSON representation |
|---|
{ "variants": [ { object ( |
| Fields | |
|---|---|
variants[] |
Optional. A list of variants. |
defaultTarget |
Required. Default variant or allocation of the flag. |
allocations[] |
Optional. A list of allocations. |
rules[] |
Optional. Evaluation rules define the logic for evaluating the flag against a given context. The rules are evaluated sequentially in their specified order. |
attributes[] |
Optional. Names of the context attributes that are used in the evaluation rules and allocations. |
Variant
Variant is an identifier for a value (name assigned to a value). DEPRECATED: Use Flag.Variants instead.
| JSON representation |
|---|
{ "name": string, // Union field |
| Fields | |
|---|---|
name |
Required. Name of the variant. Max length: 128 bytes. |
Union field value. value is a single flag value for the variant. value can be only one of the following: |
|
boolValue |
Optional. Boolean flag value. |
intValue |
Optional. Integer flag value. |
stringValue |
Optional. String flag value. |
doubleValue |
Optional. Double flag value. |
Allocation
Allocation defines a set of weighted flag variants, specifying how traffic is split based on the randomization unit.
| JSON representation |
|---|
{
"id": string,
"randomizedOn": string,
"description": string,
"slots": [
{
object ( |
| Fields | |
|---|---|
id |
Required. Allocation ID. Max length: 128 bytes. |
randomizedOn |
Required. Key of the context attribute that is used for traffic splitting. |
description |
Optional. Description of the allocation. Max length: 500 bytes. |
slots[] |
Required. Slots defines the weighted distribution of variants. |
AllocationSlot
AllocationSlot specifies a variant and the proportion of traffic allocated to it.
| JSON representation |
|---|
{ "variant": string, "weight": integer } |
| Fields | |
|---|---|
variant |
Required. Variant of the allocation slot. |
weight |
Required. Weight defines the proportion of traffic to allocate to the variant, relative to other slots in the same allocation. |
EvaluationRule
EvaluationRule defines a single rule for evaluating a feature flag. A rule consists of a condition that, if met, assigns a specific variant or allocation to the user.
| JSON representation |
|---|
{ "id": string, "condition": string, "target": string } |
| Fields | |
|---|---|
id |
Required. Evaluation rule ID. Max length: 128 bytes. |
condition |
Required. A Common Expression Language (CEL) expression that evaluates to a boolean. The expression is evaluated against the provided context. If it returns true, the rule's target is applied. |
target |
Required. The target variant or allocation to apply if the condition is met. This should match the name of a defined variant or allocation's ID. |