From 91b5446b312cdb61112cd0eba833e0e5a1400b9c Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 19 Aug 2026 13:16:28 +0000 Subject: [PATCH] Regenerate client from commit 2e9da5b of spec repo --- .generator/schemas/v2/openapi.yaml | 17 ++ ...eateMonitorNotificationRule_678042569.java | 47 ++++++ ...dateMonitorNotificationRule_752032728.java | 52 ++++++ .../MonitorNotificationRuleAttributes.java | 38 ++++- .../MonitorNotificationRuleBundleConfig.java | 149 ++++++++++++++++++ ...torNotificationRuleResponseAttributes.java | 45 +++++- ...h_bundle_config_returns_OK_response.freeze | 1 + ...ith_bundle_config_returns_OK_response.json | 57 +++++++ ...h_bundle_config_returns_OK_response.freeze | 1 + ...ith_bundle_config_returns_OK_response.json | 87 ++++++++++ .../api/client/v2/api/monitors.feature | 18 +++ 11 files changed, 508 insertions(+), 4 deletions(-) create mode 100644 examples/v2/monitors/CreateMonitorNotificationRule_678042569.java create mode 100644 examples/v2/monitors/UpdateMonitorNotificationRule_752032728.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/MonitorNotificationRuleBundleConfig.java create mode 100644 src/test/resources/cassettes/features/v2/Create_a_monitor_notification_rule_with_bundle_config_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Create_a_monitor_notification_rule_with_bundle_config_returns_OK_response.json create mode 100644 src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_with_bundle_config_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_with_bundle_config_returns_OK_response.json diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 2f39666f080..e473d161ae8 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -68104,6 +68104,8 @@ components: additionalProperties: false description: Attributes of the monitor notification rule. properties: + bundle_config: + $ref: "#/components/schemas/MonitorNotificationRuleBundleConfig" conditional_recipients: $ref: "#/components/schemas/MonitorNotificationRuleConditionalRecipients" filter: @@ -68114,6 +68116,19 @@ components: $ref: "#/components/schemas/MonitorNotificationRuleRecipients" required: [name] type: object + MonitorNotificationRuleBundleConfig: + description: |- + Use bundle config to enable alert bundling to reduce monitor signal noises. **Note**: This feature is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + properties: + duration: + description: Duration of the bundling period. + example: 3600 + format: int32 + maximum: 2147483647 + type: integer + required: [duration] + type: object MonitorNotificationRuleCondition: description: |- A conditional recipient rule composed of a `scope` (the matching condition) and @@ -68296,6 +68311,8 @@ components: additionalProperties: {} description: Attributes of the monitor notification rule. properties: + bundle_config: + $ref: "#/components/schemas/MonitorNotificationRuleBundleConfig" conditional_recipients: $ref: "#/components/schemas/MonitorNotificationRuleConditionalRecipients" created: diff --git a/examples/v2/monitors/CreateMonitorNotificationRule_678042569.java b/examples/v2/monitors/CreateMonitorNotificationRule_678042569.java new file mode 100644 index 00000000000..986e3bf4189 --- /dev/null +++ b/examples/v2/monitors/CreateMonitorNotificationRule_678042569.java @@ -0,0 +1,47 @@ +// Create a monitor notification rule with bundle config returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.MonitorsApi; +import com.datadog.api.client.v2.model.MonitorNotificationRuleAttributes; +import com.datadog.api.client.v2.model.MonitorNotificationRuleBundleConfig; +import com.datadog.api.client.v2.model.MonitorNotificationRuleCreateRequest; +import com.datadog.api.client.v2.model.MonitorNotificationRuleCreateRequestData; +import com.datadog.api.client.v2.model.MonitorNotificationRuleFilter; +import com.datadog.api.client.v2.model.MonitorNotificationRuleFilterTags; +import com.datadog.api.client.v2.model.MonitorNotificationRuleResourceType; +import com.datadog.api.client.v2.model.MonitorNotificationRuleResponse; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + MonitorsApi apiInstance = new MonitorsApi(defaultClient); + + MonitorNotificationRuleCreateRequest body = + new MonitorNotificationRuleCreateRequest() + .data( + new MonitorNotificationRuleCreateRequestData() + .attributes( + new MonitorNotificationRuleAttributes() + .filter( + new MonitorNotificationRuleFilter( + new MonitorNotificationRuleFilterTags() + .tags(Collections.singletonList("test:example-monitor")))) + .name("test rule") + .recipients(Collections.singletonList("slack-test-channel")) + .bundleConfig(new MonitorNotificationRuleBundleConfig().duration(3600))) + .type(MonitorNotificationRuleResourceType.MONITOR_NOTIFICATION_RULE)); + + try { + MonitorNotificationRuleResponse result = apiInstance.createMonitorNotificationRule(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MonitorsApi#createMonitorNotificationRule"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/monitors/UpdateMonitorNotificationRule_752032728.java b/examples/v2/monitors/UpdateMonitorNotificationRule_752032728.java new file mode 100644 index 00000000000..09bc62db5f8 --- /dev/null +++ b/examples/v2/monitors/UpdateMonitorNotificationRule_752032728.java @@ -0,0 +1,52 @@ +// Update a monitor notification rule with bundle config returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.MonitorsApi; +import com.datadog.api.client.v2.model.MonitorNotificationRuleAttributes; +import com.datadog.api.client.v2.model.MonitorNotificationRuleBundleConfig; +import com.datadog.api.client.v2.model.MonitorNotificationRuleFilter; +import com.datadog.api.client.v2.model.MonitorNotificationRuleFilterTags; +import com.datadog.api.client.v2.model.MonitorNotificationRuleResourceType; +import com.datadog.api.client.v2.model.MonitorNotificationRuleResponse; +import com.datadog.api.client.v2.model.MonitorNotificationRuleUpdateRequest; +import com.datadog.api.client.v2.model.MonitorNotificationRuleUpdateRequestData; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + MonitorsApi apiInstance = new MonitorsApi(defaultClient); + + // there is a valid "monitor_notification_rule" in the system + String MONITOR_NOTIFICATION_RULE_DATA_ID = System.getenv("MONITOR_NOTIFICATION_RULE_DATA_ID"); + + MonitorNotificationRuleUpdateRequest body = + new MonitorNotificationRuleUpdateRequest() + .data( + new MonitorNotificationRuleUpdateRequestData() + .attributes( + new MonitorNotificationRuleAttributes() + .filter( + new MonitorNotificationRuleFilter( + new MonitorNotificationRuleFilterTags() + .tags(Collections.singletonList("test:example-monitor")))) + .name("updated rule") + .recipients(Collections.singletonList("slack-test-channel")) + .bundleConfig(new MonitorNotificationRuleBundleConfig().duration(3600))) + .id(MONITOR_NOTIFICATION_RULE_DATA_ID) + .type(MonitorNotificationRuleResourceType.MONITOR_NOTIFICATION_RULE)); + + try { + MonitorNotificationRuleResponse result = + apiInstance.updateMonitorNotificationRule(MONITOR_NOTIFICATION_RULE_DATA_ID, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MonitorsApi#updateMonitorNotificationRule"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/MonitorNotificationRuleAttributes.java b/src/main/java/com/datadog/api/client/v2/model/MonitorNotificationRuleAttributes.java index 948463e5386..cafd40ebb1e 100644 --- a/src/main/java/com/datadog/api/client/v2/model/MonitorNotificationRuleAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/MonitorNotificationRuleAttributes.java @@ -17,6 +17,7 @@ /** Attributes of the monitor notification rule. */ @JsonPropertyOrder({ + MonitorNotificationRuleAttributes.JSON_PROPERTY_BUNDLE_CONFIG, MonitorNotificationRuleAttributes.JSON_PROPERTY_CONDITIONAL_RECIPIENTS, MonitorNotificationRuleAttributes.JSON_PROPERTY_FILTER, MonitorNotificationRuleAttributes.JSON_PROPERTY_NAME, @@ -26,6 +27,9 @@ value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") public class MonitorNotificationRuleAttributes { @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_BUNDLE_CONFIG = "bundle_config"; + private MonitorNotificationRuleBundleConfig bundleConfig; + public static final String JSON_PROPERTY_CONDITIONAL_RECIPIENTS = "conditional_recipients"; private MonitorNotificationRuleConditionalRecipients conditionalRecipients; @@ -46,6 +50,34 @@ public MonitorNotificationRuleAttributes( this.name = name; } + public MonitorNotificationRuleAttributes bundleConfig( + MonitorNotificationRuleBundleConfig bundleConfig) { + this.bundleConfig = bundleConfig; + this.unparsed |= bundleConfig.unparsed; + return this; + } + + /** + * Use bundle config to enable alert bundling to reduce monitor signal noises. + * Note: This feature is in preview and is subject to change. If you have any + * feedback, contact Datadog support. + * + * @return bundleConfig + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_BUNDLE_CONFIG) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public MonitorNotificationRuleBundleConfig getBundleConfig() { + return bundleConfig; + } + + public void setBundleConfig(MonitorNotificationRuleBundleConfig bundleConfig) { + this.bundleConfig = bundleConfig; + if (bundleConfig != null) { + this.unparsed |= bundleConfig.unparsed; + } + } + public MonitorNotificationRuleAttributes conditionalRecipients( MonitorNotificationRuleConditionalRecipients conditionalRecipients) { this.conditionalRecipients = conditionalRecipients; @@ -160,7 +192,8 @@ public boolean equals(Object o) { } MonitorNotificationRuleAttributes monitorNotificationRuleAttributes = (MonitorNotificationRuleAttributes) o; - return Objects.equals( + return Objects.equals(this.bundleConfig, monitorNotificationRuleAttributes.bundleConfig) + && Objects.equals( this.conditionalRecipients, monitorNotificationRuleAttributes.conditionalRecipients) && Objects.equals(this.filter, monitorNotificationRuleAttributes.filter) && Objects.equals(this.name, monitorNotificationRuleAttributes.name) @@ -169,13 +202,14 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(conditionalRecipients, filter, name, recipients); + return Objects.hash(bundleConfig, conditionalRecipients, filter, name, recipients); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class MonitorNotificationRuleAttributes {\n"); + sb.append(" bundleConfig: ").append(toIndentedString(bundleConfig)).append("\n"); sb.append(" conditionalRecipients: ") .append(toIndentedString(conditionalRecipients)) .append("\n"); diff --git a/src/main/java/com/datadog/api/client/v2/model/MonitorNotificationRuleBundleConfig.java b/src/main/java/com/datadog/api/client/v2/model/MonitorNotificationRuleBundleConfig.java new file mode 100644 index 00000000000..b85dd75b0bd --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MonitorNotificationRuleBundleConfig.java @@ -0,0 +1,149 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** + * Use bundle config to enable alert bundling to reduce monitor signal noises. + * Note: This feature is in preview and is subject to change. If you have any + * feedback, contact Datadog support. + */ +@JsonPropertyOrder({MonitorNotificationRuleBundleConfig.JSON_PROPERTY_DURATION}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MonitorNotificationRuleBundleConfig { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DURATION = "duration"; + private Integer duration; + + public MonitorNotificationRuleBundleConfig() {} + + @JsonCreator + public MonitorNotificationRuleBundleConfig( + @JsonProperty(required = true, value = JSON_PROPERTY_DURATION) Integer duration) { + this.duration = duration; + } + + public MonitorNotificationRuleBundleConfig duration(Integer duration) { + this.duration = duration; + return this; + } + + /** + * Duration of the bundling period. maximum: 2147483647 + * + * @return duration + */ + @JsonProperty(JSON_PROPERTY_DURATION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Integer getDuration() { + return duration; + } + + public void setDuration(Integer duration) { + this.duration = duration; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return MonitorNotificationRuleBundleConfig + */ + @JsonAnySetter + public MonitorNotificationRuleBundleConfig putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this MonitorNotificationRuleBundleConfig object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MonitorNotificationRuleBundleConfig monitorNotificationRuleBundleConfig = + (MonitorNotificationRuleBundleConfig) o; + return Objects.equals(this.duration, monitorNotificationRuleBundleConfig.duration) + && Objects.equals( + this.additionalProperties, monitorNotificationRuleBundleConfig.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(duration, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MonitorNotificationRuleBundleConfig {\n"); + sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/MonitorNotificationRuleResponseAttributes.java b/src/main/java/com/datadog/api/client/v2/model/MonitorNotificationRuleResponseAttributes.java index ba89ca7e41e..395dd51142e 100644 --- a/src/main/java/com/datadog/api/client/v2/model/MonitorNotificationRuleResponseAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/MonitorNotificationRuleResponseAttributes.java @@ -21,6 +21,7 @@ /** Attributes of the monitor notification rule. */ @JsonPropertyOrder({ + MonitorNotificationRuleResponseAttributes.JSON_PROPERTY_BUNDLE_CONFIG, MonitorNotificationRuleResponseAttributes.JSON_PROPERTY_CONDITIONAL_RECIPIENTS, MonitorNotificationRuleResponseAttributes.JSON_PROPERTY_CREATED, MonitorNotificationRuleResponseAttributes.JSON_PROPERTY_FILTER, @@ -32,6 +33,9 @@ value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") public class MonitorNotificationRuleResponseAttributes { @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_BUNDLE_CONFIG = "bundle_config"; + private MonitorNotificationRuleBundleConfig bundleConfig; + public static final String JSON_PROPERTY_CONDITIONAL_RECIPIENTS = "conditional_recipients"; private MonitorNotificationRuleConditionalRecipients conditionalRecipients; @@ -50,6 +54,34 @@ public class MonitorNotificationRuleResponseAttributes { public static final String JSON_PROPERTY_RECIPIENTS = "recipients"; private List recipients = null; + public MonitorNotificationRuleResponseAttributes bundleConfig( + MonitorNotificationRuleBundleConfig bundleConfig) { + this.bundleConfig = bundleConfig; + this.unparsed |= bundleConfig.unparsed; + return this; + } + + /** + * Use bundle config to enable alert bundling to reduce monitor signal noises. + * Note: This feature is in preview and is subject to change. If you have any + * feedback, contact Datadog support. + * + * @return bundleConfig + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_BUNDLE_CONFIG) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public MonitorNotificationRuleBundleConfig getBundleConfig() { + return bundleConfig; + } + + public void setBundleConfig(MonitorNotificationRuleBundleConfig bundleConfig) { + this.bundleConfig = bundleConfig; + if (bundleConfig != null) { + this.unparsed |= bundleConfig.unparsed; + } + } + public MonitorNotificationRuleResponseAttributes conditionalRecipients( MonitorNotificationRuleConditionalRecipients conditionalRecipients) { this.conditionalRecipients = conditionalRecipients; @@ -253,7 +285,8 @@ public boolean equals(Object o) { } MonitorNotificationRuleResponseAttributes monitorNotificationRuleResponseAttributes = (MonitorNotificationRuleResponseAttributes) o; - return Objects.equals( + return Objects.equals(this.bundleConfig, monitorNotificationRuleResponseAttributes.bundleConfig) + && Objects.equals( this.conditionalRecipients, monitorNotificationRuleResponseAttributes.conditionalRecipients) && Objects.equals(this.created, monitorNotificationRuleResponseAttributes.created) @@ -269,13 +302,21 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( - conditionalRecipients, created, filter, modified, name, recipients, additionalProperties); + bundleConfig, + conditionalRecipients, + created, + filter, + modified, + name, + recipients, + additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class MonitorNotificationRuleResponseAttributes {\n"); + sb.append(" bundleConfig: ").append(toIndentedString(bundleConfig)).append("\n"); sb.append(" conditionalRecipients: ") .append(toIndentedString(conditionalRecipients)) .append("\n"); diff --git a/src/test/resources/cassettes/features/v2/Create_a_monitor_notification_rule_with_bundle_config_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Create_a_monitor_notification_rule_with_bundle_config_returns_OK_response.freeze new file mode 100644 index 00000000000..4c576d08d4a --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_monitor_notification_rule_with_bundle_config_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-08-17T21:40:51.600Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_monitor_notification_rule_with_bundle_config_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Create_a_monitor_notification_rule_with_bundle_config_returns_OK_response.json new file mode 100644 index 00000000000..3b99dfaa9e8 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_monitor_notification_rule_with_bundle_config_returns_OK_response.json @@ -0,0 +1,57 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"bundle_config\":{\"duration\":3600},\"filter\":{\"tags\":[\"test:test-create_a_monitor_notification_rule_with_bundle_config_returns_ok_response-1787002851\"]},\"name\":\"test rule\",\"recipients\":[\"slack-test-channel\"]},\"type\":\"monitor-notification-rule\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/monitor/notification_rule", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"monitor-notification-rule\",\"id\":\"fc63c678-ecf4-4807-a3c9-317baea76bb1\",\"attributes\":{\"name\":\"test rule\",\"created_at\":\"2026-08-17T21:40:51.789668+00:00\",\"modified_at\":\"2026-08-17T21:40:51.806466+00:00\",\"filter\":{\"tags\":[\"test:test-create_a_monitor_notification_rule_with_bundle_config_returns_ok_response-1787002851\"]},\"recipients\":[\"slack-test-channel\"],\"bundle_config\":{\"duration\":3600}},\"relationships\":{\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}}}},\"included\":[{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"attributes\":{\"uuid\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"name\":\"frog\",\"handle\":\"frog@datadoghq.com\",\"created_at\":\"2019-10-02T08:15:39.795051+00:00\",\"modified_at\":\"2026-07-10T19:34:11.410571+00:00\",\"email\":\"frog@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro\",\"title\":null,\"verified\":true,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\",\"last_login_time\":\"2024-01-04T18:40:05+00:00\"}}]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "5f03171f-3f4c-0482-f92d-33f0b5435d06" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/monitor/notification_rule/fc63c678-ecf4-4807-a3c9-317baea76bb1", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "56812439-c75d-3c63-66b0-2405c812567f" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_with_bundle_config_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_with_bundle_config_returns_OK_response.freeze new file mode 100644 index 00000000000..6ba9cc1d7c0 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_with_bundle_config_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-08-17T21:41:19.954Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_with_bundle_config_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_with_bundle_config_returns_OK_response.json new file mode 100644 index 00000000000..9f6f644ddca --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_with_bundle_config_returns_OK_response.json @@ -0,0 +1,87 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"filter\":{\"tags\":[\"app:test-update_a_monitor_notification_rule_with_bundle_config_returns_ok_response-1787002879\"]},\"name\":\"test rule\",\"recipients\":[\"slack-monitor-app\"]},\"type\":\"monitor-notification-rule\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/monitor/notification_rule", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"monitor-notification-rule\",\"id\":\"649f51a4-76f5-4b0d-8ec3-90929a6570bc\",\"attributes\":{\"name\":\"test rule\",\"created_at\":\"2026-08-17T21:41:20.185857+00:00\",\"modified_at\":\"2026-08-17T21:41:20.209762+00:00\",\"filter\":{\"tags\":[\"app:test-update_a_monitor_notification_rule_with_bundle_config_returns_ok_response-1787002879\"]},\"recipients\":[\"slack-monitor-app\"]},\"relationships\":{\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}}}},\"included\":[{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"attributes\":{\"uuid\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"name\":\"frog\",\"handle\":\"frog@datadoghq.com\",\"created_at\":\"2019-10-02T08:15:39.795051+00:00\",\"modified_at\":\"2026-07-10T19:34:11.410571+00:00\",\"email\":\"frog@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro\",\"title\":null,\"verified\":true,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\",\"last_login_time\":\"2024-01-04T18:40:05+00:00\"}}]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "c7c5382d-e95a-c668-5876-7072263f9399" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"bundle_config\":{\"duration\":3600},\"filter\":{\"tags\":[\"test:test-update_a_monitor_notification_rule_with_bundle_config_returns_ok_response-1787002879\"]},\"name\":\"updated rule\",\"recipients\":[\"slack-test-channel\"]},\"id\":\"649f51a4-76f5-4b0d-8ec3-90929a6570bc\",\"type\":\"monitor-notification-rule\"}}" + }, + "headers": {}, + "method": "PATCH", + "path": "/api/v2/monitor/notification_rule/649f51a4-76f5-4b0d-8ec3-90929a6570bc", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"monitor-notification-rule\",\"id\":\"649f51a4-76f5-4b0d-8ec3-90929a6570bc\",\"attributes\":{\"name\":\"updated rule\",\"created_at\":\"2026-08-17T21:41:20.185857+00:00\",\"modified_at\":\"2026-08-17T21:41:22.287888+00:00\",\"filter\":{\"tags\":[\"test:test-update_a_monitor_notification_rule_with_bundle_config_returns_ok_response-1787002879\"]},\"recipients\":[\"slack-test-channel\"],\"bundle_config\":{\"duration\":3600}},\"relationships\":{\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}}}},\"included\":[{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"attributes\":{\"uuid\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"name\":\"frog\",\"handle\":\"frog@datadoghq.com\",\"created_at\":\"2019-10-02T08:15:39.795051+00:00\",\"modified_at\":\"2026-07-10T19:34:11.410571+00:00\",\"email\":\"frog@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro\",\"title\":null,\"verified\":true,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\",\"last_login_time\":\"2024-01-04T18:40:05+00:00\"}}]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "a80aac43-e978-5b3e-a79b-e322ff639dcb" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/monitor/notification_rule/649f51a4-76f5-4b0d-8ec3-90929a6570bc", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "45de10b9-7ab4-6978-073f-529a136af832" + } +] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v2/api/monitors.feature b/src/test/resources/com/datadog/api/client/v2/api/monitors.feature index b1bb50a8dbf..1e7e907c9f0 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/monitors.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/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 bundle config returns "OK" response + Given new "CreateMonitorNotificationRule" request + And body with value {"data": {"attributes": {"filter": {"tags": ["test:{{ unique_lower }}"]}, "name": "test rule", "recipients": ["slack-test-channel"], "bundle_config": {"duration": 3600}}, "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" + @team:DataDog/monitor-app Scenario: Create a monitor notification rule with conditional recipients returns "OK" response Given new "CreateMonitorNotificationRule" request @@ -273,6 +281,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 bundle config 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 }}"]}, "name": "updated rule", "recipients": ["slack-test-channel"], "bundle_config": {"duration": 3600}}, "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" + @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