Skip to content

Commit 260d499

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 01552e6 of spec repo
1 parent c3f6057 commit 260d499

10 files changed

Lines changed: 529 additions & 0 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24463,6 +24463,19 @@ components:
2446324463
description: The name of the feature flag.
2446424464
example: "Feature Flag ABC123"
2446524465
type: string
24466+
notification_rule_query:
24467+
description: |-
24468+
Query used to determine which change events on this feature flag trigger notifications to `rule_targets`. Uses Datadog's standard log search syntax (`AND`, `OR`, `NOT`, parentheses) to match against the `notification_type` facet.
24469+
24470+
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`.
24471+
example: "notification_type:rollout_started OR notification_type:targeting_rule_updated"
24472+
nullable: true
24473+
type: string
24474+
rule_targets:
24475+
description: Targets to notify about changes to this feature flag that match `notification_rule_query`.
24476+
items:
24477+
$ref: "#/components/schemas/NotificationRuleTarget"
24478+
type: array
2446624479
value_type:
2446724480
$ref: "#/components/schemas/ValueType"
2446824481
variants:
@@ -69161,6 +69174,95 @@ components:
6916169174
type: string
6916269175
x-enum-varnames:
6916369176
- MANUAL
69177+
NotificationRuleTarget:
69178+
description: A notification target that receives change alerts for a feature flag.
69179+
properties:
69180+
configuration:
69181+
$ref: "#/components/schemas/NotificationRuleTargetConfiguration"
69182+
type:
69183+
$ref: "#/components/schemas/NotificationRuleTargetType"
69184+
version:
69185+
description: Schema version of `configuration`.
69186+
example: 1
69187+
format: int64
69188+
type: integer
69189+
required:
69190+
- type
69191+
- version
69192+
- configuration
69193+
type: object
69194+
NotificationRuleTargetConfiguration:
69195+
description: "Configuration for a notification target. Which fields apply depends on the target's `type`."
69196+
properties:
69197+
channel:
69198+
description: Slack channel name, for a `SLACK_CHANNEL` target.
69199+
example: "#feature-flags"
69200+
type: string
69201+
channel_id:
69202+
description: Slack channel ID, for a `SLACK_CHANNEL` target, or Microsoft Teams channel ID, for an `MS_TEAMS_CHANNEL` target.
69203+
type: string
69204+
channel_name:
69205+
description: Microsoft Teams channel name, for an `MS_TEAMS_CHANNEL` target.
69206+
type: string
69207+
connector_name:
69208+
description: Microsoft Teams connector name, for an `MS_TEAMS_CHANNEL` target.
69209+
type: string
69210+
recipient:
69211+
$ref: "#/components/schemas/NotificationRuleTargetConfigurationRecipient"
69212+
service_name:
69213+
description: PagerDuty service name, for a `PAGERDUTY_SERVICE` target.
69214+
type: string
69215+
team_id:
69216+
description: Microsoft Teams team ID, for an `MS_TEAMS_CHANNEL` target.
69217+
type: string
69218+
team_name:
69219+
description: Microsoft Teams team name, for an `MS_TEAMS_CHANNEL` target.
69220+
type: string
69221+
tenant_id:
69222+
description: Microsoft Teams tenant ID, for an `MS_TEAMS_CHANNEL` target.
69223+
type: string
69224+
tenant_name:
69225+
description: Microsoft Teams tenant name, for an `MS_TEAMS_CHANNEL` target.
69226+
type: string
69227+
username:
69228+
description: Slack username, for a `SLACK_USER` target.
69229+
type: string
69230+
webhook_name:
69231+
description: Name of the configured webhook, for a `WEBHOOK` target.
69232+
type: string
69233+
workspace:
69234+
description: Slack workspace name, for a `SLACK_CHANNEL` or `SLACK_USER` target.
69235+
type: string
69236+
workspace_id:
69237+
description: Slack workspace ID, for a `SLACK_CHANNEL` target.
69238+
type: string
69239+
type: object
69240+
NotificationRuleTargetConfigurationRecipient:
69241+
description: Recipient for an `EMAIL` target.
69242+
properties:
69243+
email:
69244+
description: Email address to notify.
69245+
example: "user@example.com"
69246+
type: string
69247+
type: object
69248+
NotificationRuleTargetType:
69249+
description: The type of notification target.
69250+
enum:
69251+
- "EMAIL"
69252+
- "SLACK_CHANNEL"
69253+
- "SLACK_USER"
69254+
- "WEBHOOK"
69255+
- "PAGERDUTY_SERVICE"
69256+
- "MS_TEAMS_CHANNEL"
69257+
example: "SLACK_CHANNEL"
69258+
type: string
69259+
x-enum-varnames:
69260+
- EMAIL
69261+
- SLACK_CHANNEL
69262+
- SLACK_USER
69263+
- WEBHOOK
69264+
- PAGERDUTY_SERVICE
69265+
- MS_TEAMS_CHANNEL
6916469266
NotificationRulesListResponse:
6916569267
description: The list of notification rules.
6916669268
properties:

docs/datadog_api_client.v2.model.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28767,6 +28767,34 @@ datadog\_api\_client.v2.model.notification\_rule\_routing\_mode module
2876728767
:members:
2876828768
:show-inheritance:
2876928769

28770+
datadog\_api\_client.v2.model.notification\_rule\_target module
28771+
---------------------------------------------------------------
28772+
28773+
.. automodule:: datadog_api_client.v2.model.notification_rule_target
28774+
:members:
28775+
:show-inheritance:
28776+
28777+
datadog\_api\_client.v2.model.notification\_rule\_target\_configuration module
28778+
------------------------------------------------------------------------------
28779+
28780+
.. automodule:: datadog_api_client.v2.model.notification_rule_target_configuration
28781+
:members:
28782+
:show-inheritance:
28783+
28784+
datadog\_api\_client.v2.model.notification\_rule\_target\_configuration\_recipient module
28785+
-----------------------------------------------------------------------------------------
28786+
28787+
.. automodule:: datadog_api_client.v2.model.notification_rule_target_configuration_recipient
28788+
:members:
28789+
:show-inheritance:
28790+
28791+
datadog\_api\_client.v2.model.notification\_rule\_target\_type module
28792+
---------------------------------------------------------------------
28793+
28794+
.. automodule:: datadog_api_client.v2.model.notification_rule_target_type
28795+
:members:
28796+
:show-inheritance:
28797+
2877028798
datadog\_api\_client.v2.model.notification\_rules\_list\_response module
2877128799
------------------------------------------------------------------------
2877228800

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
"""
2+
Create a feature flag with notification rule targets returns "Created" response
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v2.api.feature_flags_api import FeatureFlagsApi
7+
from datadog_api_client.v2.model.create_feature_flag_attributes import CreateFeatureFlagAttributes
8+
from datadog_api_client.v2.model.create_feature_flag_data import CreateFeatureFlagData
9+
from datadog_api_client.v2.model.create_feature_flag_data_type import CreateFeatureFlagDataType
10+
from datadog_api_client.v2.model.create_feature_flag_request import CreateFeatureFlagRequest
11+
from datadog_api_client.v2.model.create_variant import CreateVariant
12+
from datadog_api_client.v2.model.notification_rule_target import NotificationRuleTarget
13+
from datadog_api_client.v2.model.notification_rule_target_configuration import NotificationRuleTargetConfiguration
14+
from datadog_api_client.v2.model.notification_rule_target_type import NotificationRuleTargetType
15+
from datadog_api_client.v2.model.value_type import ValueType
16+
17+
body = CreateFeatureFlagRequest(
18+
data=CreateFeatureFlagData(
19+
type=CreateFeatureFlagDataType.FEATURE_FLAGS,
20+
attributes=CreateFeatureFlagAttributes(
21+
default_variant_key="variant-Example-Feature-Flag-1",
22+
description="Test feature flag with notification rule targets for BDD scenarios",
23+
key="test-feature-flag-notify-Example-Feature-Flag",
24+
name="Test Feature Flag Notify Example-Feature-Flag",
25+
value_type=ValueType.BOOLEAN,
26+
variants=[
27+
CreateVariant(
28+
key="variant-Example-Feature-Flag-1",
29+
name="Variant Example-Feature-Flag A",
30+
value="true",
31+
),
32+
CreateVariant(
33+
key="variant-Example-Feature-Flag-2",
34+
name="Variant Example-Feature-Flag B",
35+
value="false",
36+
),
37+
],
38+
notification_rule_query="notification_type:rollout_started",
39+
rule_targets=[
40+
NotificationRuleTarget(
41+
type=NotificationRuleTargetType.SLACK_CHANNEL,
42+
version=1,
43+
configuration=NotificationRuleTargetConfiguration(
44+
channel="#feature-flags-test",
45+
workspace="datadoghq",
46+
),
47+
),
48+
],
49+
),
50+
),
51+
)
52+
53+
configuration = Configuration()
54+
with ApiClient(configuration) as api_client:
55+
api_instance = FeatureFlagsApi(api_client)
56+
response = api_instance.create_feature_flag(body=body)
57+
58+
print(response)

src/datadog_api_client/v2/model/create_feature_flag_attributes.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@
1515

1616

1717
if TYPE_CHECKING:
18+
from datadog_api_client.v2.model.notification_rule_target import NotificationRuleTarget
1819
from datadog_api_client.v2.model.value_type import ValueType
1920
from datadog_api_client.v2.model.create_variant import CreateVariant
2021

2122

2223
class CreateFeatureFlagAttributes(ModelNormal):
2324
@cached_property
2425
def openapi_types(_):
26+
from datadog_api_client.v2.model.notification_rule_target import NotificationRuleTarget
2527
from datadog_api_client.v2.model.value_type import ValueType
2628
from datadog_api_client.v2.model.create_variant import CreateVariant
2729

@@ -31,6 +33,8 @@ def openapi_types(_):
3133
"json_schema": (str, none_type),
3234
"key": (str,),
3335
"name": (str,),
36+
"notification_rule_query": (str, none_type),
37+
"rule_targets": ([NotificationRuleTarget],),
3438
"value_type": (ValueType,),
3539
"variants": ([CreateVariant],),
3640
}
@@ -41,6 +45,8 @@ def openapi_types(_):
4145
"json_schema": "json_schema",
4246
"key": "key",
4347
"name": "name",
48+
"notification_rule_query": "notification_rule_query",
49+
"rule_targets": "rule_targets",
4450
"value_type": "value_type",
4551
"variants": "variants",
4652
}
@@ -54,6 +60,8 @@ def __init__(
5460
variants: List[CreateVariant],
5561
default_variant_key: Union[str, none_type, UnsetType] = unset,
5662
json_schema: Union[str, none_type, UnsetType] = unset,
63+
notification_rule_query: Union[str, none_type, UnsetType] = unset,
64+
rule_targets: Union[List[NotificationRuleTarget], UnsetType] = unset,
5765
**kwargs,
5866
):
5967
"""
@@ -74,6 +82,14 @@ def __init__(
7482
:param name: The name of the feature flag.
7583
:type name: str
7684
85+
:param notification_rule_query: Query used to determine which change events on this feature flag trigger notifications to ``rule_targets``. Uses Datadog's standard log search syntax ( ``AND`` , ``OR`` , ``NOT`` , parentheses) to match against the ``notification_type`` facet.
86+
87+
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``.
88+
:type notification_rule_query: str, none_type, optional
89+
90+
:param rule_targets: Targets to notify about changes to this feature flag that match ``notification_rule_query``.
91+
:type rule_targets: [NotificationRuleTarget], optional
92+
7793
:param value_type: The type of values for the feature flag variants.
7894
:type value_type: ValueType
7995
@@ -84,6 +100,10 @@ def __init__(
84100
kwargs["default_variant_key"] = default_variant_key
85101
if json_schema is not unset:
86102
kwargs["json_schema"] = json_schema
103+
if notification_rule_query is not unset:
104+
kwargs["notification_rule_query"] = notification_rule_query
105+
if rule_targets is not unset:
106+
kwargs["rule_targets"] = rule_targets
87107
super().__init__(kwargs)
88108

89109
self_.description = description
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2019-Present Datadog, Inc.
4+
from __future__ import annotations
5+
6+
from typing import TYPE_CHECKING
7+
8+
from datadog_api_client.model_utils import (
9+
ModelNormal,
10+
cached_property,
11+
)
12+
13+
14+
if TYPE_CHECKING:
15+
from datadog_api_client.v2.model.notification_rule_target_configuration import NotificationRuleTargetConfiguration
16+
from datadog_api_client.v2.model.notification_rule_target_type import NotificationRuleTargetType
17+
18+
19+
class NotificationRuleTarget(ModelNormal):
20+
@cached_property
21+
def openapi_types(_):
22+
from datadog_api_client.v2.model.notification_rule_target_configuration import (
23+
NotificationRuleTargetConfiguration,
24+
)
25+
from datadog_api_client.v2.model.notification_rule_target_type import NotificationRuleTargetType
26+
27+
return {
28+
"configuration": (NotificationRuleTargetConfiguration,),
29+
"type": (NotificationRuleTargetType,),
30+
"version": (int,),
31+
}
32+
33+
attribute_map = {
34+
"configuration": "configuration",
35+
"type": "type",
36+
"version": "version",
37+
}
38+
39+
def __init__(
40+
self_,
41+
configuration: NotificationRuleTargetConfiguration,
42+
type: NotificationRuleTargetType,
43+
version: int,
44+
**kwargs,
45+
):
46+
"""
47+
A notification target that receives change alerts for a feature flag.
48+
49+
:param configuration: Configuration for a notification target. Which fields apply depends on the target's ``type``.
50+
:type configuration: NotificationRuleTargetConfiguration
51+
52+
:param type: The type of notification target.
53+
:type type: NotificationRuleTargetType
54+
55+
:param version: Schema version of ``configuration``.
56+
:type version: int
57+
"""
58+
super().__init__(kwargs)
59+
60+
self_.configuration = configuration
61+
self_.type = type
62+
self_.version = version

0 commit comments

Comments
 (0)