diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index e563704d254..9214f1923f8 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -83298,6 +83298,8 @@ components: $ref: "#/components/schemas/MonitorNotificationRuleName" recipients: $ref: "#/components/schemas/MonitorNotificationRuleRecipients" + rule_options: + $ref: "#/components/schemas/MonitorNotificationRuleOptions" required: [name] type: object MonitorNotificationRuleBundleConfig: @@ -83438,6 +83440,17 @@ components: maxLength: 1000 minLength: 1 type: string + MonitorNotificationRuleOptions: + description: Additional options for the monitor notification rule. + properties: + is_threaded: + description: |- + Whether notifications from this rule are threaded. When `true`, follow-up notifications for the same monitor alert are posted in Slack as replies to the first notification. + Cannot be `true` when `bundle_config` is set. + example: true + type: boolean + required: [is_threaded] + type: object MonitorNotificationRuleRecipients: description: |- A list of recipients to notify. Uses the same format as the monitor `message` field. Must not start with an '@'. Cannot be used with `conditional_recipients`. @@ -83515,6 +83528,8 @@ components: $ref: "#/components/schemas/MonitorNotificationRuleName" recipients: $ref: "#/components/schemas/MonitorNotificationRuleRecipients" + rule_options: + $ref: "#/components/schemas/MonitorNotificationRuleOptions" type: object MonitorNotificationRuleResponseIncludedItem: description: An object related to a monitor notification rule. diff --git a/examples/v2/monitors/CreateMonitorNotificationRule_292428701.java b/examples/v2/monitors/CreateMonitorNotificationRule_292428701.java new file mode 100644 index 00000000000..f5569078595 --- /dev/null +++ b/examples/v2/monitors/CreateMonitorNotificationRule_292428701.java @@ -0,0 +1,48 @@ +// Create a monitor notification rule with rule options 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.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.MonitorNotificationRuleOptions; +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(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + 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")) + .ruleOptions(new MonitorNotificationRuleOptions().isThreaded(true))) + .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_365435820.java b/examples/v2/monitors/UpdateMonitorNotificationRule_365435820.java new file mode 100644 index 00000000000..e2dbd42acb5 --- /dev/null +++ b/examples/v2/monitors/UpdateMonitorNotificationRule_365435820.java @@ -0,0 +1,53 @@ +// Update a monitor notification rule with rule options 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.MonitorNotificationRuleFilter; +import com.datadog.api.client.v2.model.MonitorNotificationRuleFilterTags; +import com.datadog.api.client.v2.model.MonitorNotificationRuleOptions; +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(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + 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")) + .ruleOptions(new MonitorNotificationRuleOptions().isThreaded(false))) + .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 cafd40ebb1e..7072b15e482 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 @@ -21,7 +21,8 @@ MonitorNotificationRuleAttributes.JSON_PROPERTY_CONDITIONAL_RECIPIENTS, MonitorNotificationRuleAttributes.JSON_PROPERTY_FILTER, MonitorNotificationRuleAttributes.JSON_PROPERTY_NAME, - MonitorNotificationRuleAttributes.JSON_PROPERTY_RECIPIENTS + MonitorNotificationRuleAttributes.JSON_PROPERTY_RECIPIENTS, + MonitorNotificationRuleAttributes.JSON_PROPERTY_RULE_OPTIONS }) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") @@ -42,6 +43,9 @@ public class MonitorNotificationRuleAttributes { public static final String JSON_PROPERTY_RECIPIENTS = "recipients"; private List recipients = null; + public static final String JSON_PROPERTY_RULE_OPTIONS = "rule_options"; + private MonitorNotificationRuleOptions ruleOptions; + public MonitorNotificationRuleAttributes() {} @JsonCreator @@ -181,6 +185,31 @@ public void setRecipients(List recipients) { this.recipients = recipients; } + public MonitorNotificationRuleAttributes ruleOptions(MonitorNotificationRuleOptions ruleOptions) { + this.ruleOptions = ruleOptions; + this.unparsed |= ruleOptions.unparsed; + return this; + } + + /** + * Additional options for the monitor notification rule. + * + * @return ruleOptions + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RULE_OPTIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public MonitorNotificationRuleOptions getRuleOptions() { + return ruleOptions; + } + + public void setRuleOptions(MonitorNotificationRuleOptions ruleOptions) { + this.ruleOptions = ruleOptions; + if (ruleOptions != null) { + this.unparsed |= ruleOptions.unparsed; + } + } + /** Return true if this MonitorNotificationRuleAttributes object is equal to o. */ @Override public boolean equals(Object o) { @@ -197,12 +226,13 @@ public boolean equals(Object o) { this.conditionalRecipients, monitorNotificationRuleAttributes.conditionalRecipients) && Objects.equals(this.filter, monitorNotificationRuleAttributes.filter) && Objects.equals(this.name, monitorNotificationRuleAttributes.name) - && Objects.equals(this.recipients, monitorNotificationRuleAttributes.recipients); + && Objects.equals(this.recipients, monitorNotificationRuleAttributes.recipients) + && Objects.equals(this.ruleOptions, monitorNotificationRuleAttributes.ruleOptions); } @Override public int hashCode() { - return Objects.hash(bundleConfig, conditionalRecipients, filter, name, recipients); + return Objects.hash(bundleConfig, conditionalRecipients, filter, name, recipients, ruleOptions); } @Override @@ -216,6 +246,7 @@ public String toString() { sb.append(" filter: ").append(toIndentedString(filter)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" recipients: ").append(toIndentedString(recipients)).append("\n"); + sb.append(" ruleOptions: ").append(toIndentedString(ruleOptions)).append("\n"); sb.append('}'); return sb.toString(); } diff --git a/src/main/java/com/datadog/api/client/v2/model/MonitorNotificationRuleOptions.java b/src/main/java/com/datadog/api/client/v2/model/MonitorNotificationRuleOptions.java new file mode 100644 index 00000000000..dccec088fc2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MonitorNotificationRuleOptions.java @@ -0,0 +1,147 @@ +/* + * 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; + +/** Additional options for the monitor notification rule. */ +@JsonPropertyOrder({MonitorNotificationRuleOptions.JSON_PROPERTY_IS_THREADED}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MonitorNotificationRuleOptions { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_IS_THREADED = "is_threaded"; + private Boolean isThreaded; + + public MonitorNotificationRuleOptions() {} + + @JsonCreator + public MonitorNotificationRuleOptions( + @JsonProperty(required = true, value = JSON_PROPERTY_IS_THREADED) Boolean isThreaded) { + this.isThreaded = isThreaded; + } + + public MonitorNotificationRuleOptions isThreaded(Boolean isThreaded) { + this.isThreaded = isThreaded; + return this; + } + + /** + * Whether notifications from this rule are threaded. When true, follow-up + * notifications for the same monitor alert are posted in Slack as replies to the first + * notification. Cannot be true when bundle_config is set. + * + * @return isThreaded + */ + @JsonProperty(JSON_PROPERTY_IS_THREADED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getIsThreaded() { + return isThreaded; + } + + public void setIsThreaded(Boolean isThreaded) { + this.isThreaded = isThreaded; + } + + /** + * 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 MonitorNotificationRuleOptions + */ + @JsonAnySetter + public MonitorNotificationRuleOptions 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 MonitorNotificationRuleOptions object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MonitorNotificationRuleOptions monitorNotificationRuleOptions = + (MonitorNotificationRuleOptions) o; + return Objects.equals(this.isThreaded, monitorNotificationRuleOptions.isThreaded) + && Objects.equals( + this.additionalProperties, monitorNotificationRuleOptions.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(isThreaded, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MonitorNotificationRuleOptions {\n"); + sb.append(" isThreaded: ").append(toIndentedString(isThreaded)).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 395dd51142e..a7964c77754 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 @@ -27,7 +27,8 @@ MonitorNotificationRuleResponseAttributes.JSON_PROPERTY_FILTER, MonitorNotificationRuleResponseAttributes.JSON_PROPERTY_MODIFIED, MonitorNotificationRuleResponseAttributes.JSON_PROPERTY_NAME, - MonitorNotificationRuleResponseAttributes.JSON_PROPERTY_RECIPIENTS + MonitorNotificationRuleResponseAttributes.JSON_PROPERTY_RECIPIENTS, + MonitorNotificationRuleResponseAttributes.JSON_PROPERTY_RULE_OPTIONS }) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") @@ -54,6 +55,9 @@ public class MonitorNotificationRuleResponseAttributes { public static final String JSON_PROPERTY_RECIPIENTS = "recipients"; private List recipients = null; + public static final String JSON_PROPERTY_RULE_OPTIONS = "rule_options"; + private MonitorNotificationRuleOptions ruleOptions; + public MonitorNotificationRuleResponseAttributes bundleConfig( MonitorNotificationRuleBundleConfig bundleConfig) { this.bundleConfig = bundleConfig; @@ -228,6 +232,32 @@ public void setRecipients(List recipients) { this.recipients = recipients; } + public MonitorNotificationRuleResponseAttributes ruleOptions( + MonitorNotificationRuleOptions ruleOptions) { + this.ruleOptions = ruleOptions; + this.unparsed |= ruleOptions.unparsed; + return this; + } + + /** + * Additional options for the monitor notification rule. + * + * @return ruleOptions + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RULE_OPTIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public MonitorNotificationRuleOptions getRuleOptions() { + return ruleOptions; + } + + public void setRuleOptions(MonitorNotificationRuleOptions ruleOptions) { + this.ruleOptions = ruleOptions; + if (ruleOptions != null) { + this.unparsed |= ruleOptions.unparsed; + } + } + /** * A container for additional, undeclared properties. This is a holder for any undeclared * properties as specified with the 'additionalProperties' keyword in the OAS document. @@ -294,6 +324,7 @@ public boolean equals(Object o) { && Objects.equals(this.modified, monitorNotificationRuleResponseAttributes.modified) && Objects.equals(this.name, monitorNotificationRuleResponseAttributes.name) && Objects.equals(this.recipients, monitorNotificationRuleResponseAttributes.recipients) + && Objects.equals(this.ruleOptions, monitorNotificationRuleResponseAttributes.ruleOptions) && Objects.equals( this.additionalProperties, monitorNotificationRuleResponseAttributes.additionalProperties); @@ -309,6 +340,7 @@ public int hashCode() { modified, name, recipients, + ruleOptions, additionalProperties); } @@ -325,6 +357,7 @@ public String toString() { sb.append(" modified: ").append(toIndentedString(modified)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" recipients: ").append(toIndentedString(recipients)).append("\n"); + sb.append(" ruleOptions: ").append(toIndentedString(ruleOptions)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) .append("\n"); 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 adda06d2e6c..6ecbfc44e28 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 @@ -70,6 +70,15 @@ Feature: Monitors Then the response status is 200 OK And the response "data.attributes.name" is equal to "test rule" + @team:ddoghq/monitor-app + Scenario: Create a monitor notification rule with rule options 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"], "rule_options": {"is_threaded": true}}, "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" + And the response "data.attributes.rule_options.is_threaded" is equal to true + @team:ddoghq/monitor-app Scenario: Create a monitor notification rule with scope returns "OK" response Given new "CreateMonitorNotificationRule" request @@ -311,6 +320,17 @@ Feature: Monitors Then the response status is 200 OK And the response "data.attributes.name" is equal to "updated rule" + @team:ddoghq/monitor-app + Scenario: Update a monitor notification rule with rule options 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"], "rule_options": {"is_threaded": false}}, "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" + And the response "data.attributes.rule_options.is_threaded" is equal to false + @team:ddoghq/monitor-app Scenario: Update a monitor notification rule with scope returns "OK" response Given there is a valid "monitor_notification_rule" in the system diff --git a/src/test/resources/generated-test/test-runner-data/manifest.json b/src/test/resources/generated-test/test-runner-data/manifest.json index 79334fa3a43..3a168dcef33 100644 --- a/src/test/resources/generated-test/test-runner-data/manifest.json +++ b/src/test/resources/generated-test/test-runner-data/manifest.json @@ -8407,6 +8407,13 @@ "scenario": "Create a monitor notification rule with conditional recipients returns \"OK\" response", "version": "v2" }, + { + "feature": "Monitors", + "feature_file": "../../com/datadog/api/client/v2/api/monitors.feature", + "file": "v2/monitors/create-a-monitor-notification-rule-with-rule-options-returns-ok-response.json", + "scenario": "Create a monitor notification rule with rule options returns \"OK\" response", + "version": "v2" + }, { "feature": "Monitors", "feature_file": "../../com/datadog/api/client/v2/api/monitors.feature", @@ -8589,6 +8596,13 @@ "scenario": "Update a monitor notification rule with conditional_recipients returns \"OK\" response", "version": "v2" }, + { + "feature": "Monitors", + "feature_file": "../../com/datadog/api/client/v2/api/monitors.feature", + "file": "v2/monitors/update-a-monitor-notification-rule-with-rule-options-returns-ok-response.json", + "scenario": "Update a monitor notification rule with rule options returns \"OK\" response", + "version": "v2" + }, { "feature": "Monitors", "feature_file": "../../com/datadog/api/client/v2/api/monitors.feature", diff --git a/src/test/resources/generated-test/test-runner-data/v2/monitors/create-a-monitor-notification-rule-with-rule-options-returns-ok-response.json b/src/test/resources/generated-test/test-runner-data/v2/monitors/create-a-monitor-notification-rule-with-rule-options-returns-ok-response.json new file mode 100644 index 00000000000..00dcd8c847e --- /dev/null +++ b/src/test/resources/generated-test/test-runner-data/v2/monitors/create-a-monitor-notification-rule-with-rule-options-returns-ok-response.json @@ -0,0 +1,44 @@ +{ + "api": "Monitors", + "expected_status": 200, + "feature": "Monitors", + "id": "v2/Monitors/Create a monitor notification rule with rule options returns \"OK\" response", + "operation_id": "CreateMonitorNotificationRule", + "request": { + "body": { + "schema": { + "format": null, + "ref": "MonitorNotificationRuleCreateRequest", + "type": "object" + }, + "source": "inline", + "value": { + "data": { + "attributes": { + "filter": { + "tags": [ + "test:{{ unique_lower }}" + ] + }, + "name": "test rule", + "recipients": [ + "slack-test-channel" + ], + "rule_options": { + "is_threaded": true + } + }, + "type": "monitor-notification-rule" + } + } + }, + "content_type": "application/json", + "method": "POST", + "pagination": false, + "parameters": [], + "path": "/api/v2/monitor/notification_rule" + }, + "scenario": "Create a monitor notification rule with rule options returns \"OK\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/src/test/resources/generated-test/test-runner-data/v2/monitors/update-a-monitor-notification-rule-with-rule-options-returns-ok-response.json b/src/test/resources/generated-test/test-runner-data/v2/monitors/update-a-monitor-notification-rule-with-rule-options-returns-ok-response.json new file mode 100644 index 00000000000..7a98cd0b530 --- /dev/null +++ b/src/test/resources/generated-test/test-runner-data/v2/monitors/update-a-monitor-notification-rule-with-rule-options-returns-ok-response.json @@ -0,0 +1,62 @@ +{ + "api": "Monitors", + "expected_status": 200, + "feature": "Monitors", + "id": "v2/Monitors/Update a monitor notification rule with rule options returns \"OK\" response", + "operation_id": "UpdateMonitorNotificationRule", + "request": { + "body": { + "schema": { + "format": null, + "ref": "MonitorNotificationRuleUpdateRequest", + "type": "object" + }, + "source": "inline", + "value": { + "data": { + "attributes": { + "filter": { + "tags": [ + "test:{{ unique_lower }}" + ] + }, + "name": "updated rule", + "recipients": [ + "slack-test-channel" + ], + "rule_options": { + "is_threaded": false + } + }, + "id": "{{ monitor_notification_rule.data.id }}", + "type": "monitor-notification-rule" + } + } + }, + "content_type": "application/json", + "method": "PATCH", + "pagination": false, + "parameters": [ + { + "explode": null, + "in": "path", + "name": "rule_id", + "required": true, + "schema": { + "format": null, + "ref": null, + "type": "string" + }, + "source": { + "path": "monitor_notification_rule.data.id", + "type": "fixture" + }, + "style": null + } + ], + "path": "/api/v2/monitor/notification_rule/{rule_id}" + }, + "scenario": "Update a monitor notification rule with rule options returns \"OK\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/src/test/resources/generated-test/test-server-data/v2/monitors.json b/src/test/resources/generated-test/test-server-data/v2/monitors.json index bec7dd9efd2..1f459341830 100644 --- a/src/test/resources/generated-test/test-server-data/v2/monitors.json +++ b/src/test/resources/generated-test/test-server-data/v2/monitors.json @@ -447,6 +447,78 @@ "scenario": "Create a monitor notification rule with conditional recipients returns \"OK\" response", "version": "v2" }, + { + "feature": "Monitors", + "frozen_at": "2026-10-30T20:36:08.126Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "filter": { + "tags": [ + "test:test-create_a_monitor_notification_rule_with_rule_options_returns_ok_response-1793392568" + ] + }, + "name": "test rule", + "recipients": [ + "slack-test-channel" + ], + "rule_options": { + "is_threaded": true + } + }, + "type": "monitor-notification-rule" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/monitor/notification_rule", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"type\":\"monitor-notification-rule\",\"id\":\"740e35fe-ba09-4bd7-981b-df1197331db5\",\"attributes\":{\"name\":\"test rule\",\"created_at\":\"2026-10-30T20:36:08.241525+00:00\",\"modified_at\":\"2026-10-30T20:36:08.260322+00:00\",\"filter\":{\"tags\":[\"test:test-create_a_monitor_notification_rule_with_rule_options_returns_ok_response-1793392568\"]},\"recipients\":[\"slack-test-channel\"],\"rule_options\":{\"is_threaded\":true}},\"relationships\":{\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"8c875225-6d15-408c-9dcc-dd539cd02fa5\"}}}},\"included\":[{\"type\":\"users\",\"id\":\"8c875225-6d15-408c-9dcc-dd539cd02fa5\",\"attributes\":{\"uuid\":\"8c875225-6d15-408c-9dcc-dd539cd02fa5\",\"name\":\"Shane Yuan\",\"handle\":\"shane.yuan@datadoghq.com\",\"created_at\":\"2026-10-30T20:27:13.026594+00:00\",\"modified_at\":\"2026-10-30T20:27:25.236531+00:00\",\"email\":\"shane.yuan@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/188fa6df65bb6c77c82677908094fbdb?s=48&d=retro\",\"title\":null,\"verified\":true,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\",\"last_login_time\":null}}]}\n" + }, + "headers": { + "content-type": "application/json" + }, + "reason": "OK", + "status": 200 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "DELETE", + "path": "/api/v2/monitor/notification_rule/740e35fe-ba09-4bd7-981b-df1197331db5", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "" + }, + "headers": { + "content-type": "text/html; charset=utf-8" + }, + "reason": "No Content", + "status": 204 + } + } + ], + "scenario": "Create a monitor notification rule with rule options returns \"OK\" response", + "version": "v2" + }, { "feature": "Monitors", "frozen_at": "2025-11-11T21:28:39.129Z", @@ -2388,6 +2460,117 @@ "scenario": "Update a monitor notification rule with conditional_recipients returns \"OK\" response", "version": "v2" }, + { + "feature": "Monitors", + "frozen_at": "2026-10-30T20:36:32.533Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "filter": { + "tags": [ + "app:test-update_a_monitor_notification_rule_with_rule_options_returns_ok_response-1793392592" + ] + }, + "name": "test rule", + "recipients": [ + "slack-monitor-app" + ] + }, + "type": "monitor-notification-rule" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/monitor/notification_rule", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"type\":\"monitor-notification-rule\",\"id\":\"586901e2-3384-4a4e-89c3-b7ba7906bcc0\",\"attributes\":{\"name\":\"test rule\",\"created_at\":\"2026-10-30T20:36:32.665098+00:00\",\"modified_at\":\"2026-10-30T20:36:32.679819+00:00\",\"filter\":{\"tags\":[\"app:test-update_a_monitor_notification_rule_with_rule_options_returns_ok_response-1793392592\"]},\"recipients\":[\"slack-monitor-app\"]},\"relationships\":{\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"8c875225-6d15-408c-9dcc-dd539cd02fa5\"}}}},\"included\":[{\"type\":\"users\",\"id\":\"8c875225-6d15-408c-9dcc-dd539cd02fa5\",\"attributes\":{\"uuid\":\"8c875225-6d15-408c-9dcc-dd539cd02fa5\",\"name\":\"Shane Yuan\",\"handle\":\"shane.yuan@datadoghq.com\",\"created_at\":\"2026-10-30T20:27:13.026594+00:00\",\"modified_at\":\"2026-10-30T20:27:25.236531+00:00\",\"email\":\"shane.yuan@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/188fa6df65bb6c77c82677908094fbdb?s=48&d=retro\",\"title\":null,\"verified\":true,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\",\"last_login_time\":null}}]}\n" + }, + "headers": { + "content-type": "application/json" + }, + "reason": "OK", + "status": 200 + } + }, + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "filter": { + "tags": [ + "test:test-update_a_monitor_notification_rule_with_rule_options_returns_ok_response-1793392592" + ] + }, + "name": "updated rule", + "recipients": [ + "slack-test-channel" + ], + "rule_options": { + "is_threaded": false + } + }, + "id": "586901e2-3384-4a4e-89c3-b7ba7906bcc0", + "type": "monitor-notification-rule" + } + } + }, + "content_type": "application/json", + "method": "PATCH", + "path": "/api/v2/monitor/notification_rule/586901e2-3384-4a4e-89c3-b7ba7906bcc0", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"type\":\"monitor-notification-rule\",\"id\":\"586901e2-3384-4a4e-89c3-b7ba7906bcc0\",\"attributes\":{\"name\":\"updated rule\",\"created_at\":\"2026-10-30T20:36:32.665098+00:00\",\"modified_at\":\"2026-10-30T20:36:32.849285+00:00\",\"filter\":{\"tags\":[\"test:test-update_a_monitor_notification_rule_with_rule_options_returns_ok_response-1793392592\"]},\"recipients\":[\"slack-test-channel\"],\"rule_options\":{\"is_threaded\":false}},\"relationships\":{\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"8c875225-6d15-408c-9dcc-dd539cd02fa5\"}}}},\"included\":[{\"type\":\"users\",\"id\":\"8c875225-6d15-408c-9dcc-dd539cd02fa5\",\"attributes\":{\"uuid\":\"8c875225-6d15-408c-9dcc-dd539cd02fa5\",\"name\":\"Shane Yuan\",\"handle\":\"shane.yuan@datadoghq.com\",\"created_at\":\"2026-10-30T20:27:13.026594+00:00\",\"modified_at\":\"2026-10-30T20:27:25.236531+00:00\",\"email\":\"shane.yuan@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/188fa6df65bb6c77c82677908094fbdb?s=48&d=retro\",\"title\":null,\"verified\":true,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\",\"last_login_time\":null}}]}\n" + }, + "headers": { + "content-type": "application/json" + }, + "reason": "OK", + "status": 200 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "DELETE", + "path": "/api/v2/monitor/notification_rule/586901e2-3384-4a4e-89c3-b7ba7906bcc0", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "" + }, + "headers": { + "content-type": "text/html; charset=utf-8" + }, + "reason": "No Content", + "status": 204 + } + } + ], + "scenario": "Update a monitor notification rule with rule options returns \"OK\" response", + "version": "v2" + }, { "feature": "Monitors", "frozen_at": "2025-11-11T21:28:40.357Z",