feature_flag_variants
Creates, updates, deletes, gets or lists a feature_flag_variants resource.
Overview
| Name | feature_flag_variants |
| Type | Resource |
| Id | datadog.software_delivery.feature_flag_variants |
Fields
The following fields are returned by SELECT queries:
SELECT not supported for this resource, use SHOW METHODS to view available operations for the resource.
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
create_variant_for_feature_flag | insert | feature_flag_id, key, name, value | Adds a single new variant to an existing feature flag. This endpoint is<br />additive-only: it never modifies existing variants. A request whose key<br />already exists on the flag is rejected with 409 Conflict; a value<br />whose type does not match the flag's value_type is rejected with 400.<br />The server generates the variant UUID and returns it in the response body;<br />callers (for example, the flag-migration tool) need this UUID to reference<br />the new variant in subsequent allocation syncs. | |
update_variant_for_feature_flag | replace | feature_flag_id, variant_id | Updates the name and value of an existing variant on a feature flag.<br /><br />When backend approvals are enabled and the flag requires approval, this endpoint creates and returns a FlagSuggestion with 201 Created instead of applying the change immediately. Use the returned suggestion id to approve or reject the change. If a pending suggestion already exists for this flag's variant property, the endpoint returns 409 Conflict. | |
delete_variant_from_feature_flag | delete | feature_flag_id, variant_id | Deletes a variant from a feature flag.<br /><br />When backend approvals are enabled and the flag requires approval, this endpoint creates and returns a FlagSuggestion with 201 Created instead of deleting the variant immediately. If a pending suggestion already exists for this flag's variant property, the endpoint returns 409 Conflict. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
feature_flag_id | string (uuid) | The ID of the feature flag. |
site | string | The Datadog site (region) for your organization, for example datadoghq.com, us3.datadoghq.com, us5.datadoghq.com, ap1.datadoghq.com, ap2.datadoghq.com, datadoghq.eu, ddog-gov.com. Resolved from the DD_SITE environment variable when set. Optional: defaults to datadoghq.com, or the value of the DD_SITE environment variable when set; a WHERE value overrides both. |
variant_id | string (uuid) | The ID of the variant. |
INSERT examples
- create_variant_for_feature_flag
- Manifest
Adds a single new variant to an existing feature flag. This endpoint is<br />additive-only: it never modifies existing variants. A request whose key<br />already exists on the flag is rejected with 409 Conflict; a value<br />whose type does not match the flag's value_type is rejected with 400.<br />The server generates the variant UUID and returns it in the response body;<br />callers (for example, the flag-migration tool) need this UUID to reference<br />the new variant in subsequent allocation syncs.
INSERT INTO datadog.software_delivery.feature_flag_variants (
key,
name,
value,
feature_flag_id
)
SELECT
'{{ key }}' /* required */,
'{{ name }}' /* required */,
'{{ value }}' /* required */,
'{{ feature_flag_id }}'
RETURNING
id,
name,
created_at,
key,
updated_at,
value
;
# Description fields are for documentation purposes
- name: feature_flag_variants
props:
- name: feature_flag_id
value: "{{ feature_flag_id }}"
description: Required parameter for the feature_flag_variants resource.
- name: key
value: "{{ key }}"
description: |
The unique key of the variant.
- name: name
value: "{{ name }}"
description: |
The name of the variant.
- name: value
value: "{{ value }}"
description: |
The value of the variant as a string.
REPLACE examples
- update_variant_for_feature_flag
Updates the name and value of an existing variant on a feature flag.<br /><br />When backend approvals are enabled and the flag requires approval, this endpoint creates and returns a FlagSuggestion with 201 Created instead of applying the change immediately. Use the returned suggestion id to approve or reject the change. If a pending suggestion already exists for this flag's variant property, the endpoint returns 409 Conflict.
REPLACE datadog.software_delivery.feature_flag_variants
SET
name = '{{ name }}',
value = '{{ value }}'
WHERE
feature_flag_id = '{{ feature_flag_id }}' --required
AND variant_id = '{{ variant_id }}' --required
RETURNING
id,
name,
created_at,
key,
updated_at,
value;
DELETE examples
- delete_variant_from_feature_flag
Deletes a variant from a feature flag.<br /><br />When backend approvals are enabled and the flag requires approval, this endpoint creates and returns a FlagSuggestion with 201 Created instead of deleting the variant immediately. If a pending suggestion already exists for this flag's variant property, the endpoint returns 409 Conflict.
DELETE FROM datadog.software_delivery.feature_flag_variants
WHERE feature_flag_id = '{{ feature_flag_id }}' --required
AND variant_id = '{{ variant_id }}' --required
;