diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index b9855adfad5e..a6682bd69a7c 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/cassettes/features/v2/feature_flags/Create-a-feature-flag-with-notification-rule-targets-returns-Created-response.frozen b/cassettes/features/v2/feature_flags/Create-a-feature-flag-with-notification-rule-targets-returns-Created-response.frozen new file mode 100644 index 000000000000..0ef87c70b9ac --- /dev/null +++ b/cassettes/features/v2/feature_flags/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/cassettes/features/v2/feature_flags/Create-a-feature-flag-with-notification-rule-targets-returns-Created-response.yml b/cassettes/features/v2/feature_flags/Create-a-feature-flag-with-notification-rule-targets-returns-Created-response.yml new file mode 100644 index 000000000000..9de612cf7ce3 --- /dev/null +++ b/cassettes/features/v2/feature_flags/Create-a-feature-flag-with-notification-rule-targets-returns-Created-response.yml @@ -0,0 +1,94 @@ +http_interactions: +- recorded_at: Mon, 10 Aug 2026 13:53:40 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + encoding: UTF-8 + 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 +- recorded_at: Mon, 10 Aug 2026 13:53:40 GMT + 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: + encoding: UTF-8 + 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 +recorded_with: VCR 6.0.0 diff --git a/examples/v2/feature-flags/CreateFeatureFlag_2426084719.rb b/examples/v2/feature-flags/CreateFeatureFlag_2426084719.rb new file mode 100644 index 000000000000..d21d06c21c34 --- /dev/null +++ b/examples/v2/feature-flags/CreateFeatureFlag_2426084719.rb @@ -0,0 +1,41 @@ +# Create a feature flag with notification rule targets returns "Created" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::FeatureFlagsAPI.new + +body = DatadogAPIClient::V2::CreateFeatureFlagRequest.new({ + data: DatadogAPIClient::V2::CreateFeatureFlagData.new({ + type: DatadogAPIClient::V2::CreateFeatureFlagDataType::FEATURE_FLAGS, + attributes: DatadogAPIClient::V2::CreateFeatureFlagAttributes.new({ + 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: DatadogAPIClient::V2::ValueType::BOOLEAN, + variants: [ + DatadogAPIClient::V2::CreateVariant.new({ + key: "variant-Example-Feature-Flag-1", + name: "Variant Example-Feature-Flag A", + value: "true", + }), + DatadogAPIClient::V2::CreateVariant.new({ + key: "variant-Example-Feature-Flag-2", + name: "Variant Example-Feature-Flag B", + value: "false", + }), + ], + notification_rule_query: "notification_type:rollout_started", + rule_targets: [ + DatadogAPIClient::V2::NotificationRuleTarget.new({ + type: DatadogAPIClient::V2::NotificationRuleTargetType::SLACK_CHANNEL, + version: 1, + configuration: DatadogAPIClient::V2::NotificationRuleTargetConfiguration.new({ + channel: "#feature-flags-test", + workspace: "datadoghq", + }), + }), + ], + }), + }), +}) +p api_instance.create_feature_flag(body) diff --git a/features/v2/feature_flags.feature b/features/v2/feature_flags.feature index f44699236d86..36ffeb8de6ff 100644 --- a/features/v2/feature_flags.feature +++ b/features/v2/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 diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index addb23ed3797..a53b2e9f4624 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -5309,6 +5309,10 @@ def overrides "v2.notification_rule_routing_mode" => "NotificationRuleRoutingMode", "v2.notification_rules_list_response" => "NotificationRulesListResponse", "v2.notification_rules_type" => "NotificationRulesType", + "v2.notification_rule_target" => "NotificationRuleTarget", + "v2.notification_rule_target_configuration" => "NotificationRuleTargetConfiguration", + "v2.notification_rule_target_configuration_recipient" => "NotificationRuleTargetConfigurationRecipient", + "v2.notification_rule_target_type" => "NotificationRuleTargetType", "v2.notion_api_key" => "NotionAPIKey", "v2.notion_api_key_type" => "NotionAPIKeyType", "v2.notion_api_key_update" => "NotionAPIKeyUpdate", diff --git a/lib/datadog_api_client/v2/models/create_feature_flag_attributes.rb b/lib/datadog_api_client/v2/models/create_feature_flag_attributes.rb index c0cade510c1d..fa3fe8fc1206 100644 --- a/lib/datadog_api_client/v2/models/create_feature_flag_attributes.rb +++ b/lib/datadog_api_client/v2/models/create_feature_flag_attributes.rb @@ -36,6 +36,21 @@ class CreateFeatureFlagAttributes # The name of the feature flag. attr_reader :name + # 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`. + attr_accessor :notification_rule_query + + # Targets to notify about changes to this feature flag that match `notification_rule_query`. + attr_accessor :rule_targets + # The type of values for the feature flag variants. attr_reader :value_type @@ -53,6 +68,8 @@ def self.attribute_map :'json_schema' => :'json_schema', :'key' => :'key', :'name' => :'name', + :'notification_rule_query' => :'notification_rule_query', + :'rule_targets' => :'rule_targets', :'value_type' => :'value_type', :'variants' => :'variants' } @@ -67,6 +84,8 @@ def self.openapi_types :'json_schema' => :'String', :'key' => :'String', :'name' => :'String', + :'notification_rule_query' => :'String', + :'rule_targets' => :'Array', :'value_type' => :'ValueType', :'variants' => :'Array' } @@ -78,6 +97,7 @@ def self.openapi_nullable Set.new([ :'default_variant_key', :'json_schema', + :'notification_rule_query', ]) end @@ -119,6 +139,16 @@ def initialize(attributes = {}) self.name = attributes[:'name'] end + if attributes.key?(:'notification_rule_query') + self.notification_rule_query = attributes[:'notification_rule_query'] + end + + if attributes.key?(:'rule_targets') + if (value = attributes[:'rule_targets']).is_a?(Array) + self.rule_targets = value + end + end + if attributes.key?(:'value_type') self.value_type = attributes[:'value_type'] end @@ -223,6 +253,8 @@ def ==(o) json_schema == o.json_schema && key == o.key && name == o.name && + notification_rule_query == o.notification_rule_query && + rule_targets == o.rule_targets && value_type == o.value_type && variants == o.variants && additional_properties == o.additional_properties @@ -232,7 +264,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [default_variant_key, description, json_schema, key, name, value_type, variants, additional_properties].hash + [default_variant_key, description, json_schema, key, name, notification_rule_query, rule_targets, value_type, variants, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/notification_rule_target.rb b/lib/datadog_api_client/v2/models/notification_rule_target.rb new file mode 100644 index 000000000000..24e147146bbc --- /dev/null +++ b/lib/datadog_api_client/v2/models/notification_rule_target.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A notification target that receives change alerts for a feature flag. + class NotificationRuleTarget + include BaseGenericModel + + # Configuration for a notification target. Which fields apply depends on the target's `type`. + attr_reader :configuration + + # The type of notification target. + attr_reader :type + + # Schema version of `configuration`. + attr_reader :version + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'configuration' => :'configuration', + :'type' => :'type', + :'version' => :'version' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'configuration' => :'NotificationRuleTargetConfiguration', + :'type' => :'NotificationRuleTargetType', + :'version' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::NotificationRuleTarget` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'configuration') + self.configuration = attributes[:'configuration'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'version') + self.version = attributes[:'version'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @configuration.nil? + return false if @type.nil? + return false if @version.nil? + true + end + + # Custom attribute writer method with validation + # @param configuration [Object] Object to be assigned + # @!visibility private + def configuration=(configuration) + if configuration.nil? + fail ArgumentError, 'invalid value for "configuration", configuration cannot be nil.' + end + @configuration = configuration + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Custom attribute writer method with validation + # @param version [Object] Object to be assigned + # @!visibility private + def version=(version) + if version.nil? + fail ArgumentError, 'invalid value for "version", version cannot be nil.' + end + @version = version + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + configuration == o.configuration && + type == o.type && + version == o.version && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [configuration, type, version, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/notification_rule_target_configuration.rb b/lib/datadog_api_client/v2/models/notification_rule_target_configuration.rb new file mode 100644 index 000000000000..9273b697e860 --- /dev/null +++ b/lib/datadog_api_client/v2/models/notification_rule_target_configuration.rb @@ -0,0 +1,236 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Configuration for a notification target. Which fields apply depends on the target's `type`. + class NotificationRuleTargetConfiguration + include BaseGenericModel + + # Slack channel name, for a `SLACK_CHANNEL` target. + attr_accessor :channel + + # Slack channel ID for a `SLACK_CHANNEL` target, or Microsoft Teams channel ID + # for an `MS_TEAMS_CHANNEL` target. + attr_accessor :channel_id + + # Microsoft Teams channel name, for an `MS_TEAMS_CHANNEL` target. + attr_accessor :channel_name + + # Microsoft Teams connector name, for an `MS_TEAMS_CHANNEL` target. + attr_accessor :connector_name + + # Recipient for an `EMAIL` target. + attr_accessor :recipient + + # PagerDuty service name, for a `PAGERDUTY_SERVICE` target. + attr_accessor :service_name + + # Microsoft Teams team ID, for an `MS_TEAMS_CHANNEL` target. + attr_accessor :team_id + + # Microsoft Teams team name, for an `MS_TEAMS_CHANNEL` target. + attr_accessor :team_name + + # Microsoft Teams tenant ID, for an `MS_TEAMS_CHANNEL` target. + attr_accessor :tenant_id + + # Microsoft Teams tenant name, for an `MS_TEAMS_CHANNEL` target. + attr_accessor :tenant_name + + # Slack username, for a `SLACK_USER` target. + attr_accessor :username + + # Name of the configured webhook, for a `WEBHOOK` target. + attr_accessor :webhook_name + + # Slack workspace name, for a `SLACK_CHANNEL` or `SLACK_USER` target. + attr_accessor :workspace + + # Slack workspace ID, for a `SLACK_CHANNEL` target. + attr_accessor :workspace_id + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.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' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'channel' => :'String', + :'channel_id' => :'String', + :'channel_name' => :'String', + :'connector_name' => :'String', + :'recipient' => :'NotificationRuleTargetConfigurationRecipient', + :'service_name' => :'String', + :'team_id' => :'String', + :'team_name' => :'String', + :'tenant_id' => :'String', + :'tenant_name' => :'String', + :'username' => :'String', + :'webhook_name' => :'String', + :'workspace' => :'String', + :'workspace_id' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::NotificationRuleTargetConfiguration` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'channel') + self.channel = attributes[:'channel'] + end + + if attributes.key?(:'channel_id') + self.channel_id = attributes[:'channel_id'] + end + + if attributes.key?(:'channel_name') + self.channel_name = attributes[:'channel_name'] + end + + if attributes.key?(:'connector_name') + self.connector_name = attributes[:'connector_name'] + end + + if attributes.key?(:'recipient') + self.recipient = attributes[:'recipient'] + end + + if attributes.key?(:'service_name') + self.service_name = attributes[:'service_name'] + end + + if attributes.key?(:'team_id') + self.team_id = attributes[:'team_id'] + end + + if attributes.key?(:'team_name') + self.team_name = attributes[:'team_name'] + end + + if attributes.key?(:'tenant_id') + self.tenant_id = attributes[:'tenant_id'] + end + + if attributes.key?(:'tenant_name') + self.tenant_name = attributes[:'tenant_name'] + end + + if attributes.key?(:'username') + self.username = attributes[:'username'] + end + + if attributes.key?(:'webhook_name') + self.webhook_name = attributes[:'webhook_name'] + end + + if attributes.key?(:'workspace') + self.workspace = attributes[:'workspace'] + end + + if attributes.key?(:'workspace_id') + self.workspace_id = attributes[:'workspace_id'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + channel == o.channel && + channel_id == o.channel_id && + channel_name == o.channel_name && + connector_name == o.connector_name && + recipient == o.recipient && + service_name == o.service_name && + team_id == o.team_id && + team_name == o.team_name && + tenant_id == o.tenant_id && + tenant_name == o.tenant_name && + username == o.username && + webhook_name == o.webhook_name && + workspace == o.workspace && + workspace_id == o.workspace_id && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [channel, channel_id, channel_name, connector_name, recipient, service_name, team_id, team_name, tenant_id, tenant_name, username, webhook_name, workspace, workspace_id, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/notification_rule_target_configuration_recipient.rb b/lib/datadog_api_client/v2/models/notification_rule_target_configuration_recipient.rb new file mode 100644 index 000000000000..e063509a5bf7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/notification_rule_target_configuration_recipient.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Recipient for an `EMAIL` target. + class NotificationRuleTargetConfigurationRecipient + include BaseGenericModel + + # Email address to notify. + attr_accessor :email + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'email' => :'email' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'email' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::NotificationRuleTargetConfigurationRecipient` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + email == o.email && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [email, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/notification_rule_target_type.rb b/lib/datadog_api_client/v2/models/notification_rule_target_type.rb new file mode 100644 index 000000000000..42cb40fd552d --- /dev/null +++ b/lib/datadog_api_client/v2/models/notification_rule_target_type.rb @@ -0,0 +1,31 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of notification target. + class NotificationRuleTargetType + include BaseEnumModel + + EMAIL = "EMAIL".freeze + SLACK_CHANNEL = "SLACK_CHANNEL".freeze + SLACK_USER = "SLACK_USER".freeze + WEBHOOK = "WEBHOOK".freeze + PAGERDUTY_SERVICE = "PAGERDUTY_SERVICE".freeze + MS_TEAMS_CHANNEL = "MS_TEAMS_CHANNEL".freeze + end +end