From cf794bd146c6f21c7435cb1785d40d4c32fa3725 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 23 Jun 2026 19:46:46 +0000 Subject: [PATCH] Regenerate client from commit 281891e of spec repo --- .generator/schemas/v2/openapi.yaml | 232 ++++++++++++++++++ docs/datadog_api_client.v2.model.rst | 7 + .../CreateVariantForFeatureFlag.py | 23 ++ .../DeleteVariantFromFeatureFlag.py | 15 ++ .../UpdateVariantForFeatureFlag.py | 24 ++ .../v2/api/feature_flags_api.py | 169 +++++++++++++ .../v2/model/update_variant_request.py | 43 ++++ src/datadog_api_client/v2/models/__init__.py | 2 + tests/v2/features/feature_flags.feature | 100 ++++++++ tests/v2/features/undo.json | 18 ++ 10 files changed, 633 insertions(+) create mode 100644 examples/v2/feature-flags/CreateVariantForFeatureFlag.py create mode 100644 examples/v2/feature-flags/DeleteVariantFromFeatureFlag.py create mode 100644 examples/v2/feature-flags/UpdateVariantForFeatureFlag.py create mode 100644 src/datadog_api_client/v2/model/update_variant_request.py diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 99b25f0ac8..954f75f844 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1966,6 +1966,15 @@ components: example: "550e8400-e29b-41d4-a716-446655440000" format: uuid type: string + variant_id: + description: The ID of the variant. + in: path + name: variant_id + required: true + schema: + example: "550e8400-e29b-41d4-a716-446655440002" + format: uuid + type: string requestBodies: {} responses: BadRequestResponse: @@ -105626,6 +105635,18 @@ components: required: - data type: object + UpdateVariantRequest: + description: Request to update an existing variant's name and value. + properties: + name: + description: The display name of the variant. + example: "Variant ABC123 Updated" + type: string + value: + description: The value of the variant as a string. + example: "new_value" + type: string + type: object UpdateWorkflowRequest: description: A request object for updating an existing workflow. example: @@ -132923,6 +132944,217 @@ paths: permissions: - feature_flag_config_write - feature_flag_environment_config_read + /api/v2/feature-flags/{feature_flag_id}/variants: + post: + description: |- + Adds a single new variant to an existing feature flag. This endpoint is + additive-only: it never modifies existing variants. A request whose `key` + already exists on the flag is rejected with `409 Conflict`; a `value` + whose type does not match the flag's `value_type` is rejected with `400`. + The server generates the variant UUID and returns it in the response body; + callers (for example, the flag-migration tool) need this UUID to reference + the new variant in subsequent allocation syncs. + operationId: CreateVariantForFeatureFlag + parameters: + - $ref: "#/components/parameters/feature_flag_id" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + key: dark + name: Dark Theme + value: dark + type: variants + schema: + $ref: "#/components/schemas/CreateVariant" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-01T00:00:00+00:00" + key: dark + name: Dark Theme + updated_at: "2024-01-01T00:00:00+00:00" + value: dark + id: "550e8400-e29b-41d4-a716-446655440002" + type: variants + schema: + $ref: "#/components/schemas/Variant" + description: Created + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Conflict - A variant with this key already exists on the flag. + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Add a variant to a feature flag + tags: + - Feature Flags + x-permission: + operator: AND + permissions: + - feature_flag_config_write + /api/v2/feature-flags/{feature_flag_id}/variants/{variant_id}: + delete: + description: |- + Deletes a variant from a feature flag. + + 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`. + operationId: DeleteVariantFromFeatureFlag + parameters: + - $ref: "#/components/parameters/feature_flag_id" + - $ref: "#/components/parameters/variant_id" + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Conflict - A pending suggestion already exists for this property. + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Delete a variant + tags: + - Feature Flags + x-permission: + operator: AND + permissions: + - feature_flag_config_write + put: + description: |- + Updates the name and value of an existing variant on a feature flag. + + 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`. + operationId: UpdateVariantForFeatureFlag + parameters: + - $ref: "#/components/parameters/feature_flag_id" + - $ref: "#/components/parameters/variant_id" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + name: Dark Theme Updated + value: dark_v2 + id: "550e8400-e29b-41d4-a716-446655440002" + type: variants + schema: + $ref: "#/components/schemas/UpdateVariantRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-01T00:00:00+00:00" + key: dark + name: Dark Theme Updated + updated_at: "2024-06-01T00:00:00+00:00" + value: dark_v2 + id: "550e8400-e29b-41d4-a716-446655440002" + type: variants + schema: + $ref: "#/components/schemas/Variant" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Conflict - A pending suggestion already exists for this property. + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Update a variant + tags: + - Feature Flags + x-permission: + operator: AND + permissions: + - feature_flag_config_write /api/v2/forms: get: description: Get all forms for the authenticated user's organization. diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 14023429c7..d5921157a1 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -45287,6 +45287,13 @@ datadog\_api\_client.v2.model.update\_tenancy\_config\_request module :members: :show-inheritance: +datadog\_api\_client.v2.model.update\_variant\_request module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.update_variant_request + :members: + :show-inheritance: + datadog\_api\_client.v2.model.update\_workflow\_request module -------------------------------------------------------------- diff --git a/examples/v2/feature-flags/CreateVariantForFeatureFlag.py b/examples/v2/feature-flags/CreateVariantForFeatureFlag.py new file mode 100644 index 0000000000..49bba14e86 --- /dev/null +++ b/examples/v2/feature-flags/CreateVariantForFeatureFlag.py @@ -0,0 +1,23 @@ +""" +Add a variant to a feature flag returns "Created" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.feature_flags_api import FeatureFlagsApi +from datadog_api_client.v2.model.create_variant import CreateVariant +from uuid import UUID + +body = CreateVariant( + key="variant-abc123", + name="Variant ABC123", + value="true", +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = FeatureFlagsApi(api_client) + response = api_instance.create_variant_for_feature_flag( + feature_flag_id=UUID("550e8400-e29b-41d4-a716-446655440000"), body=body + ) + + print(response) diff --git a/examples/v2/feature-flags/DeleteVariantFromFeatureFlag.py b/examples/v2/feature-flags/DeleteVariantFromFeatureFlag.py new file mode 100644 index 0000000000..63d85bed4b --- /dev/null +++ b/examples/v2/feature-flags/DeleteVariantFromFeatureFlag.py @@ -0,0 +1,15 @@ +""" +Delete a variant returns "No Content" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.feature_flags_api import FeatureFlagsApi +from uuid import UUID + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = FeatureFlagsApi(api_client) + api_instance.delete_variant_from_feature_flag( + feature_flag_id=UUID("550e8400-e29b-41d4-a716-446655440000"), + variant_id=UUID("550e8400-e29b-41d4-a716-446655440002"), + ) diff --git a/examples/v2/feature-flags/UpdateVariantForFeatureFlag.py b/examples/v2/feature-flags/UpdateVariantForFeatureFlag.py new file mode 100644 index 0000000000..12e67b5950 --- /dev/null +++ b/examples/v2/feature-flags/UpdateVariantForFeatureFlag.py @@ -0,0 +1,24 @@ +""" +Update a variant returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.feature_flags_api import FeatureFlagsApi +from datadog_api_client.v2.model.update_variant_request import UpdateVariantRequest +from uuid import UUID + +body = UpdateVariantRequest( + name="Variant ABC123 Updated", + value="new_value", +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = FeatureFlagsApi(api_client) + response = api_instance.update_variant_for_feature_flag( + feature_flag_id=UUID("550e8400-e29b-41d4-a716-446655440000"), + variant_id=UUID("550e8400-e29b-41d4-a716-446655440002"), + body=body, + ) + + print(response) diff --git a/src/datadog_api_client/v2/api/feature_flags_api.py b/src/datadog_api_client/v2/api/feature_flags_api.py index a51a2811e3..74c480c72f 100644 --- a/src/datadog_api_client/v2/api/feature_flags_api.py +++ b/src/datadog_api_client/v2/api/feature_flags_api.py @@ -25,6 +25,9 @@ from datadog_api_client.v2.model.create_allocations_request import CreateAllocationsRequest from datadog_api_client.v2.model.list_allocations_response import ListAllocationsResponse from datadog_api_client.v2.model.overwrite_allocations_request import OverwriteAllocationsRequest +from datadog_api_client.v2.model.variant import Variant +from datadog_api_client.v2.model.create_variant import CreateVariant +from datadog_api_client.v2.model.update_variant_request import UpdateVariantRequest class FeatureFlagsApi: @@ -132,6 +135,32 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._create_variant_for_feature_flag_endpoint = _Endpoint( + settings={ + "response_type": (Variant,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/feature-flags/{feature_flag_id}/variants", + "operation_id": "create_variant_for_feature_flag", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "feature_flag_id": { + "required": True, + "openapi_types": (UUID,), + "attribute": "feature_flag_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (CreateVariant,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._delete_feature_flags_environment_endpoint = _Endpoint( settings={ "response_type": None, @@ -155,6 +184,35 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._delete_variant_from_feature_flag_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/feature-flags/{feature_flag_id}/variants/{variant_id}", + "operation_id": "delete_variant_from_feature_flag", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "feature_flag_id": { + "required": True, + "openapi_types": (UUID,), + "attribute": "feature_flag_id", + "location": "path", + }, + "variant_id": { + "required": True, + "openapi_types": (UUID,), + "attribute": "variant_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + self._disable_feature_flag_environment_endpoint = _Endpoint( settings={ "response_type": None, @@ -546,6 +604,38 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._update_variant_for_feature_flag_endpoint = _Endpoint( + settings={ + "response_type": (Variant,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/feature-flags/{feature_flag_id}/variants/{variant_id}", + "operation_id": "update_variant_for_feature_flag", + "http_method": "PUT", + "version": "v2", + }, + params_map={ + "feature_flag_id": { + "required": True, + "openapi_types": (UUID,), + "attribute": "feature_flag_id", + "location": "path", + }, + "variant_id": { + "required": True, + "openapi_types": (UUID,), + "attribute": "variant_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (UpdateVariantRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + def archive_feature_flag( self, feature_flag_id: UUID, @@ -622,6 +712,33 @@ def create_feature_flags_environment( return self._create_feature_flags_environment_endpoint.call_with_http_info(**kwargs) + def create_variant_for_feature_flag( + self, + feature_flag_id: UUID, + body: CreateVariant, + ) -> Variant: + """Add a variant to a feature flag. + + Adds a single new variant to an existing feature flag. This endpoint is + additive-only: it never modifies existing variants. A request whose ``key`` + already exists on the flag is rejected with ``409 Conflict`` ; a ``value`` + whose type does not match the flag's ``value_type`` is rejected with ``400``. + The server generates the variant UUID and returns it in the response body; + callers (for example, the flag-migration tool) need this UUID to reference + the new variant in subsequent allocation syncs. + + :param feature_flag_id: The ID of the feature flag. + :type feature_flag_id: UUID + :type body: CreateVariant + :rtype: Variant + """ + kwargs: Dict[str, Any] = {} + kwargs["feature_flag_id"] = feature_flag_id + + kwargs["body"] = body + + return self._create_variant_for_feature_flag_endpoint.call_with_http_info(**kwargs) + def delete_feature_flags_environment( self, environment_id: UUID, @@ -639,6 +756,30 @@ def delete_feature_flags_environment( return self._delete_feature_flags_environment_endpoint.call_with_http_info(**kwargs) + def delete_variant_from_feature_flag( + self, + feature_flag_id: UUID, + variant_id: UUID, + ) -> None: + """Delete a variant. + + Deletes a variant from a feature flag. + + 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``. + + :param feature_flag_id: The ID of the feature flag. + :type feature_flag_id: UUID + :param variant_id: The ID of the variant. + :type variant_id: UUID + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["feature_flag_id"] = feature_flag_id + + kwargs["variant_id"] = variant_id + + return self._delete_variant_from_feature_flag_endpoint.call_with_http_info(**kwargs) + def disable_feature_flag_environment( self, feature_flag_id: UUID, @@ -950,3 +1091,31 @@ def update_feature_flags_environment( kwargs["body"] = body return self._update_feature_flags_environment_endpoint.call_with_http_info(**kwargs) + + def update_variant_for_feature_flag( + self, + feature_flag_id: UUID, + variant_id: UUID, + body: UpdateVariantRequest, + ) -> Variant: + """Update a variant. + + Updates the name and value of an existing variant on a feature flag. + + 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``. + + :param feature_flag_id: The ID of the feature flag. + :type feature_flag_id: UUID + :param variant_id: The ID of the variant. + :type variant_id: UUID + :type body: UpdateVariantRequest + :rtype: Variant + """ + kwargs: Dict[str, Any] = {} + kwargs["feature_flag_id"] = feature_flag_id + + kwargs["variant_id"] = variant_id + + kwargs["body"] = body + + return self._update_variant_for_feature_flag_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/model/update_variant_request.py b/src/datadog_api_client/v2/model/update_variant_request.py new file mode 100644 index 0000000000..a0d6459e6f --- /dev/null +++ b/src/datadog_api_client/v2/model/update_variant_request.py @@ -0,0 +1,43 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class UpdateVariantRequest(ModelNormal): + @cached_property + def openapi_types(_): + return { + "name": (str,), + "value": (str,), + } + + attribute_map = { + "name": "name", + "value": "value", + } + + def __init__(self_, name: Union[str, UnsetType] = unset, value: Union[str, UnsetType] = unset, **kwargs): + """ + Request to update an existing variant's name and value. + + :param name: The display name of the variant. + :type name: str, optional + + :param value: The value of the variant as a string. + :type value: str, optional + """ + if name is not unset: + kwargs["name"] = name + if value is not unset: + kwargs["value"] = value + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 9413425cce..9eabca83ad 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -9117,6 +9117,7 @@ ) from datadog_api_client.v2.model.update_tenancy_config_data_type import UpdateTenancyConfigDataType from datadog_api_client.v2.model.update_tenancy_config_request import UpdateTenancyConfigRequest +from datadog_api_client.v2.model.update_variant_request import UpdateVariantRequest from datadog_api_client.v2.model.update_workflow_request import UpdateWorkflowRequest from datadog_api_client.v2.model.update_workflow_response import UpdateWorkflowResponse from datadog_api_client.v2.model.upsert_allocation_request import UpsertAllocationRequest @@ -15869,6 +15870,7 @@ "UpdateTenancyConfigDataAttributesRegionsConfig", "UpdateTenancyConfigDataType", "UpdateTenancyConfigRequest", + "UpdateVariantRequest", "UpdateWorkflowRequest", "UpdateWorkflowResponse", "UpsertAllocationRequest", diff --git a/tests/v2/features/feature_flags.feature b/tests/v2/features/feature_flags.feature index df31d246a4..c98cd04f77 100644 --- a/tests/v2/features/feature_flags.feature +++ b/tests/v2/features/feature_flags.feature @@ -7,6 +7,38 @@ Feature: Feature Flags And a valid "appKeyAuth" key in the system And an instance of "FeatureFlags" API + @generated @skip @team:DataDog/feature-flags + Scenario: Add a variant to a feature flag returns "Bad Request" response + Given new "CreateVariantForFeatureFlag" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And body with value {"key": "variant-abc123", "name": "Variant ABC123", "value": "true"} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/feature-flags + Scenario: Add a variant to a feature flag returns "Conflict - A variant with this key already exists on the flag." response + Given new "CreateVariantForFeatureFlag" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And body with value {"key": "variant-abc123", "name": "Variant ABC123", "value": "true"} + When the request is sent + Then the response status is 409 Conflict - A variant with this key already exists on the flag. + + @generated @skip @team:DataDog/feature-flags + Scenario: Add a variant to a feature flag returns "Created" response + Given new "CreateVariantForFeatureFlag" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And body with value {"key": "variant-abc123", "name": "Variant ABC123", "value": "true"} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:DataDog/feature-flags + Scenario: Add a variant to a feature flag returns "Not Found" response + Given new "CreateVariantForFeatureFlag" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And body with value {"key": "variant-abc123", "name": "Variant ABC123", "value": "true"} + When the request is sent + Then the response status is 404 Not Found + @skip @team:DataDog/feature-flags Scenario: Archive a feature flag returns "Bad Request" response Given new "ArchiveFeatureFlag" request @@ -130,6 +162,38 @@ Feature: Feature Flags When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/feature-flags + Scenario: Delete a variant returns "Bad Request" response + Given new "DeleteVariantFromFeatureFlag" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "variant_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/feature-flags + Scenario: Delete a variant returns "Conflict - A pending suggestion already exists for this property." response + Given new "DeleteVariantFromFeatureFlag" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "variant_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 409 Conflict - A pending suggestion already exists for this property. + + @generated @skip @team:DataDog/feature-flags + Scenario: Delete a variant returns "No Content" response + Given new "DeleteVariantFromFeatureFlag" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "variant_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/feature-flags + Scenario: Delete a variant returns "Not Found" response + Given new "DeleteVariantFromFeatureFlag" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "variant_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + @skip @team:DataDog/feature-flags Scenario: Delete an environment returns "No Content" response Given there is a valid "environment" in the system @@ -408,6 +472,42 @@ Feature: Feature Flags And the response "data.attributes.name" is equal to "Updated Test Feature Flag {{ unique }}" And the response "data.attributes.description" is equal to "Updated description for the feature flag" + @generated @skip @team:DataDog/feature-flags + Scenario: Update a variant returns "Bad Request" response + Given new "UpdateVariantForFeatureFlag" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "variant_id" parameter from "REPLACE.ME" + And body with value {"name": "Variant ABC123 Updated", "value": "new_value"} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/feature-flags + Scenario: Update a variant returns "Conflict - A pending suggestion already exists for this property." response + Given new "UpdateVariantForFeatureFlag" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "variant_id" parameter from "REPLACE.ME" + And body with value {"name": "Variant ABC123 Updated", "value": "new_value"} + When the request is sent + Then the response status is 409 Conflict - A pending suggestion already exists for this property. + + @generated @skip @team:DataDog/feature-flags + Scenario: Update a variant returns "Not Found" response + Given new "UpdateVariantForFeatureFlag" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "variant_id" parameter from "REPLACE.ME" + And body with value {"name": "Variant ABC123 Updated", "value": "new_value"} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/feature-flags + Scenario: Update a variant returns "OK" response + Given new "UpdateVariantForFeatureFlag" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "variant_id" parameter from "REPLACE.ME" + And body with value {"name": "Variant ABC123 Updated", "value": "new_value"} + When the request is sent + Then the response status is 200 OK + @skip @team:DataDog/feature-flags Scenario: Update an environment returns "Bad Request" response Given new "UpdateFeatureFlagsEnvironment" request diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index a5c43f6c0f..b0dab3582b 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -2675,6 +2675,24 @@ "type": "unsafe" } }, + "CreateVariantForFeatureFlag": { + "tag": "Feature Flags", + "undo": { + "type": "unsafe" + } + }, + "DeleteVariantFromFeatureFlag": { + "tag": "Feature Flags", + "undo": { + "type": "unsafe" + } + }, + "UpdateVariantForFeatureFlag": { + "tag": "Feature Flags", + "undo": { + "type": "idempotent" + } + }, "ListForms": { "tag": "Forms", "undo": {