diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 5d4592e52b..2af26bffc4 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -28217,7 +28217,7 @@ components: - data type: object CreateVariant: - description: Request to create a variant. + description: Attributes for creating a variant. properties: key: description: The unique key of the variant. @@ -28236,6 +28236,25 @@ components: - name - value type: object + CreateVariantData: + description: Data for adding a variant to a feature flag. + properties: + attributes: + $ref: "#/components/schemas/CreateVariant" + type: + $ref: "#/components/schemas/VariantDataType" + required: + - type + - attributes + type: object + CreateVariantRequest: + description: Request to add a variant to a feature flag. + properties: + data: + $ref: "#/components/schemas/CreateVariantData" + required: + - data + type: object CreateWorkflowRequest: description: A request object for creating a new workflow. example: @@ -141665,8 +141684,8 @@ components: required: - data type: object - UpdateVariantRequest: - description: Request to update an existing variant's name and value. + UpdateVariantAttributes: + description: Attributes for updating a variant. properties: name: description: The display name of the variant. @@ -141677,6 +141696,30 @@ components: example: "new_value" type: string type: object + UpdateVariantData: + description: Data for updating a variant. + properties: + attributes: + $ref: "#/components/schemas/UpdateVariantAttributes" + id: + description: The ID of the variant. If you include it, use the same value as the `variant_id` path parameter. + example: "550e8400-e29b-41d4-a716-446655440002" + format: uuid + type: string + type: + $ref: "#/components/schemas/VariantDataType" + required: + - type + - attributes + type: object + UpdateVariantRequest: + description: Request to update an existing variant's name and value. + properties: + data: + $ref: "#/components/schemas/UpdateVariantData" + required: + - data + type: object UpdateWorkflowRequest: description: A request object for updating an existing workflow. example: @@ -143625,6 +143668,69 @@ components: - name - value type: object + VariantDataType: + description: The resource type for variants. + enum: + - "variants" + example: "variants" + type: string + x-enum-varnames: + - VARIANTS + VariantResponse: + description: Response containing a variant. + properties: + data: + $ref: "#/components/schemas/VariantResponseData" + required: + - data + type: object + VariantResponseAttributes: + description: Attributes of a variant. + properties: + created_at: + description: The timestamp when the variant was created. + example: "2023-01-01T00:00:00Z" + format: date-time + type: string + key: + description: The unique key of the variant. + example: "variant-abc123" + type: string + name: + description: The name of the variant. + example: "Variant ABC123" + type: string + updated_at: + description: The timestamp when the variant was last updated. + example: "2023-01-01T00:00:00Z" + format: date-time + type: string + value: + description: The value of the variant as a string. + example: "true" + type: string + required: + - key + - name + - value + type: object + VariantResponseData: + description: A variant resource. + properties: + attributes: + $ref: "#/components/schemas/VariantResponseAttributes" + id: + description: The unique identifier of the variant. + example: "550e8400-e29b-41d4-a716-446655440002" + format: uuid + type: string + type: + $ref: "#/components/schemas/VariantDataType" + required: + - id + - type + - attributes + type: object VariantWeight: description: Variant weight details. properties: @@ -177827,7 +177933,7 @@ paths: value: dark type: variants schema: - $ref: "#/components/schemas/CreateVariant" + $ref: "#/components/schemas/CreateVariantRequest" required: true responses: "201": @@ -177846,7 +177952,7 @@ paths: id: "550e8400-e29b-41d4-a716-446655440002" type: variants schema: - $ref: "#/components/schemas/Variant" + $ref: "#/components/schemas/VariantResponse" description: Created "400": content: @@ -177963,22 +178069,6 @@ paths: 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: diff --git a/examples/v2/feature-flags/CreateVariantForFeatureFlag.py b/examples/v2/feature-flags/CreateVariantForFeatureFlag.py index cd0717b17c..7f36a8cb0d 100644 --- a/examples/v2/feature-flags/CreateVariantForFeatureFlag.py +++ b/examples/v2/feature-flags/CreateVariantForFeatureFlag.py @@ -6,12 +6,20 @@ 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 datadog_api_client.v2.model.create_variant_data import CreateVariantData +from datadog_api_client.v2.model.create_variant_request import CreateVariantRequest +from datadog_api_client.v2.model.variant_data_type import VariantDataType from uuid import UUID -body = CreateVariant( - key="variant-abc123", - name="Variant ABC123", - value="true", +body = CreateVariantRequest( + data=CreateVariantData( + attributes=CreateVariant( + key="variant-abc123", + name="Variant ABC123", + value="true", + ), + type=VariantDataType.VARIANTS, + ), ) configuration = Configuration() diff --git a/examples/v2/feature-flags/UpdateVariantForFeatureFlag.py b/examples/v2/feature-flags/UpdateVariantForFeatureFlag.py index 43d69e8bca..1d84100e21 100644 --- a/examples/v2/feature-flags/UpdateVariantForFeatureFlag.py +++ b/examples/v2/feature-flags/UpdateVariantForFeatureFlag.py @@ -5,22 +5,29 @@ from os import environ 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_attributes import UpdateVariantAttributes +from datadog_api_client.v2.model.update_variant_data import UpdateVariantData from datadog_api_client.v2.model.update_variant_request import UpdateVariantRequest +from datadog_api_client.v2.model.variant_data_type import VariantDataType from uuid import UUID body = UpdateVariantRequest( - name="Variant ABC123 Updated", - value="new_value", + data=UpdateVariantData( + attributes=UpdateVariantAttributes( + name="Variant ABC123 Updated", + value="new_value", + ), + id=UUID("550e8400-e29b-41d4-a716-446655440002"), + type=VariantDataType.VARIANTS, + ), ) configuration = Configuration() configuration.access_token = environ["DD_BEARER_TOKEN"] with ApiClient(configuration) as api_client: api_instance = FeatureFlagsApi(api_client) - response = api_instance.update_variant_for_feature_flag( + 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 6ce4aec7bb..bbc988fc3e 100644 --- a/src/datadog_api_client/v2/api/feature_flags_api.py +++ b/src/datadog_api_client/v2/api/feature_flags_api.py @@ -31,8 +31,8 @@ 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.variant_response import VariantResponse +from datadog_api_client.v2.model.create_variant_request import CreateVariantRequest from datadog_api_client.v2.model.update_variant_request import UpdateVariantRequest @@ -143,7 +143,7 @@ def __init__(self, api_client=None): self._create_variant_for_feature_flag_endpoint = _Endpoint( settings={ - "response_type": (Variant,), + "response_type": (VariantResponse,), "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], "endpoint_path": "/api/v2/feature-flags/{feature_flag_id}/variants", "operation_id": "create_variant_for_feature_flag", @@ -159,7 +159,7 @@ def __init__(self, api_client=None): }, "body": { "required": True, - "openapi_types": (CreateVariant,), + "openapi_types": (CreateVariantRequest,), "location": "body", }, }, @@ -744,7 +744,7 @@ def __init__(self, api_client=None): self._update_variant_for_feature_flag_endpoint = _Endpoint( settings={ - "response_type": (Variant,), + "response_type": None, "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], "endpoint_path": "/api/v2/feature-flags/{feature_flag_id}/variants/{variant_id}", "operation_id": "update_variant_for_feature_flag", @@ -770,7 +770,7 @@ def __init__(self, api_client=None): "location": "body", }, }, - headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + headers_map={"accept": ["*/*"], "content_type": ["application/json"]}, api_client=api_client, ) @@ -853,8 +853,8 @@ def create_feature_flags_environment( def create_variant_for_feature_flag( self, feature_flag_id: UUID, - body: CreateVariant, - ) -> Variant: + body: CreateVariantRequest, + ) -> VariantResponse: """Add a variant to a feature flag. Adds a single new variant to an existing feature flag. This endpoint is @@ -867,8 +867,8 @@ def create_variant_for_feature_flag( :param feature_flag_id: The ID of the feature flag. :type feature_flag_id: UUID - :type body: CreateVariant - :rtype: Variant + :type body: CreateVariantRequest + :rtype: VariantResponse """ kwargs: Dict[str, Any] = {} kwargs["feature_flag_id"] = feature_flag_id @@ -1374,7 +1374,7 @@ def update_variant_for_feature_flag( feature_flag_id: UUID, variant_id: UUID, body: UpdateVariantRequest, - ) -> Variant: + ) -> None: """Update a variant. Updates the name and value of an existing variant on a feature flag. @@ -1386,7 +1386,7 @@ def update_variant_for_feature_flag( :param variant_id: The ID of the variant. :type variant_id: UUID :type body: UpdateVariantRequest - :rtype: Variant + :rtype: None """ kwargs: Dict[str, Any] = {} kwargs["feature_flag_id"] = feature_flag_id diff --git a/src/datadog_api_client/v2/model/create_variant.py b/src/datadog_api_client/v2/model/create_variant.py index ec2910dfd4..11fffde06d 100644 --- a/src/datadog_api_client/v2/model/create_variant.py +++ b/src/datadog_api_client/v2/model/create_variant.py @@ -27,7 +27,7 @@ def openapi_types(_): def __init__(self_, key: str, name: str, value: str, **kwargs): """ - Request to create a variant. + Attributes for creating a variant. :param key: The unique key of the variant. :type key: str diff --git a/src/datadog_api_client/v2/model/create_variant_data.py b/src/datadog_api_client/v2/model/create_variant_data.py new file mode 100644 index 0000000000..849561b9f9 --- /dev/null +++ b/src/datadog_api_client/v2/model/create_variant_data.py @@ -0,0 +1,48 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.create_variant import CreateVariant + from datadog_api_client.v2.model.variant_data_type import VariantDataType + + +class CreateVariantData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.create_variant import CreateVariant + from datadog_api_client.v2.model.variant_data_type import VariantDataType + + return { + "attributes": (CreateVariant,), + "type": (VariantDataType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: CreateVariant, type: VariantDataType, **kwargs): + """ + Data for adding a variant to a feature flag. + + :param attributes: Attributes for creating a variant. + :type attributes: CreateVariant + + :param type: The resource type for variants. + :type type: VariantDataType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/create_variant_request.py b/src/datadog_api_client/v2/model/create_variant_request.py new file mode 100644 index 0000000000..37db8164ae --- /dev/null +++ b/src/datadog_api_client/v2/model/create_variant_request.py @@ -0,0 +1,40 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.create_variant_data import CreateVariantData + + +class CreateVariantRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.create_variant_data import CreateVariantData + + return { + "data": (CreateVariantData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: CreateVariantData, **kwargs): + """ + Request to add a variant to a feature flag. + + :param data: Data for adding a variant to a feature flag. + :type data: CreateVariantData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/update_variant_attributes.py b/src/datadog_api_client/v2/model/update_variant_attributes.py new file mode 100644 index 0000000000..98cb2af1bc --- /dev/null +++ b/src/datadog_api_client/v2/model/update_variant_attributes.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 UpdateVariantAttributes(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): + """ + Attributes for updating a variant. + + :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/model/update_variant_data.py b/src/datadog_api_client/v2/model/update_variant_data.py new file mode 100644 index 0000000000..0d77603ee4 --- /dev/null +++ b/src/datadog_api_client/v2/model/update_variant_data.py @@ -0,0 +1,60 @@ +# 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, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.update_variant_attributes import UpdateVariantAttributes + from datadog_api_client.v2.model.variant_data_type import VariantDataType + + +class UpdateVariantData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.update_variant_attributes import UpdateVariantAttributes + from datadog_api_client.v2.model.variant_data_type import VariantDataType + + return { + "attributes": (UpdateVariantAttributes,), + "id": (UUID,), + "type": (VariantDataType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, attributes: UpdateVariantAttributes, type: VariantDataType, id: Union[UUID, UnsetType] = unset, **kwargs + ): + """ + Data for updating a variant. + + :param attributes: Attributes for updating a variant. + :type attributes: UpdateVariantAttributes + + :param id: The ID of the variant. If you include it, use the same value as the ``variant_id`` path parameter. + :type id: UUID, optional + + :param type: The resource type for variants. + :type type: VariantDataType + """ + if id is not unset: + kwargs["id"] = id + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/update_variant_request.py b/src/datadog_api_client/v2/model/update_variant_request.py index a0d6459e6f..ebc09e6b70 100644 --- a/src/datadog_api_client/v2/model/update_variant_request.py +++ b/src/datadog_api_client/v2/model/update_variant_request.py @@ -3,41 +3,38 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Union +from typing import TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, cached_property, - unset, - UnsetType, ) +if TYPE_CHECKING: + from datadog_api_client.v2.model.update_variant_data import UpdateVariantData + + class UpdateVariantRequest(ModelNormal): @cached_property def openapi_types(_): + from datadog_api_client.v2.model.update_variant_data import UpdateVariantData + return { - "name": (str,), - "value": (str,), + "data": (UpdateVariantData,), } attribute_map = { - "name": "name", - "value": "value", + "data": "data", } - def __init__(self_, name: Union[str, UnsetType] = unset, value: Union[str, UnsetType] = unset, **kwargs): + def __init__(self_, data: UpdateVariantData, **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 + :param data: Data for updating a variant. + :type data: UpdateVariantData """ - if name is not unset: - kwargs["name"] = name - if value is not unset: - kwargs["value"] = value super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/variant_data_type.py b/src/datadog_api_client/v2/model/variant_data_type.py new file mode 100644 index 0000000000..229e965506 --- /dev/null +++ b/src/datadog_api_client/v2/model/variant_data_type.py @@ -0,0 +1,35 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class VariantDataType(ModelSimple): + """ + The resource type for variants. + + :param value: If omitted defaults to "variants". Must be one of ["variants"]. + :type value: str + """ + + allowed_values = { + "variants", + } + VARIANTS: ClassVar["VariantDataType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +VariantDataType.VARIANTS = VariantDataType("variants") diff --git a/src/datadog_api_client/v2/model/variant_response.py b/src/datadog_api_client/v2/model/variant_response.py new file mode 100644 index 0000000000..5e3057c8c3 --- /dev/null +++ b/src/datadog_api_client/v2/model/variant_response.py @@ -0,0 +1,40 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.variant_response_data import VariantResponseData + + +class VariantResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.variant_response_data import VariantResponseData + + return { + "data": (VariantResponseData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: VariantResponseData, **kwargs): + """ + Response containing a variant. + + :param data: A variant resource. + :type data: VariantResponseData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/variant_response_attributes.py b/src/datadog_api_client/v2/model/variant_response_attributes.py new file mode 100644 index 0000000000..c5502d124f --- /dev/null +++ b/src/datadog_api_client/v2/model/variant_response_attributes.py @@ -0,0 +1,71 @@ +# 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, + datetime, + unset, + UnsetType, +) + + +class VariantResponseAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "created_at": (datetime,), + "key": (str,), + "name": (str,), + "updated_at": (datetime,), + "value": (str,), + } + + attribute_map = { + "created_at": "created_at", + "key": "key", + "name": "name", + "updated_at": "updated_at", + "value": "value", + } + + def __init__( + self_, + key: str, + name: str, + value: str, + created_at: Union[datetime, UnsetType] = unset, + updated_at: Union[datetime, UnsetType] = unset, + **kwargs, + ): + """ + Attributes of a variant. + + :param created_at: The timestamp when the variant was created. + :type created_at: datetime, optional + + :param key: The unique key of the variant. + :type key: str + + :param name: The name of the variant. + :type name: str + + :param updated_at: The timestamp when the variant was last updated. + :type updated_at: datetime, optional + + :param value: The value of the variant as a string. + :type value: str + """ + if created_at is not unset: + kwargs["created_at"] = created_at + if updated_at is not unset: + kwargs["updated_at"] = updated_at + super().__init__(kwargs) + + self_.key = key + self_.name = name + self_.value = value diff --git a/src/datadog_api_client/v2/model/variant_response_data.py b/src/datadog_api_client/v2/model/variant_response_data.py new file mode 100644 index 0000000000..263bb522b1 --- /dev/null +++ b/src/datadog_api_client/v2/model/variant_response_data.py @@ -0,0 +1,55 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.variant_response_attributes import VariantResponseAttributes + from datadog_api_client.v2.model.variant_data_type import VariantDataType + + +class VariantResponseData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.variant_response_attributes import VariantResponseAttributes + from datadog_api_client.v2.model.variant_data_type import VariantDataType + + return { + "attributes": (VariantResponseAttributes,), + "id": (UUID,), + "type": (VariantDataType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: VariantResponseAttributes, id: UUID, type: VariantDataType, **kwargs): + """ + A variant resource. + + :param attributes: Attributes of a variant. + :type attributes: VariantResponseAttributes + + :param id: The unique identifier of the variant. + :type id: UUID + + :param type: The resource type for variants. + :type type: VariantDataType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 7dcc7d10a2..050aaef15d 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -2053,6 +2053,8 @@ from datadog_api_client.v2.model.create_upload_response_data_type import CreateUploadResponseDataType from datadog_api_client.v2.model.create_user_notification_channel_request import CreateUserNotificationChannelRequest from datadog_api_client.v2.model.create_variant import CreateVariant +from datadog_api_client.v2.model.create_variant_data import CreateVariantData +from datadog_api_client.v2.model.create_variant_request import CreateVariantRequest from datadog_api_client.v2.model.create_workflow_request import CreateWorkflowRequest from datadog_api_client.v2.model.create_workflow_response import CreateWorkflowResponse from datadog_api_client.v2.model.creator import Creator @@ -12826,6 +12828,8 @@ 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_user_identity_providers_request import UpdateUserIdentityProvidersRequest +from datadog_api_client.v2.model.update_variant_attributes import UpdateVariantAttributes +from datadog_api_client.v2.model.update_variant_data import UpdateVariantData 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 @@ -13011,6 +13015,10 @@ from datadog_api_client.v2.model.validation_response import ValidationResponse from datadog_api_client.v2.model.value_type import ValueType from datadog_api_client.v2.model.variant import Variant +from datadog_api_client.v2.model.variant_data_type import VariantDataType +from datadog_api_client.v2.model.variant_response import VariantResponse +from datadog_api_client.v2.model.variant_response_attributes import VariantResponseAttributes +from datadog_api_client.v2.model.variant_response_data import VariantResponseData from datadog_api_client.v2.model.variant_weight import VariantWeight from datadog_api_client.v2.model.variant_weight_request import VariantWeightRequest from datadog_api_client.v2.model.version_history_update import VersionHistoryUpdate @@ -14725,6 +14733,8 @@ "CreateUploadResponseDataType", "CreateUserNotificationChannelRequest", "CreateVariant", + "CreateVariantData", + "CreateVariantRequest", "CreateWorkflowRequest", "CreateWorkflowResponse", "Creator", @@ -21624,6 +21634,8 @@ "UpdateTenancyConfigDataType", "UpdateTenancyConfigRequest", "UpdateUserIdentityProvidersRequest", + "UpdateVariantAttributes", + "UpdateVariantData", "UpdateVariantRequest", "UpdateWorkflowRequest", "UpdateWorkflowResponse", @@ -21771,6 +21783,10 @@ "ValidationResponse", "ValueType", "Variant", + "VariantDataType", + "VariantResponse", + "VariantResponseAttributes", + "VariantResponseData", "VariantWeight", "VariantWeightRequest", "VersionHistoryUpdate", diff --git a/tests/v2/features/feature_flags.feature b/tests/v2/features/feature_flags.feature index c2a82ad284..98d3aa2f7d 100644 --- a/tests/v2/features/feature_flags.feature +++ b/tests/v2/features/feature_flags.feature @@ -11,7 +11,7 @@ Feature: 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"} + And body with value {"data": {"attributes": {"key": "variant-abc123", "name": "Variant ABC123", "value": "true"}, "type": "variants"}} When the request is sent Then the response status is 400 Bad Request @@ -19,7 +19,7 @@ Feature: 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"} + And body with value {"data": {"attributes": {"key": "variant-abc123", "name": "Variant ABC123", "value": "true"}, "type": "variants"}} When the request is sent Then the response status is 409 Conflict - A variant with this key already exists on the flag. @@ -27,7 +27,7 @@ Feature: 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"} + And body with value {"data": {"attributes": {"key": "variant-abc123", "name": "Variant ABC123", "value": "true"}, "type": "variants"}} When the request is sent Then the response status is 201 Created @@ -35,7 +35,7 @@ Feature: 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"} + And body with value {"data": {"attributes": {"key": "variant-abc123", "name": "Variant ABC123", "value": "true"}, "type": "variants"}} When the request is sent Then the response status is 404 Not Found @@ -1092,7 +1092,7 @@ Feature: Feature Flags 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"} + And body with value {"data": {"attributes": {"name": "Variant ABC123 Updated", "value": "new_value"}, "id": "550e8400-e29b-41d4-a716-446655440002", "type": "variants"}} When the request is sent Then the response status is 400 Bad Request @@ -1101,7 +1101,7 @@ Feature: Feature Flags 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"} + And body with value {"data": {"attributes": {"name": "Variant ABC123 Updated", "value": "new_value"}, "id": "550e8400-e29b-41d4-a716-446655440002", "type": "variants"}} When the request is sent Then the response status is 409 Conflict - A pending suggestion already exists for this property. @@ -1110,7 +1110,7 @@ Feature: Feature Flags 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"} + And body with value {"data": {"attributes": {"name": "Variant ABC123 Updated", "value": "new_value"}, "id": "550e8400-e29b-41d4-a716-446655440002", "type": "variants"}} When the request is sent Then the response status is 404 Not Found @@ -1119,7 +1119,7 @@ Feature: Feature Flags 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"} + And body with value {"data": {"attributes": {"name": "Variant ABC123 Updated", "value": "new_value"}, "id": "550e8400-e29b-41d4-a716-446655440002", "type": "variants"}} When the request is sent Then the response status is 200 OK