diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index ea614b7f86f..a8d6c87472c 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -35093,7 +35093,7 @@ components: type: object DeploymentRuleOptionsMonitor: additionalProperties: false - description: Monitor options for deployment rules. + description: Monitor query options for deployment rules. properties: duration: description: Seconds the monitor needs to stay in OK status for the rule to pass. @@ -35111,7 +35111,7 @@ components: example: false type: boolean query: - description: Monitors that match this query are evaluated. + description: A query that selects the monitors to evaluate. example: "service:my-service env:prod" type: string warmup: @@ -35124,6 +35124,66 @@ components: required: - query type: object + DeploymentRuleOptionsMonitorId: + additionalProperties: false + description: A specific monitor and the groups to evaluate for it. + properties: + groups: + description: The exact monitor group names to evaluate. An empty array evaluates all groups. + example: [] + items: + description: An exact monitor group name. + minLength: 1 + type: string + type: array + uniqueItems: true + id: + description: The monitor's decimal ID. + example: "123456" + pattern: "^[1-9][0-9]*$" + type: string + required: + - id + - groups + type: object + DeploymentRuleOptionsMonitorIds: + additionalProperties: false + description: Specific monitor options for deployment rules. + properties: + duration: + description: Seconds the monitors need to stay in OK status for the rule to pass. + example: 3600 + format: int64 + type: integer + fail_on_no_data: + default: true + description: Whether the rule should fail if a selected monitor group is in a NO DATA state. + example: false + type: boolean + fail_on_no_groups_found: + default: false + description: Whether the rule should fail if no monitor groups are found for the selected monitors. + example: false + type: boolean + monitor_ids: + description: A non-empty list of specific monitors to evaluate. + example: + - groups: [] + id: "123456" + items: + $ref: '#/components/schemas/DeploymentRuleOptionsMonitorId' + minItems: 1 + type: array + warmup: + default: 0 + description: Seconds to wait after a deployment starts before evaluating the monitors' statuses. + example: 0 + format: int64 + minimum: 0 + type: integer + required: + - monitor_ids + type: object DeploymentRuleResponse: description: Response for a deployment rule. properties: @@ -35238,6 +35298,7 @@ components: oneOf: - $ref: '#/components/schemas/DeploymentRuleOptionsFaultyDeploymentDetection' - $ref: '#/components/schemas/DeploymentRuleOptionsMonitor' + - $ref: '#/components/schemas/DeploymentRuleOptionsMonitorIds' DetachCaseRequest: description: Request for detaching security findings from their case. properties: diff --git a/examples/v2/deployment-gates/CreateDeploymentRule_2423265690.java b/examples/v2/deployment-gates/CreateDeploymentRule_2423265690.java new file mode 100644 index 00000000000..8fb0b20896f --- /dev/null +++ b/examples/v2/deployment-gates/CreateDeploymentRule_2423265690.java @@ -0,0 +1,57 @@ +// Create monitor deployment rule with monitor IDs returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.DeploymentGatesApi; +import com.datadog.api.client.v2.model.CreateDeploymentRuleParams; +import com.datadog.api.client.v2.model.CreateDeploymentRuleParamsData; +import com.datadog.api.client.v2.model.CreateDeploymentRuleParamsDataAttributes; +import com.datadog.api.client.v2.model.DeploymentRuleDataType; +import com.datadog.api.client.v2.model.DeploymentRuleOptionsMonitorId; +import com.datadog.api.client.v2.model.DeploymentRuleOptionsMonitorIds; +import com.datadog.api.client.v2.model.DeploymentRuleResponse; +import com.datadog.api.client.v2.model.DeploymentRulesOptions; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createDeploymentRule", true); + DeploymentGatesApi apiInstance = new DeploymentGatesApi(defaultClient); + + // there is a valid "deployment_gate" in the system + String DEPLOYMENT_GATE_DATA_ID = System.getenv("DEPLOYMENT_GATE_DATA_ID"); + + // there is a valid "monitor" in the system + Long MONITOR_ID = Long.parseLong(System.getenv("MONITOR_ID")); + + CreateDeploymentRuleParams body = + new CreateDeploymentRuleParams() + .data( + new CreateDeploymentRuleParamsData() + .attributes( + new CreateDeploymentRuleParamsDataAttributes() + .dryRun(false) + .name("Specific monitor deployment rule") + .options( + new DeploymentRulesOptions( + new DeploymentRuleOptionsMonitorIds() + .monitorIds( + Collections.singletonList( + new DeploymentRuleOptionsMonitorId().id("7"))))) + .type("monitor")) + .type(DeploymentRuleDataType.DEPLOYMENT_RULE)); + + try { + DeploymentRuleResponse result = + apiInstance.createDeploymentRule(DEPLOYMENT_GATE_DATA_ID, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DeploymentGatesApi#createDeploymentRule"); + 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/deployment-gates/CreateDeploymentRule_4286388136.java b/examples/v2/deployment-gates/CreateDeploymentRule_4286388136.java new file mode 100644 index 00000000000..bff2a34ebfc --- /dev/null +++ b/examples/v2/deployment-gates/CreateDeploymentRule_4286388136.java @@ -0,0 +1,50 @@ +// Create monitor deployment rule with query returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.DeploymentGatesApi; +import com.datadog.api.client.v2.model.CreateDeploymentRuleParams; +import com.datadog.api.client.v2.model.CreateDeploymentRuleParamsData; +import com.datadog.api.client.v2.model.CreateDeploymentRuleParamsDataAttributes; +import com.datadog.api.client.v2.model.DeploymentRuleDataType; +import com.datadog.api.client.v2.model.DeploymentRuleOptionsMonitor; +import com.datadog.api.client.v2.model.DeploymentRuleResponse; +import com.datadog.api.client.v2.model.DeploymentRulesOptions; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createDeploymentRule", true); + DeploymentGatesApi apiInstance = new DeploymentGatesApi(defaultClient); + + // there is a valid "deployment_gate" in the system + String DEPLOYMENT_GATE_DATA_ID = System.getenv("DEPLOYMENT_GATE_DATA_ID"); + + CreateDeploymentRuleParams body = + new CreateDeploymentRuleParams() + .data( + new CreateDeploymentRuleParamsData() + .attributes( + new CreateDeploymentRuleParamsDataAttributes() + .dryRun(false) + .name("Query monitor deployment rule") + .options( + new DeploymentRulesOptions( + new DeploymentRuleOptionsMonitor() + .query("service:transaction-backend env:production"))) + .type("monitor")) + .type(DeploymentRuleDataType.DEPLOYMENT_RULE)); + + try { + DeploymentRuleResponse result = + apiInstance.createDeploymentRule(DEPLOYMENT_GATE_DATA_ID, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DeploymentGatesApi#createDeploymentRule"); + 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/DeploymentRuleOptionsMonitor.java b/src/main/java/com/datadog/api/client/v2/model/DeploymentRuleOptionsMonitor.java index 5f5624026a6..74129da4407 100644 --- a/src/main/java/com/datadog/api/client/v2/model/DeploymentRuleOptionsMonitor.java +++ b/src/main/java/com/datadog/api/client/v2/model/DeploymentRuleOptionsMonitor.java @@ -13,7 +13,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; import java.util.Objects; -/** Monitor options for deployment rules. */ +/** Monitor query options for deployment rules. */ @JsonPropertyOrder({ DeploymentRuleOptionsMonitor.JSON_PROPERTY_DURATION, DeploymentRuleOptionsMonitor.JSON_PROPERTY_FAIL_ON_NO_DATA, @@ -117,7 +117,7 @@ public DeploymentRuleOptionsMonitor query(String query) { } /** - * Monitors that match this query are evaluated. + * A query that selects the monitors to evaluate. * * @return query */ diff --git a/src/main/java/com/datadog/api/client/v2/model/DeploymentRuleOptionsMonitorId.java b/src/main/java/com/datadog/api/client/v2/model/DeploymentRuleOptionsMonitorId.java new file mode 100644 index 00000000000..0ad5d462d7e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DeploymentRuleOptionsMonitorId.java @@ -0,0 +1,127 @@ +/* + * 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.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.ArrayList; +import java.util.List; +import java.util.Objects; + +/** A specific monitor and the groups to evaluate for it. */ +@JsonPropertyOrder({ + DeploymentRuleOptionsMonitorId.JSON_PROPERTY_GROUPS, + DeploymentRuleOptionsMonitorId.JSON_PROPERTY_ID +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DeploymentRuleOptionsMonitorId { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_GROUPS = "groups"; + private List groups = new ArrayList<>(); + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public DeploymentRuleOptionsMonitorId() {} + + @JsonCreator + public DeploymentRuleOptionsMonitorId( + @JsonProperty(required = true, value = JSON_PROPERTY_GROUPS) List groups, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id) { + this.groups = groups; + this.id = id; + } + + public DeploymentRuleOptionsMonitorId groups(List groups) { + this.groups = groups; + return this; + } + + public DeploymentRuleOptionsMonitorId addGroupsItem(String groupsItem) { + this.groups.add(groupsItem); + return this; + } + + /** + * The exact monitor group names to evaluate. An empty array evaluates all groups. + * + * @return groups + */ + @JsonProperty(JSON_PROPERTY_GROUPS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getGroups() { + return groups; + } + + public void setGroups(List groups) { + this.groups = groups; + } + + public DeploymentRuleOptionsMonitorId id(String id) { + this.id = id; + return this; + } + + /** + * The monitor's decimal ID. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + /** Return true if this DeploymentRuleOptionsMonitorId object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeploymentRuleOptionsMonitorId deploymentRuleOptionsMonitorId = + (DeploymentRuleOptionsMonitorId) o; + return Objects.equals(this.groups, deploymentRuleOptionsMonitorId.groups) + && Objects.equals(this.id, deploymentRuleOptionsMonitorId.id); + } + + @Override + public int hashCode() { + return Objects.hash(groups, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeploymentRuleOptionsMonitorId {\n"); + sb.append(" groups: ").append(toIndentedString(groups)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).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/DeploymentRuleOptionsMonitorIds.java b/src/main/java/com/datadog/api/client/v2/model/DeploymentRuleOptionsMonitorIds.java new file mode 100644 index 00000000000..041f1f09afb --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DeploymentRuleOptionsMonitorIds.java @@ -0,0 +1,225 @@ +/* + * 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.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.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Specific monitor options for deployment rules. */ +@JsonPropertyOrder({ + DeploymentRuleOptionsMonitorIds.JSON_PROPERTY_DURATION, + DeploymentRuleOptionsMonitorIds.JSON_PROPERTY_FAIL_ON_NO_DATA, + DeploymentRuleOptionsMonitorIds.JSON_PROPERTY_FAIL_ON_NO_GROUPS_FOUND, + DeploymentRuleOptionsMonitorIds.JSON_PROPERTY_MONITOR_IDS, + DeploymentRuleOptionsMonitorIds.JSON_PROPERTY_WARMUP +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DeploymentRuleOptionsMonitorIds { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DURATION = "duration"; + private Long duration; + + public static final String JSON_PROPERTY_FAIL_ON_NO_DATA = "fail_on_no_data"; + private Boolean failOnNoData = true; + + public static final String JSON_PROPERTY_FAIL_ON_NO_GROUPS_FOUND = "fail_on_no_groups_found"; + private Boolean failOnNoGroupsFound = false; + + public static final String JSON_PROPERTY_MONITOR_IDS = "monitor_ids"; + private List monitorIds = new ArrayList<>(); + + public static final String JSON_PROPERTY_WARMUP = "warmup"; + private Long warmup = 0l; + + public DeploymentRuleOptionsMonitorIds() {} + + @JsonCreator + public DeploymentRuleOptionsMonitorIds( + @JsonProperty(required = true, value = JSON_PROPERTY_MONITOR_IDS) + List monitorIds) { + this.monitorIds = monitorIds; + for (DeploymentRuleOptionsMonitorId item : monitorIds) { + this.unparsed |= item.unparsed; + } + } + + public DeploymentRuleOptionsMonitorIds duration(Long duration) { + this.duration = duration; + return this; + } + + /** + * Seconds the monitors need to stay in OK status for the rule to pass. + * + * @return duration + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DURATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getDuration() { + return duration; + } + + public void setDuration(Long duration) { + this.duration = duration; + } + + public DeploymentRuleOptionsMonitorIds failOnNoData(Boolean failOnNoData) { + this.failOnNoData = failOnNoData; + return this; + } + + /** + * Whether the rule should fail if a selected monitor group is in a NO DATA state. + * + * @return failOnNoData + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FAIL_ON_NO_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getFailOnNoData() { + return failOnNoData; + } + + public void setFailOnNoData(Boolean failOnNoData) { + this.failOnNoData = failOnNoData; + } + + public DeploymentRuleOptionsMonitorIds failOnNoGroupsFound(Boolean failOnNoGroupsFound) { + this.failOnNoGroupsFound = failOnNoGroupsFound; + return this; + } + + /** + * Whether the rule should fail if no monitor groups are found for the selected monitors. + * + * @return failOnNoGroupsFound + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FAIL_ON_NO_GROUPS_FOUND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getFailOnNoGroupsFound() { + return failOnNoGroupsFound; + } + + public void setFailOnNoGroupsFound(Boolean failOnNoGroupsFound) { + this.failOnNoGroupsFound = failOnNoGroupsFound; + } + + public DeploymentRuleOptionsMonitorIds monitorIds( + List monitorIds) { + this.monitorIds = monitorIds; + for (DeploymentRuleOptionsMonitorId item : monitorIds) { + this.unparsed |= item.unparsed; + } + return this; + } + + public DeploymentRuleOptionsMonitorIds addMonitorIdsItem( + DeploymentRuleOptionsMonitorId monitorIdsItem) { + this.monitorIds.add(monitorIdsItem); + this.unparsed |= monitorIdsItem.unparsed; + return this; + } + + /** + * A non-empty list of specific monitors to evaluate. + * + * @return monitorIds + */ + @JsonProperty(JSON_PROPERTY_MONITOR_IDS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getMonitorIds() { + return monitorIds; + } + + public void setMonitorIds(List monitorIds) { + this.monitorIds = monitorIds; + if (monitorIds != null) { + for (DeploymentRuleOptionsMonitorId item : monitorIds) { + this.unparsed |= item.unparsed; + } + } + } + + public DeploymentRuleOptionsMonitorIds warmup(Long warmup) { + this.warmup = warmup; + return this; + } + + /** + * Seconds to wait after a deployment starts before evaluating the monitors' statuses. minimum: 0 + * + * @return warmup + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_WARMUP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getWarmup() { + return warmup; + } + + public void setWarmup(Long warmup) { + this.warmup = warmup; + } + + /** Return true if this DeploymentRuleOptionsMonitorIds object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeploymentRuleOptionsMonitorIds deploymentRuleOptionsMonitorIds = + (DeploymentRuleOptionsMonitorIds) o; + return Objects.equals(this.duration, deploymentRuleOptionsMonitorIds.duration) + && Objects.equals(this.failOnNoData, deploymentRuleOptionsMonitorIds.failOnNoData) + && Objects.equals( + this.failOnNoGroupsFound, deploymentRuleOptionsMonitorIds.failOnNoGroupsFound) + && Objects.equals(this.monitorIds, deploymentRuleOptionsMonitorIds.monitorIds) + && Objects.equals(this.warmup, deploymentRuleOptionsMonitorIds.warmup); + } + + @Override + public int hashCode() { + return Objects.hash(duration, failOnNoData, failOnNoGroupsFound, monitorIds, warmup); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeploymentRuleOptionsMonitorIds {\n"); + sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); + sb.append(" failOnNoData: ").append(toIndentedString(failOnNoData)).append("\n"); + sb.append(" failOnNoGroupsFound: ") + .append(toIndentedString(failOnNoGroupsFound)) + .append("\n"); + sb.append(" monitorIds: ").append(toIndentedString(monitorIds)).append("\n"); + sb.append(" warmup: ").append(toIndentedString(warmup)).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/DeploymentRulesOptions.java b/src/main/java/com/datadog/api/client/v2/model/DeploymentRulesOptions.java index 001e810e18e..51350593e7d 100644 --- a/src/main/java/com/datadog/api/client/v2/model/DeploymentRulesOptions.java +++ b/src/main/java/com/datadog/api/client/v2/model/DeploymentRulesOptions.java @@ -178,6 +178,52 @@ public DeploymentRulesOptions deserialize(JsonParser jp, DeserializationContext log.log(Level.FINER, "Input data does not match schema 'DeploymentRuleOptionsMonitor'", e); } + // deserialize DeploymentRuleOptionsMonitorIds + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (DeploymentRuleOptionsMonitorIds.class.equals(Integer.class) + || DeploymentRuleOptionsMonitorIds.class.equals(Long.class) + || DeploymentRuleOptionsMonitorIds.class.equals(Float.class) + || DeploymentRuleOptionsMonitorIds.class.equals(Double.class) + || DeploymentRuleOptionsMonitorIds.class.equals(Boolean.class) + || DeploymentRuleOptionsMonitorIds.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((DeploymentRuleOptionsMonitorIds.class.equals(Integer.class) + || DeploymentRuleOptionsMonitorIds.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((DeploymentRuleOptionsMonitorIds.class.equals(Float.class) + || DeploymentRuleOptionsMonitorIds.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (DeploymentRuleOptionsMonitorIds.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (DeploymentRuleOptionsMonitorIds.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(DeploymentRuleOptionsMonitorIds.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((DeploymentRuleOptionsMonitorIds) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'DeploymentRuleOptionsMonitorIds'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, "Input data does not match schema 'DeploymentRuleOptionsMonitorIds'", e); + } + DeploymentRulesOptions ret = new DeploymentRulesOptions(); if (match == 1) { ret.setActualInstance(deserialized); @@ -217,11 +263,18 @@ public DeploymentRulesOptions(DeploymentRuleOptionsMonitor o) { setActualInstance(o); } + public DeploymentRulesOptions(DeploymentRuleOptionsMonitorIds o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + static { schemas.put( "DeploymentRuleOptionsFaultyDeploymentDetection", new GenericType() {}); schemas.put("DeploymentRuleOptionsMonitor", new GenericType() {}); + schemas.put( + "DeploymentRuleOptionsMonitorIds", new GenericType() {}); JSON.registerDescendants(DeploymentRulesOptions.class, Collections.unmodifiableMap(schemas)); } @@ -233,7 +286,7 @@ public Map getSchemas() { /** * Set the instance that matches the oneOf child schema, check the instance parameter is valid * against the oneOf child schemas: DeploymentRuleOptionsFaultyDeploymentDetection, - * DeploymentRuleOptionsMonitor + * DeploymentRuleOptionsMonitor, DeploymentRuleOptionsMonitorIds * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). @@ -249,6 +302,11 @@ public void setActualInstance(Object instance) { super.setActualInstance(instance); return; } + if (JSON.isInstanceOf( + DeploymentRuleOptionsMonitorIds.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { super.setActualInstance(instance); @@ -256,15 +314,16 @@ public void setActualInstance(Object instance) { } throw new RuntimeException( "Invalid instance type. Must be DeploymentRuleOptionsFaultyDeploymentDetection," - + " DeploymentRuleOptionsMonitor"); + + " DeploymentRuleOptionsMonitor, DeploymentRuleOptionsMonitorIds"); } /** * Get the actual instance, which can be the following: - * DeploymentRuleOptionsFaultyDeploymentDetection, DeploymentRuleOptionsMonitor + * DeploymentRuleOptionsFaultyDeploymentDetection, DeploymentRuleOptionsMonitor, + * DeploymentRuleOptionsMonitorIds * * @return The actual instance (DeploymentRuleOptionsFaultyDeploymentDetection, - * DeploymentRuleOptionsMonitor) + * DeploymentRuleOptionsMonitor, DeploymentRuleOptionsMonitorIds) */ @Override public Object getActualInstance() { @@ -295,4 +354,16 @@ public Object getActualInstance() { public DeploymentRuleOptionsMonitor getDeploymentRuleOptionsMonitor() throws ClassCastException { return (DeploymentRuleOptionsMonitor) super.getActualInstance(); } + + /** + * Get the actual instance of `DeploymentRuleOptionsMonitorIds`. If the actual instance is not + * `DeploymentRuleOptionsMonitorIds`, the ClassCastException will be thrown. + * + * @return The actual instance of `DeploymentRuleOptionsMonitorIds` + * @throws ClassCastException if the instance is not `DeploymentRuleOptionsMonitorIds` + */ + public DeploymentRuleOptionsMonitorIds getDeploymentRuleOptionsMonitorIds() + throws ClassCastException { + return (DeploymentRuleOptionsMonitorIds) super.getActualInstance(); + } } diff --git a/src/test/resources/com/datadog/api/client/v2/api/deployment_gates.feature b/src/test/resources/com/datadog/api/client/v2/api/deployment_gates.feature index 1825f8af3a9..b4ccba22c50 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/deployment_gates.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/deployment_gates.feature @@ -63,6 +63,37 @@ Feature: Deployment Gates When the request is sent Then the response status is 200 OK + @team:DataDog/ci-app-backend + Scenario: Create monitor deployment rule with monitor IDs returns "OK" response + Given there is a valid "deployment_gate" in the system + And there is a valid "monitor" in the system + And operation "CreateDeploymentRule" enabled + And new "CreateDeploymentRule" request + And request contains "gate_id" parameter from "deployment_gate.data.id" + And body with value {"data": {"attributes": {"dry_run": false, "name": "Specific monitor deployment rule", "options": {"monitor_ids": [{"id": "{{ monitor.id }}", "groups": []}]}, "type": "monitor"}, "type": "deployment_rule"}} + When the request is sent + Then the response status is 200 OK + + @team:DataDog/ci-app-backend + Scenario: Create monitor deployment rule with query and monitor IDs returns "Bad Request" response + Given there is a valid "deployment_gate" in the system + And operation "CreateDeploymentRule" enabled + And new "CreateDeploymentRule" request + And request contains "gate_id" parameter from "deployment_gate.data.id" + And body with value {"data": {"attributes": {"dry_run": false, "name": "Ambiguous monitor deployment rule", "options": {"query": "service:transaction-backend env:production", "monitor_ids": [{"id": "123456", "groups": []}]}, "type": "monitor"}, "type": "deployment_rule"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/ci-app-backend + Scenario: Create monitor deployment rule with query returns "OK" response + Given there is a valid "deployment_gate" in the system + And operation "CreateDeploymentRule" enabled + And new "CreateDeploymentRule" request + And request contains "gate_id" parameter from "deployment_gate.data.id" + And body with value {"data": {"attributes": {"dry_run": false, "name": "Query monitor deployment rule", "options": {"query": "service:transaction-backend env:production"}, "type": "monitor"}, "type": "deployment_rule"}} + When the request is sent + Then the response status is 200 OK + @team:DataDog/ci-app-backend Scenario: Delete deployment gate returns "Bad Request" response Given operation "DeleteDeploymentGate" enabled 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 3baf593f3b5..cfb7e3e0cc6 100644 --- a/src/test/resources/generated-test/test-runner-data/manifest.json +++ b/src/test/resources/generated-test/test-runner-data/manifest.json @@ -4893,6 +4893,27 @@ "scenario": "Create deployment rule returns \"OK\" response", "version": "v2" }, + { + "feature": "Deployment Gates", + "feature_file": "../../com/datadog/api/client/v2/api/deployment_gates.feature", + "file": "v2/deployment-gates/create-monitor-deployment-rule-with-monitor-ids-returns-ok-response.json", + "scenario": "Create monitor deployment rule with monitor IDs returns \"OK\" response", + "version": "v2" + }, + { + "feature": "Deployment Gates", + "feature_file": "../../com/datadog/api/client/v2/api/deployment_gates.feature", + "file": "v2/deployment-gates/create-monitor-deployment-rule-with-query-and-monitor-ids-returns-bad-request-response.json", + "scenario": "Create monitor deployment rule with query and monitor IDs returns \"Bad Request\" response", + "version": "v2" + }, + { + "feature": "Deployment Gates", + "feature_file": "../../com/datadog/api/client/v2/api/deployment_gates.feature", + "file": "v2/deployment-gates/create-monitor-deployment-rule-with-query-returns-ok-response.json", + "scenario": "Create monitor deployment rule with query returns \"OK\" response", + "version": "v2" + }, { "feature": "Deployment Gates", "feature_file": "../../com/datadog/api/client/v2/api/deployment_gates.feature", diff --git a/src/test/resources/generated-test/test-runner-data/v2/deployment-gates/create-monitor-deployment-rule-with-monitor-ids-returns-ok-response.json b/src/test/resources/generated-test/test-runner-data/v2/deployment-gates/create-monitor-deployment-rule-with-monitor-ids-returns-ok-response.json new file mode 100644 index 00000000000..0abb0bfbd0b --- /dev/null +++ b/src/test/resources/generated-test/test-runner-data/v2/deployment-gates/create-monitor-deployment-rule-with-monitor-ids-returns-ok-response.json @@ -0,0 +1,60 @@ +{ + "api": "DeploymentGates", + "expected_status": 200, + "feature": "Deployment Gates", + "id": "v2/Deployment Gates/Create monitor deployment rule with monitor IDs returns \"OK\" response", + "operation_id": "CreateDeploymentRule", + "request": { + "body": { + "schema": { + "format": null, + "ref": "CreateDeploymentRuleParams", + "type": "object" + }, + "source": "inline", + "value": { + "data": { + "attributes": { + "dry_run": false, + "name": "Specific monitor deployment rule", + "options": { + "monitor_ids": [ + { + "groups": [], + "id": "{{ monitor.id }}" + } + ] + }, + "type": "monitor" + }, + "type": "deployment_rule" + } + } + }, + "content_type": "application/json", + "method": "POST", + "pagination": false, + "parameters": [ + { + "explode": null, + "in": "path", + "name": "gate_id", + "required": true, + "schema": { + "format": null, + "ref": null, + "type": "string" + }, + "source": { + "path": "deployment_gate.data.id", + "type": "fixture" + }, + "style": null + } + ], + "path": "/api/v2/deployment_gates/{gate_id}/rules" + }, + "scenario": "Create monitor deployment rule with monitor IDs returns \"OK\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/src/test/resources/generated-test/test-runner-data/v2/deployment-gates/create-monitor-deployment-rule-with-query-and-monitor-ids-returns-bad-request-response.json b/src/test/resources/generated-test/test-runner-data/v2/deployment-gates/create-monitor-deployment-rule-with-query-and-monitor-ids-returns-bad-request-response.json new file mode 100644 index 00000000000..eba55de59cb --- /dev/null +++ b/src/test/resources/generated-test/test-runner-data/v2/deployment-gates/create-monitor-deployment-rule-with-query-and-monitor-ids-returns-bad-request-response.json @@ -0,0 +1,61 @@ +{ + "api": "DeploymentGates", + "expected_status": 400, + "feature": "Deployment Gates", + "id": "v2/Deployment Gates/Create monitor deployment rule with query and monitor IDs returns \"Bad Request\" response", + "operation_id": "CreateDeploymentRule", + "request": { + "body": { + "schema": { + "format": null, + "ref": "CreateDeploymentRuleParams", + "type": "object" + }, + "source": "inline", + "value": { + "data": { + "attributes": { + "dry_run": false, + "name": "Ambiguous monitor deployment rule", + "options": { + "monitor_ids": [ + { + "groups": [], + "id": "123456" + } + ], + "query": "service:transaction-backend env:production" + }, + "type": "monitor" + }, + "type": "deployment_rule" + } + } + }, + "content_type": "application/json", + "method": "POST", + "pagination": false, + "parameters": [ + { + "explode": null, + "in": "path", + "name": "gate_id", + "required": true, + "schema": { + "format": null, + "ref": null, + "type": "string" + }, + "source": { + "path": "deployment_gate.data.id", + "type": "fixture" + }, + "style": null + } + ], + "path": "/api/v2/deployment_gates/{gate_id}/rules" + }, + "scenario": "Create monitor deployment rule with query and monitor IDs returns \"Bad Request\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/src/test/resources/generated-test/test-runner-data/v2/deployment-gates/create-monitor-deployment-rule-with-query-returns-ok-response.json b/src/test/resources/generated-test/test-runner-data/v2/deployment-gates/create-monitor-deployment-rule-with-query-returns-ok-response.json new file mode 100644 index 00000000000..862fdccd070 --- /dev/null +++ b/src/test/resources/generated-test/test-runner-data/v2/deployment-gates/create-monitor-deployment-rule-with-query-returns-ok-response.json @@ -0,0 +1,55 @@ +{ + "api": "DeploymentGates", + "expected_status": 200, + "feature": "Deployment Gates", + "id": "v2/Deployment Gates/Create monitor deployment rule with query returns \"OK\" response", + "operation_id": "CreateDeploymentRule", + "request": { + "body": { + "schema": { + "format": null, + "ref": "CreateDeploymentRuleParams", + "type": "object" + }, + "source": "inline", + "value": { + "data": { + "attributes": { + "dry_run": false, + "name": "Query monitor deployment rule", + "options": { + "query": "service:transaction-backend env:production" + }, + "type": "monitor" + }, + "type": "deployment_rule" + } + } + }, + "content_type": "application/json", + "method": "POST", + "pagination": false, + "parameters": [ + { + "explode": null, + "in": "path", + "name": "gate_id", + "required": true, + "schema": { + "format": null, + "ref": null, + "type": "string" + }, + "source": { + "path": "deployment_gate.data.id", + "type": "fixture" + }, + "style": null + } + ], + "path": "/api/v2/deployment_gates/{gate_id}/rules" + }, + "scenario": "Create monitor deployment rule with query returns \"OK\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/src/test/resources/generated-test/test-server-data/v2/deployment-gates.json b/src/test/resources/generated-test/test-server-data/v2/deployment-gates.json index 877ef4c0293..3d2525996a4 100644 --- a/src/test/resources/generated-test/test-server-data/v2/deployment-gates.json +++ b/src/test/resources/generated-test/test-server-data/v2/deployment-gates.json @@ -460,6 +460,426 @@ "scenario": "Create deployment rule returns \"OK\" response", "version": "v2" }, + { + "feature": "Deployment Gates", + "frozen_at": "2026-09-09T08:52:04.617Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "dry_run": false, + "env": "production", + "identifier": "my-gate-testcreatemonitordeploymentrulewithmonitoridsreturnsokresponse1788943924", + "service": "my-service" + }, + "type": "deployment_gate" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/deployment_gates", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"id\":\"f0a2f7a7-3edb-4c32-8b6f-2b294e050070\",\"type\":\"deployment_gate\",\"attributes\":{\"created_at\":\"2026-09-09T08:52:05.675749Z\",\"created_by\":{\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"},\"dry_run\":false,\"env\":\"production\",\"identifier\":\"my-gate-testcreatemonitordeploymentrulewithmonitoridsreturnsokresponse1788943924\",\"service\":\"my-service\",\"updated_at\":\"2026-09-09T08:52:05.675749Z\",\"updated_by\":{\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"}}}}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "OK", + "status": 200 + } + }, + { + "request": { + "body": { + "type": "json", + "value": { + "message": "some message Notify: @hipchat-channel", + "name": "Test-Create_monitor_deployment_rule_with_monitor_IDs_returns_OK_response-1788943924", + "options": { + "enable_logs_sample": true, + "escalation_message": "the situation has escalated", + "evaluation_delay": 700, + "include_tags": true, + "locked": false, + "new_host_delay": 600, + "no_data_timeframe": null, + "notification_preset_name": "hide_handles", + "notify_audit": false, + "notify_no_data": false, + "on_missing_data": "show_and_notify_no_data", + "renotify_interval": 60, + "require_full_window": true, + "thresholds": { + "critical": 2, + "warning": 1 + }, + "timeout_h": 24 + }, + "priority": 3, + "query": "logs(\"service:foo AND type:error\").index(\"main\").rollup(\"count\").by(\"source\").last(\"5m\") > 2", + "tags": [ + "test:testcreatemonitordeploymentrulewithmonitoridsreturnsokresponse1788943924", + "env:ci" + ], + "type": "log alert" + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v1/monitor", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"id\":320387601,\"org_id\":321813,\"type\":\"log alert\",\"name\":\"Test-Create_monitor_deployment_rule_with_monitor_IDs_returns_OK_response-1788943924\",\"message\":\"some message Notify: @hipchat-channel\",\"tags\":[\"test:testcreatemonitordeploymentrulewithmonitoridsreturnsokresponse1788943924\",\"env:ci\"],\"query\":\"logs(\\\"service:foo AND type:error\\\").index(\\\"main\\\").rollup(\\\"count\\\").by(\\\"source\\\").last(\\\"5m\\\") > 2\",\"options\":{\"enable_logs_sample\":true,\"escalation_message\":\"the situation has escalated\",\"evaluation_delay\":700,\"include_tags\":true,\"locked\":false,\"new_host_delay\":600,\"no_data_timeframe\":null,\"notification_preset_name\":\"hide_handles\",\"notify_audit\":false,\"notify_no_data\":false,\"on_missing_data\":\"show_and_notify_no_data\",\"renotify_interval\":60,\"require_full_window\":true,\"thresholds\":{\"critical\":2.0,\"warning\":1.0},\"timeout_h\":24,\"groupby_simple_monitor\":false,\"silenced\":{}},\"multi\":true,\"created_at\":1788943926000,\"created\":\"2026-09-09T08:52:06.017418+00:00\",\"modified\":\"2026-09-09T08:52:06.017418+00:00\",\"deleted\":null,\"priority\":3,\"restricted_roles\":null,\"restriction_policy\":null,\"draft_status\":\"published\",\"assets\":[],\"overall_state_modified\":null,\"overall_state\":\"No Data\",\"creator\":{\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"email\":\"team-intg-tools-libs-spam@datadoghq.com\",\"id\":2320499}}\n" + }, + "headers": { + "content-type": "application/json" + }, + "reason": "OK", + "status": 200 + } + }, + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "dry_run": false, + "name": "Specific monitor deployment rule", + "options": { + "monitor_ids": [ + { + "groups": [], + "id": "320387601" + } + ] + }, + "type": "monitor" + }, + "type": "deployment_rule" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/deployment_gates/f0a2f7a7-3edb-4c32-8b6f-2b294e050070/rules", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"id\":\"a7022950-2803-4275-a3a4-d2b611a38901\",\"type\":\"deployment_rule\",\"attributes\":{\"created_at\":\"2026-09-09T08:52:06.381853Z\",\"created_by\":{\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"},\"dry_run\":false,\"gate_id\":\"f0a2f7a7-3edb-4c32-8b6f-2b294e050070\",\"name\":\"Specific monitor deployment rule\",\"options\":{\"monitor_ids\":[{\"id\":\"320387601\",\"groups\":[]}]},\"type\":\"monitor\",\"updated_at\":\"2026-09-09T08:52:06.381853Z\",\"updated_by\":{\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"}}}}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "OK", + "status": 200 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "DELETE", + "path": "/api/v2/deployment_gates/f0a2f7a7-3edb-4c32-8b6f-2b294e050070/rules/a7022950-2803-4275-a3a4-d2b611a38901", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "" + }, + "headers": {}, + "reason": "No Content", + "status": 204 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "DELETE", + "path": "/api/v1/monitor/320387601", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"deleted_monitor_id\":320387601}\n" + }, + "headers": { + "content-type": "application/json" + }, + "reason": "OK", + "status": 200 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "DELETE", + "path": "/api/v2/deployment_gates/f0a2f7a7-3edb-4c32-8b6f-2b294e050070", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "" + }, + "headers": {}, + "reason": "No Content", + "status": 204 + } + } + ], + "scenario": "Create monitor deployment rule with monitor IDs returns \"OK\" response", + "version": "v2" + }, + { + "feature": "Deployment Gates", + "frozen_at": "2026-09-09T08:52:07.322Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "dry_run": false, + "env": "production", + "identifier": "my-gate-testcreatemonitordeploymentrulewithqueryandmonitoridsreturnsbadrequestresponse1788943927", + "service": "my-service" + }, + "type": "deployment_gate" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/deployment_gates", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"id\":\"a5f38bf8-bd06-4dac-82a8-8b80bdafb001\",\"type\":\"deployment_gate\",\"attributes\":{\"created_at\":\"2026-09-09T08:52:07.633476Z\",\"created_by\":{\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"},\"dry_run\":false,\"env\":\"production\",\"identifier\":\"my-gate-testcreatemonitordeploymentrulewithqueryandmonitoridsreturnsbadrequestresponse1788943927\",\"service\":\"my-service\",\"updated_at\":\"2026-09-09T08:52:07.633476Z\",\"updated_by\":{\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"}}}}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "OK", + "status": 200 + } + }, + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "dry_run": false, + "name": "Ambiguous monitor deployment rule", + "options": { + "monitor_ids": [ + { + "groups": [], + "id": "123456" + } + ], + "query": "service:transaction-backend env:production" + }, + "type": "monitor" + }, + "type": "deployment_rule" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/deployment_gates/a5f38bf8-bd06-4dac-82a8-8b80bdafb001/rules", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"errors\":[{\"status\":\"400\",\"title\":\"Bad Request\",\"detail\":\"options.query and options.monitor_ids are mutually exclusive\"}]}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "Bad Request", + "status": 400 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "DELETE", + "path": "/api/v2/deployment_gates/a5f38bf8-bd06-4dac-82a8-8b80bdafb001", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "" + }, + "headers": {}, + "reason": "No Content", + "status": 204 + } + } + ], + "scenario": "Create monitor deployment rule with query and monitor IDs returns \"Bad Request\" response", + "version": "v2" + }, + { + "feature": "Deployment Gates", + "frozen_at": "2026-09-09T08:52:08.166Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "dry_run": false, + "env": "production", + "identifier": "my-gate-testcreatemonitordeploymentrulewithqueryreturnsokresponse1788943928", + "service": "my-service" + }, + "type": "deployment_gate" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/deployment_gates", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"id\":\"a4d3587f-f61d-42bd-869a-2318a4f377e7\",\"type\":\"deployment_gate\",\"attributes\":{\"created_at\":\"2026-09-09T08:52:08.338192Z\",\"created_by\":{\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"},\"dry_run\":false,\"env\":\"production\",\"identifier\":\"my-gate-testcreatemonitordeploymentrulewithqueryreturnsokresponse1788943928\",\"service\":\"my-service\",\"updated_at\":\"2026-09-09T08:52:08.338192Z\",\"updated_by\":{\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"}}}}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "OK", + "status": 200 + } + }, + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "dry_run": false, + "name": "Query monitor deployment rule", + "options": { + "query": "service:transaction-backend env:production" + }, + "type": "monitor" + }, + "type": "deployment_rule" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/deployment_gates/a4d3587f-f61d-42bd-869a-2318a4f377e7/rules", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"id\":\"5db11563-3823-41bf-883b-791028de5b7d\",\"type\":\"deployment_rule\",\"attributes\":{\"created_at\":\"2026-09-09T08:52:08.601315Z\",\"created_by\":{\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"},\"dry_run\":false,\"gate_id\":\"a4d3587f-f61d-42bd-869a-2318a4f377e7\",\"name\":\"Query monitor deployment rule\",\"options\":{\"query\":\"service:transaction-backend env:production\"},\"type\":\"monitor\",\"updated_at\":\"2026-09-09T08:52:08.601315Z\",\"updated_by\":{\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"}}}}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "OK", + "status": 200 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "DELETE", + "path": "/api/v2/deployment_gates/a4d3587f-f61d-42bd-869a-2318a4f377e7/rules/5db11563-3823-41bf-883b-791028de5b7d", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "" + }, + "headers": {}, + "reason": "No Content", + "status": 204 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "DELETE", + "path": "/api/v2/deployment_gates/a4d3587f-f61d-42bd-869a-2318a4f377e7", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "" + }, + "headers": {}, + "reason": "No Content", + "status": 204 + } + } + ], + "scenario": "Create monitor deployment rule with query returns \"OK\" response", + "version": "v2" + }, { "feature": "Deployment Gates", "frozen_at": "2025-10-28T14:03:29.170Z",