diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index b9855adfad..a6682bd69a 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -24714,6 +24714,26 @@ components: description: The name of the feature flag. example: "Feature Flag ABC123" type: string + notification_rule_query: + description: |- + Query used to determine which change events on this feature flag trigger notifications + to `rule_targets`. Uses Datadog log search syntax (`AND`, `OR`, `NOT`, parentheses) to + match against the `notification_type` facet. + + Supported `notification_type` values for a feature flag are: `flag_enabled_disabled`, + `flag_archived`, `flag_approval_required`, `rollout_started`, `rollout_scheduled`, + `rollout_step_started`, `rollout_paused_guardrail`, `rollout_paused_user`, + `rollout_aborted_guardrail`, `rollout_aborted_user`, `targeting_rule_created`, + `targeting_rule_updated`, `targeting_rule_updated_via_filter`, and + `targeting_rule_deleted`. + example: "notification_type:rollout_started OR notification_type:targeting_rule_updated" + nullable: true + type: string + rule_targets: + description: Targets to notify about changes to this feature flag that match `notification_rule_query`. + items: + $ref: "#/components/schemas/NotificationRuleTarget" + type: array value_type: $ref: "#/components/schemas/ValueType" variants: @@ -69678,6 +69698,109 @@ components: type: string x-enum-varnames: - MANUAL + NotificationRuleTarget: + description: A notification target that receives change alerts for a feature flag. + properties: + configuration: + $ref: "#/components/schemas/NotificationRuleTargetConfiguration" + type: + $ref: "#/components/schemas/NotificationRuleTargetType" + version: + description: Schema version of `configuration`. + example: 1 + format: int64 + type: integer + required: + - type + - version + - configuration + type: object + NotificationRuleTargetConfiguration: + description: "Configuration for a notification target. Which fields apply depends on the target's `type`." + properties: + channel: + description: Slack channel name, for a `SLACK_CHANNEL` target. + example: "#feature-flags" + type: string + channel_id: + description: |- + Slack channel ID for a `SLACK_CHANNEL` target, or Microsoft Teams channel ID + for an `MS_TEAMS_CHANNEL` target. + example: "C0123456789" + type: string + channel_name: + description: Microsoft Teams channel name, for an `MS_TEAMS_CHANNEL` target. + example: "Feature Flags" + type: string + connector_name: + description: Microsoft Teams connector name, for an `MS_TEAMS_CHANNEL` target. + example: "datadog-connector" + type: string + recipient: + $ref: "#/components/schemas/NotificationRuleTargetConfigurationRecipient" + service_name: + description: PagerDuty service name, for a `PAGERDUTY_SERVICE` target. + example: "feature-flags-oncall" + type: string + team_id: + description: Microsoft Teams team ID, for an `MS_TEAMS_CHANNEL` target. + example: "19:abcdef0123456789@thread.tacv2" + type: string + team_name: + description: Microsoft Teams team name, for an `MS_TEAMS_CHANNEL` target. + example: "Engineering" + type: string + tenant_id: + description: Microsoft Teams tenant ID, for an `MS_TEAMS_CHANNEL` target. + example: "72f988bf-86f1-41af-91ab-2d7cd011db47" + type: string + tenant_name: + description: Microsoft Teams tenant name, for an `MS_TEAMS_CHANNEL` target. + example: "Datadog" + type: string + username: + description: Slack username, for a `SLACK_USER` target. + example: "jane.doe" + type: string + webhook_name: + description: Name of the configured webhook, for a `WEBHOOK` target. + example: "feature-flags-webhook" + type: string + workspace: + description: Slack workspace name, for a `SLACK_CHANNEL` or `SLACK_USER` target. + example: "datadoghq" + type: string + workspace_id: + description: Slack workspace ID, for a `SLACK_CHANNEL` target. + example: "T0123456789" + type: string + type: object + NotificationRuleTargetConfigurationRecipient: + description: Recipient for an `EMAIL` target. + properties: + email: + description: Email address to notify. + example: "user@example.com" + type: string + type: object + NotificationRuleTargetType: + description: The type of notification target. + enum: + - "EMAIL" + - "SLACK_CHANNEL" + - "SLACK_USER" + - "WEBHOOK" + - "PAGERDUTY_SERVICE" + - "MS_TEAMS_CHANNEL" + example: "SLACK_CHANNEL" + type: string + x-enum-varnames: + - EMAIL + - SLACK_CHANNEL + - SLACK_USER + - WEBHOOK + - PAGERDUTY_SERVICE + - MS_TEAMS_CHANNEL NotificationRulesListResponse: description: The list of notification rules. properties: diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index dd3ca79916..ffa2de5232 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -29152,6 +29152,34 @@ datadog\_api\_client.v2.model.notification\_rule\_routing\_mode module :members: :show-inheritance: +datadog\_api\_client.v2.model.notification\_rule\_target module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.notification_rule_target + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.notification\_rule\_target\_configuration module +------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.notification_rule_target_configuration + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.notification\_rule\_target\_configuration\_recipient module +----------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.notification_rule_target_configuration_recipient + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.notification\_rule\_target\_type module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.notification_rule_target_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.notification\_rules\_list\_response module ------------------------------------------------------------------------ diff --git a/examples/v2/feature-flags/CreateFeatureFlag_2426084719.py b/examples/v2/feature-flags/CreateFeatureFlag_2426084719.py new file mode 100644 index 0000000000..305005d752 --- /dev/null +++ b/examples/v2/feature-flags/CreateFeatureFlag_2426084719.py @@ -0,0 +1,58 @@ +""" +Create a feature flag with notification rule targets 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_feature_flag_attributes import CreateFeatureFlagAttributes +from datadog_api_client.v2.model.create_feature_flag_data import CreateFeatureFlagData +from datadog_api_client.v2.model.create_feature_flag_data_type import CreateFeatureFlagDataType +from datadog_api_client.v2.model.create_feature_flag_request import CreateFeatureFlagRequest +from datadog_api_client.v2.model.create_variant import CreateVariant +from datadog_api_client.v2.model.notification_rule_target import NotificationRuleTarget +from datadog_api_client.v2.model.notification_rule_target_configuration import NotificationRuleTargetConfiguration +from datadog_api_client.v2.model.notification_rule_target_type import NotificationRuleTargetType +from datadog_api_client.v2.model.value_type import ValueType + +body = CreateFeatureFlagRequest( + data=CreateFeatureFlagData( + type=CreateFeatureFlagDataType.FEATURE_FLAGS, + attributes=CreateFeatureFlagAttributes( + default_variant_key="variant-Example-Feature-Flag-1", + description="Test feature flag with notification rule targets for BDD scenarios", + key="test-feature-flag-notify-Example-Feature-Flag", + name="Test Feature Flag Notify Example-Feature-Flag", + value_type=ValueType.BOOLEAN, + variants=[ + CreateVariant( + key="variant-Example-Feature-Flag-1", + name="Variant Example-Feature-Flag A", + value="true", + ), + CreateVariant( + key="variant-Example-Feature-Flag-2", + name="Variant Example-Feature-Flag B", + value="false", + ), + ], + notification_rule_query="notification_type:rollout_started", + rule_targets=[ + NotificationRuleTarget( + type=NotificationRuleTargetType.SLACK_CHANNEL, + version=1, + configuration=NotificationRuleTargetConfiguration( + channel="#feature-flags-test", + workspace="datadoghq", + ), + ), + ], + ), + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = FeatureFlagsApi(api_client) + response = api_instance.create_feature_flag(body=body) + + print(response) diff --git a/src/datadog_api_client/v2/model/create_feature_flag_attributes.py b/src/datadog_api_client/v2/model/create_feature_flag_attributes.py index 1ef7c88d86..d017d9bf21 100644 --- a/src/datadog_api_client/v2/model/create_feature_flag_attributes.py +++ b/src/datadog_api_client/v2/model/create_feature_flag_attributes.py @@ -15,6 +15,7 @@ if TYPE_CHECKING: + from datadog_api_client.v2.model.notification_rule_target import NotificationRuleTarget from datadog_api_client.v2.model.value_type import ValueType from datadog_api_client.v2.model.create_variant import CreateVariant @@ -22,6 +23,7 @@ class CreateFeatureFlagAttributes(ModelNormal): @cached_property def openapi_types(_): + from datadog_api_client.v2.model.notification_rule_target import NotificationRuleTarget from datadog_api_client.v2.model.value_type import ValueType from datadog_api_client.v2.model.create_variant import CreateVariant @@ -31,6 +33,8 @@ def openapi_types(_): "json_schema": (str, none_type), "key": (str,), "name": (str,), + "notification_rule_query": (str, none_type), + "rule_targets": ([NotificationRuleTarget],), "value_type": (ValueType,), "variants": ([CreateVariant],), } @@ -41,6 +45,8 @@ def openapi_types(_): "json_schema": "json_schema", "key": "key", "name": "name", + "notification_rule_query": "notification_rule_query", + "rule_targets": "rule_targets", "value_type": "value_type", "variants": "variants", } @@ -54,6 +60,8 @@ def __init__( variants: List[CreateVariant], default_variant_key: Union[str, none_type, UnsetType] = unset, json_schema: Union[str, none_type, UnsetType] = unset, + notification_rule_query: Union[str, none_type, UnsetType] = unset, + rule_targets: Union[List[NotificationRuleTarget], UnsetType] = unset, **kwargs, ): """ @@ -74,6 +82,21 @@ def __init__( :param name: The name of the feature flag. :type name: str + :param notification_rule_query: Query used to determine which change events on this feature flag trigger notifications + to ``rule_targets``. Uses Datadog log search syntax ( ``AND`` , ``OR`` , ``NOT`` , parentheses) to + match against the ``notification_type`` facet. + + Supported ``notification_type`` values for a feature flag are: ``flag_enabled_disabled`` , + ``flag_archived`` , ``flag_approval_required`` , ``rollout_started`` , ``rollout_scheduled`` , + ``rollout_step_started`` , ``rollout_paused_guardrail`` , ``rollout_paused_user`` , + ``rollout_aborted_guardrail`` , ``rollout_aborted_user`` , ``targeting_rule_created`` , + ``targeting_rule_updated`` , ``targeting_rule_updated_via_filter`` , and + ``targeting_rule_deleted``. + :type notification_rule_query: str, none_type, optional + + :param rule_targets: Targets to notify about changes to this feature flag that match ``notification_rule_query``. + :type rule_targets: [NotificationRuleTarget], optional + :param value_type: The type of values for the feature flag variants. :type value_type: ValueType @@ -84,6 +107,10 @@ def __init__( kwargs["default_variant_key"] = default_variant_key if json_schema is not unset: kwargs["json_schema"] = json_schema + if notification_rule_query is not unset: + kwargs["notification_rule_query"] = notification_rule_query + if rule_targets is not unset: + kwargs["rule_targets"] = rule_targets super().__init__(kwargs) self_.description = description diff --git a/src/datadog_api_client/v2/model/notification_rule_target.py b/src/datadog_api_client/v2/model/notification_rule_target.py new file mode 100644 index 0000000000..5b6de6ec7e --- /dev/null +++ b/src/datadog_api_client/v2/model/notification_rule_target.py @@ -0,0 +1,62 @@ +# 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.notification_rule_target_configuration import NotificationRuleTargetConfiguration + from datadog_api_client.v2.model.notification_rule_target_type import NotificationRuleTargetType + + +class NotificationRuleTarget(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.notification_rule_target_configuration import ( + NotificationRuleTargetConfiguration, + ) + from datadog_api_client.v2.model.notification_rule_target_type import NotificationRuleTargetType + + return { + "configuration": (NotificationRuleTargetConfiguration,), + "type": (NotificationRuleTargetType,), + "version": (int,), + } + + attribute_map = { + "configuration": "configuration", + "type": "type", + "version": "version", + } + + def __init__( + self_, + configuration: NotificationRuleTargetConfiguration, + type: NotificationRuleTargetType, + version: int, + **kwargs, + ): + """ + A notification target that receives change alerts for a feature flag. + + :param configuration: Configuration for a notification target. Which fields apply depends on the target's ``type``. + :type configuration: NotificationRuleTargetConfiguration + + :param type: The type of notification target. + :type type: NotificationRuleTargetType + + :param version: Schema version of ``configuration``. + :type version: int + """ + super().__init__(kwargs) + + self_.configuration = configuration + self_.type = type + self_.version = version diff --git a/src/datadog_api_client/v2/model/notification_rule_target_configuration.py b/src/datadog_api_client/v2/model/notification_rule_target_configuration.py new file mode 100644 index 0000000000..12d1b323a5 --- /dev/null +++ b/src/datadog_api_client/v2/model/notification_rule_target_configuration.py @@ -0,0 +1,155 @@ +# 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, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.notification_rule_target_configuration_recipient import ( + NotificationRuleTargetConfigurationRecipient, + ) + + +class NotificationRuleTargetConfiguration(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.notification_rule_target_configuration_recipient import ( + NotificationRuleTargetConfigurationRecipient, + ) + + return { + "channel": (str,), + "channel_id": (str,), + "channel_name": (str,), + "connector_name": (str,), + "recipient": (NotificationRuleTargetConfigurationRecipient,), + "service_name": (str,), + "team_id": (str,), + "team_name": (str,), + "tenant_id": (str,), + "tenant_name": (str,), + "username": (str,), + "webhook_name": (str,), + "workspace": (str,), + "workspace_id": (str,), + } + + attribute_map = { + "channel": "channel", + "channel_id": "channel_id", + "channel_name": "channel_name", + "connector_name": "connector_name", + "recipient": "recipient", + "service_name": "service_name", + "team_id": "team_id", + "team_name": "team_name", + "tenant_id": "tenant_id", + "tenant_name": "tenant_name", + "username": "username", + "webhook_name": "webhook_name", + "workspace": "workspace", + "workspace_id": "workspace_id", + } + + def __init__( + self_, + channel: Union[str, UnsetType] = unset, + channel_id: Union[str, UnsetType] = unset, + channel_name: Union[str, UnsetType] = unset, + connector_name: Union[str, UnsetType] = unset, + recipient: Union[NotificationRuleTargetConfigurationRecipient, UnsetType] = unset, + service_name: Union[str, UnsetType] = unset, + team_id: Union[str, UnsetType] = unset, + team_name: Union[str, UnsetType] = unset, + tenant_id: Union[str, UnsetType] = unset, + tenant_name: Union[str, UnsetType] = unset, + username: Union[str, UnsetType] = unset, + webhook_name: Union[str, UnsetType] = unset, + workspace: Union[str, UnsetType] = unset, + workspace_id: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Configuration for a notification target. Which fields apply depends on the target's ``type``. + + :param channel: Slack channel name, for a ``SLACK_CHANNEL`` target. + :type channel: str, optional + + :param channel_id: Slack channel ID for a ``SLACK_CHANNEL`` target, or Microsoft Teams channel ID + for an ``MS_TEAMS_CHANNEL`` target. + :type channel_id: str, optional + + :param channel_name: Microsoft Teams channel name, for an ``MS_TEAMS_CHANNEL`` target. + :type channel_name: str, optional + + :param connector_name: Microsoft Teams connector name, for an ``MS_TEAMS_CHANNEL`` target. + :type connector_name: str, optional + + :param recipient: Recipient for an ``EMAIL`` target. + :type recipient: NotificationRuleTargetConfigurationRecipient, optional + + :param service_name: PagerDuty service name, for a ``PAGERDUTY_SERVICE`` target. + :type service_name: str, optional + + :param team_id: Microsoft Teams team ID, for an ``MS_TEAMS_CHANNEL`` target. + :type team_id: str, optional + + :param team_name: Microsoft Teams team name, for an ``MS_TEAMS_CHANNEL`` target. + :type team_name: str, optional + + :param tenant_id: Microsoft Teams tenant ID, for an ``MS_TEAMS_CHANNEL`` target. + :type tenant_id: str, optional + + :param tenant_name: Microsoft Teams tenant name, for an ``MS_TEAMS_CHANNEL`` target. + :type tenant_name: str, optional + + :param username: Slack username, for a ``SLACK_USER`` target. + :type username: str, optional + + :param webhook_name: Name of the configured webhook, for a ``WEBHOOK`` target. + :type webhook_name: str, optional + + :param workspace: Slack workspace name, for a ``SLACK_CHANNEL`` or ``SLACK_USER`` target. + :type workspace: str, optional + + :param workspace_id: Slack workspace ID, for a ``SLACK_CHANNEL`` target. + :type workspace_id: str, optional + """ + if channel is not unset: + kwargs["channel"] = channel + if channel_id is not unset: + kwargs["channel_id"] = channel_id + if channel_name is not unset: + kwargs["channel_name"] = channel_name + if connector_name is not unset: + kwargs["connector_name"] = connector_name + if recipient is not unset: + kwargs["recipient"] = recipient + if service_name is not unset: + kwargs["service_name"] = service_name + if team_id is not unset: + kwargs["team_id"] = team_id + if team_name is not unset: + kwargs["team_name"] = team_name + if tenant_id is not unset: + kwargs["tenant_id"] = tenant_id + if tenant_name is not unset: + kwargs["tenant_name"] = tenant_name + if username is not unset: + kwargs["username"] = username + if webhook_name is not unset: + kwargs["webhook_name"] = webhook_name + if workspace is not unset: + kwargs["workspace"] = workspace + if workspace_id is not unset: + kwargs["workspace_id"] = workspace_id + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/notification_rule_target_configuration_recipient.py b/src/datadog_api_client/v2/model/notification_rule_target_configuration_recipient.py new file mode 100644 index 0000000000..84b5c463a8 --- /dev/null +++ b/src/datadog_api_client/v2/model/notification_rule_target_configuration_recipient.py @@ -0,0 +1,36 @@ +# 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 NotificationRuleTargetConfigurationRecipient(ModelNormal): + @cached_property + def openapi_types(_): + return { + "email": (str,), + } + + attribute_map = { + "email": "email", + } + + def __init__(self_, email: Union[str, UnsetType] = unset, **kwargs): + """ + Recipient for an ``EMAIL`` target. + + :param email: Email address to notify. + :type email: str, optional + """ + if email is not unset: + kwargs["email"] = email + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/notification_rule_target_type.py b/src/datadog_api_client/v2/model/notification_rule_target_type.py new file mode 100644 index 0000000000..3e7088b7c9 --- /dev/null +++ b/src/datadog_api_client/v2/model/notification_rule_target_type.py @@ -0,0 +1,50 @@ +# 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 NotificationRuleTargetType(ModelSimple): + """ + The type of notification target. + + :param value: Must be one of ["EMAIL", "SLACK_CHANNEL", "SLACK_USER", "WEBHOOK", "PAGERDUTY_SERVICE", "MS_TEAMS_CHANNEL"]. + :type value: str + """ + + allowed_values = { + "EMAIL", + "SLACK_CHANNEL", + "SLACK_USER", + "WEBHOOK", + "PAGERDUTY_SERVICE", + "MS_TEAMS_CHANNEL", + } + EMAIL: ClassVar["NotificationRuleTargetType"] + SLACK_CHANNEL: ClassVar["NotificationRuleTargetType"] + SLACK_USER: ClassVar["NotificationRuleTargetType"] + WEBHOOK: ClassVar["NotificationRuleTargetType"] + PAGERDUTY_SERVICE: ClassVar["NotificationRuleTargetType"] + MS_TEAMS_CHANNEL: ClassVar["NotificationRuleTargetType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +NotificationRuleTargetType.EMAIL = NotificationRuleTargetType("EMAIL") +NotificationRuleTargetType.SLACK_CHANNEL = NotificationRuleTargetType("SLACK_CHANNEL") +NotificationRuleTargetType.SLACK_USER = NotificationRuleTargetType("SLACK_USER") +NotificationRuleTargetType.WEBHOOK = NotificationRuleTargetType("WEBHOOK") +NotificationRuleTargetType.PAGERDUTY_SERVICE = NotificationRuleTargetType("PAGERDUTY_SERVICE") +NotificationRuleTargetType.MS_TEAMS_CHANNEL = NotificationRuleTargetType("MS_TEAMS_CHANNEL") diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index ee093b4336..b6337fcdb7 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -5567,6 +5567,12 @@ from datadog_api_client.v2.model.notification_rule_response import NotificationRuleResponse from datadog_api_client.v2.model.notification_rule_routing import NotificationRuleRouting from datadog_api_client.v2.model.notification_rule_routing_mode import NotificationRuleRoutingMode +from datadog_api_client.v2.model.notification_rule_target import NotificationRuleTarget +from datadog_api_client.v2.model.notification_rule_target_configuration import NotificationRuleTargetConfiguration +from datadog_api_client.v2.model.notification_rule_target_configuration_recipient import ( + NotificationRuleTargetConfigurationRecipient, +) +from datadog_api_client.v2.model.notification_rule_target_type import NotificationRuleTargetType from datadog_api_client.v2.model.notification_rules_list_response import NotificationRulesListResponse from datadog_api_client.v2.model.notification_rules_type import NotificationRulesType from datadog_api_client.v2.model.notion_api_key import NotionAPIKey @@ -14741,6 +14747,10 @@ "NotificationRuleResponse", "NotificationRuleRouting", "NotificationRuleRoutingMode", + "NotificationRuleTarget", + "NotificationRuleTargetConfiguration", + "NotificationRuleTargetConfigurationRecipient", + "NotificationRuleTargetType", "NotificationRulesListResponse", "NotificationRulesType", "NotionAPIKey", diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_feature_flag_with_notification_rule_targets_returns_created_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_a_feature_flag_with_notification_rule_targets_returns_created_response.frozen new file mode 100644 index 0000000000..0ef87c70b9 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_a_feature_flag_with_notification_rule_targets_returns_created_response.frozen @@ -0,0 +1 @@ +2026-08-10T13:53:40.860Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_feature_flag_with_notification_rule_targets_returns_created_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_a_feature_flag_with_notification_rule_targets_returns_created_response.yaml new file mode 100644 index 0000000000..71aaa3d812 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_a_feature_flag_with_notification_rule_targets_returns_created_response.yaml @@ -0,0 +1,88 @@ +interactions: +- request: + body: '{"data":{"attributes":{"default_variant_key":"variant-Test-Create_a_feature_flag_with_notification_rule_targets_returns_Created_response-1786370020-1","description":"Test + feature flag with notification rule targets for BDD scenarios","key":"test-feature-flag-notify-Test-Create_a_feature_flag_with_notification_rule_targets_returns_Created_response-1786370020","name":"Test + Feature Flag Notify Test-Create_a_feature_flag_with_notification_rule_targets_returns_Created_response-1786370020","notification_rule_query":"notification_type:rollout_started","rule_targets":[{"configuration":{"channel":"#feature-flags-test","workspace":"datadoghq"},"type":"SLACK_CHANNEL","version":1}],"value_type":"BOOLEAN","variants":[{"key":"variant-Test-Create_a_feature_flag_with_notification_rule_targets_returns_Created_response-1786370020-1","name":"Variant + Test-Create_a_feature_flag_with_notification_rule_targets_returns_Created_response-1786370020 + A","value":"true"},{"key":"variant-Test-Create_a_feature_flag_with_notification_rule_targets_returns_Created_response-1786370020-2","name":"Variant + Test-Create_a_feature_flag_with_notification_rule_targets_returns_Created_response-1786370020 + B","value":"false"}]},"type":"feature-flags"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/feature-flags + response: + body: + string: '{"data":{"id":"9d8682a3-bee3-4c44-9dbb-0c440677560a","type":"feature-flags","attributes":{"archived_at":null,"created_at":"2026-08-10T13:53:41.832729Z","created_by":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","description":"Test + feature flag with notification rule targets for BDD scenarios","distribution_channel":"ALL","feature_flag_environments":[{"environment_id":"592600c2-8327-424d-960f-608c327ee96d","environment_name":"Test + Environment Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774470658","environment_queries":["test-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774470658","env-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774470658"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-1d656919df39","override_allocation_key":"allocation-override-1d656919df39","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"809cd83d-51ac-4f60-9ce5-cfad4d662114","environment_name":"Test + Environment Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774471346","environment_queries":["test-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774471346","env-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774471346"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-5b37830ecf82","override_allocation_key":"allocation-override-5b37830ecf82","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"21c84268-9fc7-4b6d-82ea-bb2090469aba","environment_name":"Test + Environment Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774472385","environment_queries":["env-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774472385","test-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774472385"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-a51b0d0ad816","override_allocation_key":"allocation-override-a51b0d0ad816","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"0b94dbaa-9efb-419d-8bd7-ef56f3828986","environment_name":"Test + Environment Test-Typescript-Create_an_environment_returns_Created_response-1773321543","environment_queries":["staging","test"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-d2f89ef224fa","override_allocation_key":"allocation-override-d2f89ef224fa","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"afdaa512-6307-4965-bf92-62cc6bea5d00","environment_name":"Test + Environment Test-Typescript-Create_an_environment_returns_Created_response-1773322166","environment_queries":["test-Test-Typescript-Create_an_environment_returns_Created_response-1773322166","env-Test-Typescript-Create_an_environment_returns_Created_response-1773322166"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-47857e41dc6a","override_allocation_key":"allocation-override-47857e41dc6a","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"04136d44-b58d-445b-b5c9-055f99575766","environment_name":"Test + Environment Test-Typescript-Create_an_environment_returns_Created_response-1784893502","environment_queries":["test-Test-Typescript-Create_an_environment_returns_Created_response-1784893502","env-Test-Typescript-Create_an_environment_returns_Created_response-1784893502"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-226c05eccc4c","override_allocation_key":"allocation-override-226c05eccc4c","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"1203bcba-445f-4731-8842-a59d1073914f","environment_name":"Test + Environment Test-Typescript-Create_an_environment_returns_Created_response-1785154419","environment_queries":["test-Test-Typescript-Create_an_environment_returns_Created_response-1785154419","env-Test-Typescript-Create_an_environment_returns_Created_response-1785154419"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-a94e04898e28","override_allocation_key":"allocation-override-a94e04898e28","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"3e2bf225-677f-49c2-8cab-d16c0f1b0d5f","environment_name":"Test + Environment Test-Typescript-Create_an_environment_returns_Created_response-1785239524","environment_queries":["test-Test-Typescript-Create_an_environment_returns_Created_response-1785239524","env-Test-Typescript-Create_an_environment_returns_Created_response-1785239524"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-0794ae4bccf7","override_allocation_key":"allocation-override-0794ae4bccf7","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"5e00d2e3-2b06-4e60-a7ae-8c1a684a1fc5","environment_name":"Test + Environment Test-Typescript-Create_an_environment_returns_Created_response-1785326063","environment_queries":["test-Test-Typescript-Create_an_environment_returns_Created_response-1785326063","env-Test-Typescript-Create_an_environment_returns_Created_response-1785326063"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-7f61c654cf38","override_allocation_key":"allocation-override-7f61c654cf38","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"895d6669-f281-40ca-905f-95764b063997","environment_name":"Test + Environment Test-Typescript-Create_an_environment_returns_Created_response-1785412365","environment_queries":["test-Test-Typescript-Create_an_environment_returns_Created_response-1785412365","env-Test-Typescript-Create_an_environment_returns_Created_response-1785412365"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-ef1b5324d5fb","override_allocation_key":"allocation-override-ef1b5324d5fb","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"7477eea0-4499-452d-ad94-1e6188b8c5bc","environment_name":"Test + Environment Test-Typescript-Create_an_environment_returns_Created_response-1785498929","environment_queries":["env-Test-Typescript-Create_an_environment_returns_Created_response-1785498929","test-Test-Typescript-Create_an_environment_returns_Created_response-1785498929"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-71403bfeb6d8","override_allocation_key":"allocation-override-71403bfeb6d8","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"ecfbcdb4-306b-4adb-8438-03f3afaff0c9","environment_name":"Test + Environment Test-Typescript-Create_an_environment_returns_Created_response-1785759287","environment_queries":["test-Test-Typescript-Create_an_environment_returns_Created_response-1785759287","env-Test-Typescript-Create_an_environment_returns_Created_response-1785759287"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-9bc2239d583a","override_allocation_key":"allocation-override-9bc2239d583a","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"414342a5-9711-4cf2-b55e-9c573c669795","environment_name":"Test + Environment Test-Typescript-Create_an_environment_returns_Created_response-1785844421","environment_queries":["test-Test-Typescript-Create_an_environment_returns_Created_response-1785844421","env-Test-Typescript-Create_an_environment_returns_Created_response-1785844421"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-9a54cdadf135","override_allocation_key":"allocation-override-9a54cdadf135","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"1b7521fe-8131-46e2-b56c-e089d0b7270c","environment_name":"Test + Environment Test-Typescript-Create_an_environment_returns_Created_response-1785930926","environment_queries":["env-Test-Typescript-Create_an_environment_returns_Created_response-1785930926","test-Test-Typescript-Create_an_environment_returns_Created_response-1785930926"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-31afdce5a980","override_allocation_key":"allocation-override-31afdce5a980","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"230474f1-a11d-48b2-ba97-db27be150ae3","environment_name":"Test + Environment Test-Typescript-Create_an_environment_returns_Created_response-1786017494","environment_queries":["test-Test-Typescript-Create_an_environment_returns_Created_response-1786017494","env-Test-Typescript-Create_an_environment_returns_Created_response-1786017494"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-18ef39c3ed0c","override_allocation_key":"allocation-override-18ef39c3ed0c","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"30dbdd46-0371-4d6f-9f0e-560900b80df9","environment_name":"Test + Environment Test-Typescript-Create_an_environment_returns_Created_response-1786102241","environment_queries":["test-Test-Typescript-Create_an_environment_returns_Created_response-1786102241","env-Test-Typescript-Create_an_environment_returns_Created_response-1786102241"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-9083b0fad5f0","override_allocation_key":"allocation-override-9083b0fad5f0","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"838b7cae-0e39-4a49-a039-6192291e1180","environment_name":"Test + Environment Test-Typescript-Create_an_environment_returns_Created_response-1786361780","environment_queries":["test-Test-Typescript-Create_an_environment_returns_Created_response-1786361780","env-Test-Typescript-Create_an_environment_returns_Created_response-1786361780"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-4f7dfc5fe4ab","override_allocation_key":"allocation-override-4f7dfc5fe4ab","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null}],"is_favorite":false,"key":"test-feature-flag-notify-Test-Create_a_feature_flag_with_notification_rule_targets_returns_Created_response-1786370020","last_updated_by":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"Test + Feature Flag Notify Test-Create_a_feature_flag_with_notification_rule_targets_returns_Created_response-1786370020","require_approval":false,"staleness_details":{"id":"9d8682a3-bee3-4c44-9dbb-0c440677560a","staleness_status":"ACTIVE","stale_reason":null,"recommended_actions":null,"code_references":null,"skip_state_check_until":null,"dismissed_by":null},"staleness_status":"ACTIVE","tags":[],"updated_at":"2026-08-10T13:53:41.832729Z","value_type":"BOOLEAN","variants":[{"id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","key":"variant-Test-Create_a_feature_flag_with_notification_rule_targets_returns_Created_response-1786370020-1","name":"Variant + Test-Create_a_feature_flag_with_notification_rule_targets_returns_Created_response-1786370020 + A","value":"true","created_at":"2026-08-10T13:53:41.847275Z","updated_at":"2026-08-10T13:53:41.847275Z"},{"id":"ce277a45-cc74-4b66-b20c-9bea61d3eba9","key":"variant-Test-Create_a_feature_flag_with_notification_rule_targets_returns_Created_response-1786370020-2","name":"Variant + Test-Create_a_feature_flag_with_notification_rule_targets_returns_Created_response-1786370020 + B","value":"false","created_at":"2026-08-10T13:53:41.851104Z","updated_at":"2026-08-10T13:53:41.851104Z"}]}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 201 + message: Created +- request: + body: null + headers: + accept: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/feature-flags/9d8682a3-bee3-4c44-9dbb-0c440677560a/archive + response: + body: + string: '{"data":{"id":"9d8682a3-bee3-4c44-9dbb-0c440677560a","type":"feature-flags","attributes":{"archived_at":"2026-08-10T13:53:42.468506Z","created_at":"2026-08-10T13:53:41.832729Z","created_by":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","description":"Test + feature flag with notification rule targets for BDD scenarios","distribution_channel":"ALL","feature_flag_environments":[{"environment_id":"592600c2-8327-424d-960f-608c327ee96d","environment_name":"Test + Environment Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774470658","environment_queries":["test-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774470658","env-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774470658"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-1d656919df39","override_allocation_key":"allocation-override-1d656919df39","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"809cd83d-51ac-4f60-9ce5-cfad4d662114","environment_name":"Test + Environment Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774471346","environment_queries":["test-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774471346","env-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774471346"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-5b37830ecf82","override_allocation_key":"allocation-override-5b37830ecf82","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"21c84268-9fc7-4b6d-82ea-bb2090469aba","environment_name":"Test + Environment Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774472385","environment_queries":["test-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774472385","env-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774472385"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-a51b0d0ad816","override_allocation_key":"allocation-override-a51b0d0ad816","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"0b94dbaa-9efb-419d-8bd7-ef56f3828986","environment_name":"Test + Environment Test-Typescript-Create_an_environment_returns_Created_response-1773321543","environment_queries":["staging","test"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-d2f89ef224fa","override_allocation_key":"allocation-override-d2f89ef224fa","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"afdaa512-6307-4965-bf92-62cc6bea5d00","environment_name":"Test + Environment Test-Typescript-Create_an_environment_returns_Created_response-1773322166","environment_queries":["test-Test-Typescript-Create_an_environment_returns_Created_response-1773322166","env-Test-Typescript-Create_an_environment_returns_Created_response-1773322166"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-47857e41dc6a","override_allocation_key":"allocation-override-47857e41dc6a","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"04136d44-b58d-445b-b5c9-055f99575766","environment_name":"Test + Environment Test-Typescript-Create_an_environment_returns_Created_response-1784893502","environment_queries":["test-Test-Typescript-Create_an_environment_returns_Created_response-1784893502","env-Test-Typescript-Create_an_environment_returns_Created_response-1784893502"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-226c05eccc4c","override_allocation_key":"allocation-override-226c05eccc4c","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"1203bcba-445f-4731-8842-a59d1073914f","environment_name":"Test + Environment Test-Typescript-Create_an_environment_returns_Created_response-1785154419","environment_queries":["test-Test-Typescript-Create_an_environment_returns_Created_response-1785154419","env-Test-Typescript-Create_an_environment_returns_Created_response-1785154419"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-a94e04898e28","override_allocation_key":"allocation-override-a94e04898e28","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"3e2bf225-677f-49c2-8cab-d16c0f1b0d5f","environment_name":"Test + Environment Test-Typescript-Create_an_environment_returns_Created_response-1785239524","environment_queries":["env-Test-Typescript-Create_an_environment_returns_Created_response-1785239524","test-Test-Typescript-Create_an_environment_returns_Created_response-1785239524"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-0794ae4bccf7","override_allocation_key":"allocation-override-0794ae4bccf7","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"5e00d2e3-2b06-4e60-a7ae-8c1a684a1fc5","environment_name":"Test + Environment Test-Typescript-Create_an_environment_returns_Created_response-1785326063","environment_queries":["test-Test-Typescript-Create_an_environment_returns_Created_response-1785326063","env-Test-Typescript-Create_an_environment_returns_Created_response-1785326063"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-7f61c654cf38","override_allocation_key":"allocation-override-7f61c654cf38","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"895d6669-f281-40ca-905f-95764b063997","environment_name":"Test + Environment Test-Typescript-Create_an_environment_returns_Created_response-1785412365","environment_queries":["test-Test-Typescript-Create_an_environment_returns_Created_response-1785412365","env-Test-Typescript-Create_an_environment_returns_Created_response-1785412365"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-ef1b5324d5fb","override_allocation_key":"allocation-override-ef1b5324d5fb","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"7477eea0-4499-452d-ad94-1e6188b8c5bc","environment_name":"Test + Environment Test-Typescript-Create_an_environment_returns_Created_response-1785498929","environment_queries":["test-Test-Typescript-Create_an_environment_returns_Created_response-1785498929","env-Test-Typescript-Create_an_environment_returns_Created_response-1785498929"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-71403bfeb6d8","override_allocation_key":"allocation-override-71403bfeb6d8","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"ecfbcdb4-306b-4adb-8438-03f3afaff0c9","environment_name":"Test + Environment Test-Typescript-Create_an_environment_returns_Created_response-1785759287","environment_queries":["test-Test-Typescript-Create_an_environment_returns_Created_response-1785759287","env-Test-Typescript-Create_an_environment_returns_Created_response-1785759287"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-9bc2239d583a","override_allocation_key":"allocation-override-9bc2239d583a","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"414342a5-9711-4cf2-b55e-9c573c669795","environment_name":"Test + Environment Test-Typescript-Create_an_environment_returns_Created_response-1785844421","environment_queries":["env-Test-Typescript-Create_an_environment_returns_Created_response-1785844421","test-Test-Typescript-Create_an_environment_returns_Created_response-1785844421"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-9a54cdadf135","override_allocation_key":"allocation-override-9a54cdadf135","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"1b7521fe-8131-46e2-b56c-e089d0b7270c","environment_name":"Test + Environment Test-Typescript-Create_an_environment_returns_Created_response-1785930926","environment_queries":["test-Test-Typescript-Create_an_environment_returns_Created_response-1785930926","env-Test-Typescript-Create_an_environment_returns_Created_response-1785930926"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-31afdce5a980","override_allocation_key":"allocation-override-31afdce5a980","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"230474f1-a11d-48b2-ba97-db27be150ae3","environment_name":"Test + Environment Test-Typescript-Create_an_environment_returns_Created_response-1786017494","environment_queries":["test-Test-Typescript-Create_an_environment_returns_Created_response-1786017494","env-Test-Typescript-Create_an_environment_returns_Created_response-1786017494"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-18ef39c3ed0c","override_allocation_key":"allocation-override-18ef39c3ed0c","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"30dbdd46-0371-4d6f-9f0e-560900b80df9","environment_name":"Test + Environment Test-Typescript-Create_an_environment_returns_Created_response-1786102241","environment_queries":["test-Test-Typescript-Create_an_environment_returns_Created_response-1786102241","env-Test-Typescript-Create_an_environment_returns_Created_response-1786102241"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-9083b0fad5f0","override_allocation_key":"allocation-override-9083b0fad5f0","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null},{"environment_id":"838b7cae-0e39-4a49-a039-6192291e1180","environment_name":"Test + Environment Test-Typescript-Create_an_environment_returns_Created_response-1786361780","environment_queries":["test-Test-Typescript-Create_an_environment_returns_Created_response-1786361780","env-Test-Typescript-Create_an_environment_returns_Created_response-1786361780"],"status":"DISABLED","default_variant_id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","override_variant_id":null,"default_allocation_key":"allocation-default-4f7dfc5fe4ab","override_allocation_key":"allocation-override-4f7dfc5fe4ab","allocations":null,"is_production":false,"require_feature_flag_approval":false,"observe_full_evaluation_data":false,"pending_suggestion_id":null}],"is_favorite":false,"key":"test-feature-flag-notify-Test-Create_a_feature_flag_with_notification_rule_targets_returns_Created_response-1786370020","last_updated_by":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"Test + Feature Flag Notify Test-Create_a_feature_flag_with_notification_rule_targets_returns_Created_response-1786370020","require_approval":false,"staleness_details":{"id":"9d8682a3-bee3-4c44-9dbb-0c440677560a","staleness_status":"ACTIVE","stale_reason":null,"recommended_actions":null,"code_references":[],"skip_state_check_until":null,"dismissed_by":null},"staleness_status":"ACTIVE","tags":[],"updated_at":"2026-08-10T13:53:42.468506Z","value_type":"BOOLEAN","variants":[{"id":"d20d7517-d398-47f3-9ede-1db93a4ff44b","key":"variant-Test-Create_a_feature_flag_with_notification_rule_targets_returns_Created_response-1786370020-1","name":"Variant + Test-Create_a_feature_flag_with_notification_rule_targets_returns_Created_response-1786370020 + A","value":"true","created_at":"2026-08-10T13:53:41.847275Z","updated_at":"2026-08-10T13:53:41.847275Z"},{"id":"ce277a45-cc74-4b66-b20c-9bea61d3eba9","key":"variant-Test-Create_a_feature_flag_with_notification_rule_targets_returns_Created_response-1786370020-2","name":"Variant + Test-Create_a_feature_flag_with_notification_rule_targets_returns_Created_response-1786370020 + B","value":"false","created_at":"2026-08-10T13:53:41.851104Z","updated_at":"2026-08-10T13:53:41.851104Z"}]}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v2/features/feature_flags.feature b/tests/v2/features/feature_flags.feature index f44699236d..36ffeb8de6 100644 --- a/tests/v2/features/feature_flags.feature +++ b/tests/v2/features/feature_flags.feature @@ -85,6 +85,15 @@ Feature: Feature Flags And the response "data.attributes.name" is equal to "Test Feature Flag {{ unique }}" And the response "data.attributes.value_type" is equal to "BOOLEAN" + @team:DataDog/feature-flags + Scenario: Create a feature flag with notification rule targets returns "Created" response + Given new "CreateFeatureFlag" request + And body with value {"data": {"type": "feature-flags", "attributes": {"default_variant_key": "variant-{{ unique }}-1", "description": "Test feature flag with notification rule targets for BDD scenarios", "key": "test-feature-flag-notify-{{ unique }}", "name": "Test Feature Flag Notify {{ unique }}", "value_type": "BOOLEAN", "variants": [{"key": "variant-{{ unique }}-1", "name": "Variant {{ unique }} A", "value": "true"}, {"key": "variant-{{ unique }}-2", "name": "Variant {{ unique }} B", "value": "false"}], "notification_rule_query": "notification_type:rollout_started", "rule_targets": [{"type": "SLACK_CHANNEL", "version": 1, "configuration": {"channel": "#feature-flags-test", "workspace": "datadoghq"}}]}}} + When the request is sent + Then the response status is 201 Created + And the response "data.attributes.key" is equal to "test-feature-flag-notify-{{ unique }}" + And the response "data.attributes.name" is equal to "Test Feature Flag Notify {{ unique }}" + @team:DataDog/feature-flags Scenario: Create allocation for a flag in an environment returns "Created" response Given there is a valid "feature_flag" in the system