diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 5051b689027c..e10b4b110109 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -29063,6 +29063,8 @@ components: additionalProperties: false description: Attributes of the monitor notification rule. properties: + conditional_recipients: + $ref: '#/components/schemas/MonitorNotificationRuleConditionalRecipients' filter: $ref: '#/components/schemas/MonitorNotificationRuleFilter' name: @@ -29071,8 +29073,36 @@ components: $ref: '#/components/schemas/MonitorNotificationRuleRecipients' required: - name + type: object + MonitorNotificationRuleCondition: + description: Conditions for `conditional_recipients`. + properties: + recipients: + $ref: '#/components/schemas/MonitorNotificationRuleRecipients' + scope: + $ref: '#/components/schemas/MonitorNotificationRuleScope' + required: + - scope - recipients type: object + MonitorNotificationRuleConditionalRecipients: + description: Use conditional recipients to define different recipients for different + situations. + properties: + conditions: + description: Conditions of the notification rule. + items: + $ref: '#/components/schemas/MonitorNotificationRuleCondition' + maxItems: 10 + minItems: 1 + type: array + fallback_recipients: + $ref: '#/components/schemas/MonitorNotificationRuleRecipients' + description: If none of the `conditions` applied, `fallback_recipients` + will get notified. + required: + - conditions + type: object MonitorNotificationRuleCreateRequest: description: Request for creating a monitor notification rule. properties: @@ -29212,6 +29242,8 @@ components: additionalProperties: {} description: Attributes of the monitor notification rule. properties: + conditional_recipients: + $ref: '#/components/schemas/MonitorNotificationRuleConditionalRecipients' created: description: Creation time of the monitor notification rule. example: 2020-01-02 03:04:00+00:00 @@ -29233,6 +29265,12 @@ components: description: An object related to a monitor notification rule. oneOf: - $ref: '#/components/schemas/User' + MonitorNotificationRuleScope: + description: The scope to which the monitor applied. + example: transition_type:alert + maxLength: 3000 + minLength: 1 + type: string MonitorNotificationRuleUpdateRequest: description: Request for updating a monitor notification rule. properties: diff --git a/cassettes/v2/Monitors_4022238206/Create-a-monitor-notification-rule-with-conditional-recipients-returns-OK-response_301236077/frozen.json b/cassettes/v2/Monitors_4022238206/Create-a-monitor-notification-rule-with-conditional-recipients-returns-OK-response_301236077/frozen.json new file mode 100644 index 000000000000..f9ef783a9591 --- /dev/null +++ b/cassettes/v2/Monitors_4022238206/Create-a-monitor-notification-rule-with-conditional-recipients-returns-OK-response_301236077/frozen.json @@ -0,0 +1 @@ +"2025-09-26T01:50:59.027Z" diff --git a/cassettes/v2/Monitors_4022238206/Create-a-monitor-notification-rule-with-conditional-recipients-returns-OK-response_301236077/recording.har b/cassettes/v2/Monitors_4022238206/Create-a-monitor-notification-rule-with-conditional-recipients-returns-OK-response_301236077/recording.har new file mode 100644 index 000000000000..dad6c046805a --- /dev/null +++ b/cassettes/v2/Monitors_4022238206/Create-a-monitor-notification-rule-with-conditional-recipients-returns-OK-response_301236077/recording.har @@ -0,0 +1,109 @@ +{ + "log": { + "_recordingName": "Monitors/Create a monitor notification rule with conditional recipients returns \"OK\" response", + "creator": { + "comment": "persister:fs", + "name": "Polly.JS", + "version": "6.0.6" + }, + "entries": [ + { + "_id": "5a406144918848ee794df49bba5436b3", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 332, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 589, + "httpVersion": "HTTP/1.1", + "method": "POST", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"data\":{\"attributes\":{\"conditional_recipients\":{\"conditions\":[{\"recipients\":[\"slack-test-channel\",\"jira-test\"],\"scope\":\"transition_type:is_alert\"}]},\"filter\":{\"tags\":[\"test:test-create_a_monitor_notification_rule_with_conditional_recipients_returns_ok_response-1758851459\"]},\"name\":\"test rule\"},\"type\":\"monitor-notification-rule\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/monitor/notification_rule" + }, + "response": { + "bodySize": 1076, + "content": { + "mimeType": "application/json", + "size": 1076, + "text": "{\"data\":{\"type\":\"monitor-notification-rule\",\"attributes\":{\"name\":\"test rule\",\"filter\":{\"tags\":[\"test:test-create_a_monitor_notification_rule_with_conditional_recipients_returns_ok_response-1758851459\"]},\"created_at\":\"2025-09-26T01:51:00.132009+00:00\",\"conditional_recipients\":{\"conditions\":[{\"recipients\":[\"slack-test-channel\",\"jira-test\"],\"scope\":\"transition_type:is_alert\"}]},\"modified_at\":\"1970-01-01T00:00:00+00:00\"},\"id\":\"707b82d7-6898-4b20-a577-64f76881fe89\",\"relationships\":{\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"}}}},\"included\":[{\"type\":\"users\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"attributes\":{\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"created_at\":\"2020-12-29T22:58:44.733921+00:00\",\"modified_at\":\"2021-04-27T13:54:01.547888+00:00\",\"email\":\"team-intg-tools-libs-spam@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/b7c189b5b4c2c429d7c1e0bc3749330e?s=48&d=retro\",\"title\":null,\"verified\":true,\"service_account\":true,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\"}}]}\n" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 704, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 200, + "statusText": "OK" + }, + "startedDateTime": "2025-09-26T01:50:59.742Z", + "time": 469 + }, + { + "_id": "c37cabe35cdb94a5aeb80ee7e61c7102", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 0, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "*/*" + } + ], + "headersSize": 562, + "httpVersion": "HTTP/1.1", + "method": "DELETE", + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/monitor/notification_rule/707b82d7-6898-4b20-a577-64f76881fe89" + }, + "response": { + "bodySize": 0, + "content": { + "mimeType": "text/html; charset=utf-8", + "size": 0 + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "text/html; charset=utf-8" + } + ], + "headersSize": 690, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 204, + "statusText": "No Content" + }, + "startedDateTime": "2025-09-26T01:51:00.284Z", + "time": 211 + } + ], + "pages": [], + "version": "1.2" + } +} diff --git a/cassettes/v2/Monitors_4022238206/Update-a-monitor-notification-rule-with-conditional_recipients-returns-OK-response_1914286097/frozen.json b/cassettes/v2/Monitors_4022238206/Update-a-monitor-notification-rule-with-conditional_recipients-returns-OK-response_1914286097/frozen.json new file mode 100644 index 000000000000..13593619c6ef --- /dev/null +++ b/cassettes/v2/Monitors_4022238206/Update-a-monitor-notification-rule-with-conditional_recipients-returns-OK-response_1914286097/frozen.json @@ -0,0 +1 @@ +"2025-09-26T01:51:00.504Z" diff --git a/cassettes/v2/Monitors_4022238206/Update-a-monitor-notification-rule-with-conditional_recipients-returns-OK-response_1914286097/recording.har b/cassettes/v2/Monitors_4022238206/Update-a-monitor-notification-rule-with-conditional_recipients-returns-OK-response_1914286097/recording.har new file mode 100644 index 000000000000..18ce0ca8a222 --- /dev/null +++ b/cassettes/v2/Monitors_4022238206/Update-a-monitor-notification-rule-with-conditional_recipients-returns-OK-response_1914286097/recording.har @@ -0,0 +1,162 @@ +{ + "log": { + "_recordingName": "Monitors/Update a monitor notification rule with conditional_recipients returns \"OK\" response", + "creator": { + "comment": "persister:fs", + "name": "Polly.JS", + "version": "6.0.6" + }, + "entries": [ + { + "_id": "f74113be194d90918399ff38a8c798db", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 239, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 589, + "httpVersion": "HTTP/1.1", + "method": "POST", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"data\":{\"attributes\":{\"filter\":{\"tags\":[\"app:test-update_a_monitor_notification_rule_with_conditional_recipients_returns_ok_response-1758851460\"]},\"name\":\"test rule\",\"recipients\":[\"slack-monitor-app\"]},\"type\":\"monitor-notification-rule\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/monitor/notification_rule" + }, + "response": { + "bodySize": 983, + "content": { + "mimeType": "application/json", + "size": 983, + "text": "{\"data\":{\"type\":\"monitor-notification-rule\",\"attributes\":{\"filter\":{\"tags\":[\"app:test-update_a_monitor_notification_rule_with_conditional_recipients_returns_ok_response-1758851460\"]},\"created_at\":\"2025-09-26T01:51:00.665373+00:00\",\"name\":\"test rule\",\"recipients\":[\"slack-monitor-app\"],\"modified_at\":\"1970-01-01T00:00:00+00:00\"},\"id\":\"954d2f74-ec41-4f7b-9f63-7146075f3537\",\"relationships\":{\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"}}}},\"included\":[{\"type\":\"users\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"attributes\":{\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"created_at\":\"2020-12-29T22:58:44.733921+00:00\",\"modified_at\":\"2021-04-27T13:54:01.547888+00:00\",\"email\":\"team-intg-tools-libs-spam@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/b7c189b5b4c2c429d7c1e0bc3749330e?s=48&d=retro\",\"title\":null,\"verified\":true,\"service_account\":true,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\"}}]}\n" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 703, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 200, + "statusText": "OK" + }, + "startedDateTime": "2025-09-26T01:51:00.507Z", + "time": 206 + }, + { + "_id": "56466a6f999a45f8ef1d7f802ab0c507", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 390, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 627, + "httpVersion": "HTTP/1.1", + "method": "PATCH", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"data\":{\"attributes\":{\"conditional_recipients\":{\"conditions\":[{\"recipients\":[\"slack-test-channel\",\"jira-test\"],\"scope\":\"transition_type:is_alert\"}]},\"filter\":{\"tags\":[\"test:test-update_a_monitor_notification_rule_with_conditional_recipients_returns_ok_response-1758851460\",\"host:abc\"]},\"name\":\"updated rule\"},\"id\":\"954d2f74-ec41-4f7b-9f63-7146075f3537\",\"type\":\"monitor-notification-rule\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/monitor/notification_rule/954d2f74-ec41-4f7b-9f63-7146075f3537" + }, + "response": { + "bodySize": 1097, + "content": { + "mimeType": "application/json", + "size": 1097, + "text": "{\"data\":{\"type\":\"monitor-notification-rule\",\"id\":\"954d2f74-ec41-4f7b-9f63-7146075f3537\",\"attributes\":{\"filter\":{\"tags\":[\"test:test-update_a_monitor_notification_rule_with_conditional_recipients_returns_ok_response-1758851460\",\"host:abc\"]},\"modified_at\":\"2025-09-26T01:51:00.876883+00:00\",\"conditional_recipients\":{\"conditions\":[{\"scope\":\"transition_type:is_alert\",\"recipients\":[\"slack-test-channel\",\"jira-test\"]}]},\"name\":\"updated rule\",\"created_at\":\"2025-09-26T01:51:00.665373+00:00\"},\"relationships\":{\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"}}}},\"included\":[{\"type\":\"users\",\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"attributes\":{\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"created_at\":\"2020-12-29T22:58:44.733921+00:00\",\"modified_at\":\"2021-04-27T13:54:01.547888+00:00\",\"email\":\"team-intg-tools-libs-spam@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/b7c189b5b4c2c429d7c1e0bc3749330e?s=48&d=retro\",\"title\":null,\"verified\":true,\"service_account\":true,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\"}}]}\n" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 704, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 200, + "statusText": "OK" + }, + "startedDateTime": "2025-09-26T01:51:00.719Z", + "time": 200 + }, + { + "_id": "47601895ff82dd9a14b52f5a0ddc63bd", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 0, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "*/*" + } + ], + "headersSize": 562, + "httpVersion": "HTTP/1.1", + "method": "DELETE", + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/monitor/notification_rule/954d2f74-ec41-4f7b-9f63-7146075f3537" + }, + "response": { + "bodySize": 0, + "content": { + "mimeType": "text/html; charset=utf-8", + "size": 0 + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "text/html; charset=utf-8" + } + ], + "headersSize": 690, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 204, + "statusText": "No Content" + }, + "startedDateTime": "2025-09-26T01:51:00.924Z", + "time": 265 + } + ], + "pages": [], + "version": "1.2" + } +} diff --git a/examples/v2/monitors/CreateMonitorNotificationRule_1181818787.ts b/examples/v2/monitors/CreateMonitorNotificationRule_1181818787.ts new file mode 100644 index 000000000000..d41f09e58b7c --- /dev/null +++ b/examples/v2/monitors/CreateMonitorNotificationRule_1181818787.ts @@ -0,0 +1,39 @@ +/** + * Create a monitor notification rule with conditional recipients returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.MonitorsApi(configuration); + +const params: v2.MonitorsApiCreateMonitorNotificationRuleRequest = { + body: { + data: { + attributes: { + filter: { + tags: ["test:example-monitor"], + }, + name: "test rule", + conditionalRecipients: { + conditions: [ + { + scope: "transition_type:is_alert", + recipients: ["slack-test-channel", "jira-test"], + }, + ], + }, + }, + type: "monitor-notification-rule", + }, + }, +}; + +apiInstance + .createMonitorNotificationRule(params) + .then((data: v2.MonitorNotificationRuleResponse) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/monitors/UpdateMonitorNotificationRule_1400905713.ts b/examples/v2/monitors/UpdateMonitorNotificationRule_1400905713.ts new file mode 100644 index 000000000000..efe96ed737ef --- /dev/null +++ b/examples/v2/monitors/UpdateMonitorNotificationRule_1400905713.ts @@ -0,0 +1,45 @@ +/** + * Update a monitor notification rule with conditional_recipients returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.MonitorsApi(configuration); + +// there is a valid "monitor_notification_rule" in the system +const MONITOR_NOTIFICATION_RULE_DATA_ID = process.env + .MONITOR_NOTIFICATION_RULE_DATA_ID as string; + +const params: v2.MonitorsApiUpdateMonitorNotificationRuleRequest = { + body: { + data: { + attributes: { + filter: { + tags: ["test:example-monitor", "host:abc"], + }, + name: "updated rule", + conditionalRecipients: { + conditions: [ + { + scope: "transition_type:is_alert", + recipients: ["slack-test-channel", "jira-test"], + }, + ], + }, + }, + id: MONITOR_NOTIFICATION_RULE_DATA_ID, + type: "monitor-notification-rule", + }, + }, + ruleId: MONITOR_NOTIFICATION_RULE_DATA_ID, +}; + +apiInstance + .updateMonitorNotificationRule(params) + .then((data: v2.MonitorNotificationRuleResponse) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/features/v2/monitors.feature b/features/v2/monitors.feature index d49f00dd0487..3fd3138f9f57 100644 --- a/features/v2/monitors.feature +++ b/features/v2/monitors.feature @@ -44,6 +44,14 @@ Feature: Monitors Then the response status is 200 OK And the response "data.attributes.name" is equal to "test rule" + @team:DataDog/monitor-app + Scenario: Create a monitor notification rule with conditional recipients returns "OK" response + Given new "CreateMonitorNotificationRule" request + And body with value {"data": {"attributes": {"filter": {"tags": ["test:{{ unique_lower }}"]}, "name": "test rule", "conditional_recipients": {"conditions": [{"scope": "transition_type:is_alert", "recipients": ["slack-test-channel", "jira-test"]}]}}, "type": "monitor-notification-rule"}} + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.name" is equal to "test rule" + @skip-validation @team:DataDog/monitor-app Scenario: Create a monitor user template returns "Bad Request" response Given new "CreateMonitorUserTemplate" request @@ -255,6 +263,16 @@ Feature: Monitors Then the response status is 200 OK And the response "data.attributes.name" is equal to "updated rule" + @team:DataDog/monitor-app + Scenario: Update a monitor notification rule with conditional_recipients returns "OK" response + Given there is a valid "monitor_notification_rule" in the system + And new "UpdateMonitorNotificationRule" request + And request contains "rule_id" parameter from "monitor_notification_rule.data.id" + And body with value {"data": {"attributes": {"filter": {"tags": ["test:{{ unique_lower }}", "host:abc"]}, "name": "updated rule", "conditional_recipients": {"conditions": [{"scope": "transition_type:is_alert", "recipients": ["slack-test-channel", "jira-test"]}]}}, "id": "{{ monitor_notification_rule.data.id }}", "type": "monitor-notification-rule"}} + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.name" is equal to "updated rule" + @skip-validation @team:DataDog/monitor-app Scenario: Update a monitor user template to a new version returns "Bad Request" response Given there is a valid "monitor_user_template" in the system diff --git a/packages/datadog-api-client-v2/index.ts b/packages/datadog-api-client-v2/index.ts index cf815abeafc9..a00501b9d4f3 100644 --- a/packages/datadog-api-client-v2/index.ts +++ b/packages/datadog-api-client-v2/index.ts @@ -2618,6 +2618,8 @@ export { MonitorDowntimeMatchResponse } from "./models/MonitorDowntimeMatchRespo export { MonitorDowntimeMatchResponseAttributes } from "./models/MonitorDowntimeMatchResponseAttributes"; export { MonitorDowntimeMatchResponseData } from "./models/MonitorDowntimeMatchResponseData"; export { MonitorNotificationRuleAttributes } from "./models/MonitorNotificationRuleAttributes"; +export { MonitorNotificationRuleCondition } from "./models/MonitorNotificationRuleCondition"; +export { MonitorNotificationRuleConditionalRecipients } from "./models/MonitorNotificationRuleConditionalRecipients"; export { MonitorNotificationRuleCreateRequest } from "./models/MonitorNotificationRuleCreateRequest"; export { MonitorNotificationRuleCreateRequestData } from "./models/MonitorNotificationRuleCreateRequestData"; export { MonitorNotificationRuleData } from "./models/MonitorNotificationRuleData"; diff --git a/packages/datadog-api-client-v2/models/MonitorNotificationRuleAttributes.ts b/packages/datadog-api-client-v2/models/MonitorNotificationRuleAttributes.ts index 11aedfb84d91..1de59dbbf047 100644 --- a/packages/datadog-api-client-v2/models/MonitorNotificationRuleAttributes.ts +++ b/packages/datadog-api-client-v2/models/MonitorNotificationRuleAttributes.ts @@ -3,6 +3,7 @@ * This product includes software developed at Datadog (https://www.datadoghq.com/). * Copyright 2020-Present Datadog, Inc. */ +import { MonitorNotificationRuleConditionalRecipients } from "./MonitorNotificationRuleConditionalRecipients"; import { MonitorNotificationRuleFilter } from "./MonitorNotificationRuleFilter"; import { AttributeTypeMap } from "../../datadog-api-client-common/util"; @@ -11,6 +12,10 @@ import { AttributeTypeMap } from "../../datadog-api-client-common/util"; * Attributes of the monitor notification rule. */ export class MonitorNotificationRuleAttributes { + /** + * Use conditional recipients to define different recipients for different situations. + */ + "conditionalRecipients"?: MonitorNotificationRuleConditionalRecipients; /** * Filter used to associate the notification rule with monitors. */ @@ -22,7 +27,7 @@ export class MonitorNotificationRuleAttributes { /** * A list of recipients to notify. Uses the same format as the monitor `message` field. Must not start with an '@'. */ - "recipients": Array; + "recipients"?: Array; /** * @ignore @@ -33,6 +38,10 @@ export class MonitorNotificationRuleAttributes { * @ignore */ static readonly attributeTypeMap: AttributeTypeMap = { + conditionalRecipients: { + baseName: "conditional_recipients", + type: "MonitorNotificationRuleConditionalRecipients", + }, filter: { baseName: "filter", type: "MonitorNotificationRuleFilter", @@ -45,7 +54,6 @@ export class MonitorNotificationRuleAttributes { recipients: { baseName: "recipients", type: "Array", - required: true, }, }; diff --git a/packages/datadog-api-client-v2/models/MonitorNotificationRuleCondition.ts b/packages/datadog-api-client-v2/models/MonitorNotificationRuleCondition.ts new file mode 100644 index 000000000000..5e538b9e9770 --- /dev/null +++ b/packages/datadog-api-client-v2/models/MonitorNotificationRuleCondition.ts @@ -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 2020-Present Datadog, Inc. + */ + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Conditions for `conditional_recipients`. + */ +export class MonitorNotificationRuleCondition { + /** + * A list of recipients to notify. Uses the same format as the monitor `message` field. Must not start with an '@'. + */ + "recipients": Array; + /** + * The scope to which the monitor applied. + */ + "scope": string; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + recipients: { + baseName: "recipients", + type: "Array", + required: true, + }, + scope: { + baseName: "scope", + type: "string", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return MonitorNotificationRuleCondition.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/MonitorNotificationRuleConditionalRecipients.ts b/packages/datadog-api-client-v2/models/MonitorNotificationRuleConditionalRecipients.ts new file mode 100644 index 000000000000..8f83dbfc44da --- /dev/null +++ b/packages/datadog-api-client-v2/models/MonitorNotificationRuleConditionalRecipients.ts @@ -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 2020-Present Datadog, Inc. + */ +import { MonitorNotificationRuleCondition } from "./MonitorNotificationRuleCondition"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Use conditional recipients to define different recipients for different situations. + */ +export class MonitorNotificationRuleConditionalRecipients { + /** + * Conditions of the notification rule. + */ + "conditions": Array; + /** + * A list of recipients to notify. Uses the same format as the monitor `message` field. Must not start with an '@'. + */ + "fallbackRecipients"?: Array; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + conditions: { + baseName: "conditions", + type: "Array", + required: true, + }, + fallbackRecipients: { + baseName: "fallback_recipients", + type: "Array", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return MonitorNotificationRuleConditionalRecipients.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/MonitorNotificationRuleResponseAttributes.ts b/packages/datadog-api-client-v2/models/MonitorNotificationRuleResponseAttributes.ts index a996c2fc03ee..f9b2a1b429a1 100644 --- a/packages/datadog-api-client-v2/models/MonitorNotificationRuleResponseAttributes.ts +++ b/packages/datadog-api-client-v2/models/MonitorNotificationRuleResponseAttributes.ts @@ -3,6 +3,7 @@ * This product includes software developed at Datadog (https://www.datadoghq.com/). * Copyright 2020-Present Datadog, Inc. */ +import { MonitorNotificationRuleConditionalRecipients } from "./MonitorNotificationRuleConditionalRecipients"; import { MonitorNotificationRuleFilter } from "./MonitorNotificationRuleFilter"; import { AttributeTypeMap } from "../../datadog-api-client-common/util"; @@ -11,6 +12,10 @@ import { AttributeTypeMap } from "../../datadog-api-client-common/util"; * Attributes of the monitor notification rule. */ export class MonitorNotificationRuleResponseAttributes { + /** + * Use conditional recipients to define different recipients for different situations. + */ + "conditionalRecipients"?: MonitorNotificationRuleConditionalRecipients; /** * Creation time of the monitor notification rule. */ @@ -48,6 +53,10 @@ export class MonitorNotificationRuleResponseAttributes { * @ignore */ static readonly attributeTypeMap: AttributeTypeMap = { + conditionalRecipients: { + baseName: "conditional_recipients", + type: "MonitorNotificationRuleConditionalRecipients", + }, created: { baseName: "created", type: "Date", diff --git a/packages/datadog-api-client-v2/models/ObjectSerializer.ts b/packages/datadog-api-client-v2/models/ObjectSerializer.ts index e6a204c0643c..082cd84cf723 100644 --- a/packages/datadog-api-client-v2/models/ObjectSerializer.ts +++ b/packages/datadog-api-client-v2/models/ObjectSerializer.ts @@ -1342,6 +1342,8 @@ import { MonitorDowntimeMatchResponse } from "./MonitorDowntimeMatchResponse"; import { MonitorDowntimeMatchResponseAttributes } from "./MonitorDowntimeMatchResponseAttributes"; import { MonitorDowntimeMatchResponseData } from "./MonitorDowntimeMatchResponseData"; import { MonitorNotificationRuleAttributes } from "./MonitorNotificationRuleAttributes"; +import { MonitorNotificationRuleCondition } from "./MonitorNotificationRuleCondition"; +import { MonitorNotificationRuleConditionalRecipients } from "./MonitorNotificationRuleConditionalRecipients"; import { MonitorNotificationRuleCreateRequest } from "./MonitorNotificationRuleCreateRequest"; import { MonitorNotificationRuleCreateRequestData } from "./MonitorNotificationRuleCreateRequestData"; import { MonitorNotificationRuleData } from "./MonitorNotificationRuleData"; @@ -5419,6 +5421,9 @@ const typeMap: { [index: string]: any } = { MonitorDowntimeMatchResponseAttributes, MonitorDowntimeMatchResponseData: MonitorDowntimeMatchResponseData, MonitorNotificationRuleAttributes: MonitorNotificationRuleAttributes, + MonitorNotificationRuleCondition: MonitorNotificationRuleCondition, + MonitorNotificationRuleConditionalRecipients: + MonitorNotificationRuleConditionalRecipients, MonitorNotificationRuleCreateRequest: MonitorNotificationRuleCreateRequest, MonitorNotificationRuleCreateRequestData: MonitorNotificationRuleCreateRequestData,