diff --git a/.apigentools-info b/.apigentools-info index dcd31ae9e5a..1a75b9caa70 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.4", - "regenerated": "2023-05-04 18:52:23.772285", - "spec_repo_commit": "4706b973" + "regenerated": "2023-05-04 19:21:12.663548", + "spec_repo_commit": "c0cc4b41" }, "v2": { "apigentools_version": "1.6.4", - "regenerated": "2023-05-04 18:52:23.785037", - "spec_repo_commit": "4706b973" + "regenerated": "2023-05-04 19:21:12.675857", + "spec_repo_commit": "c0cc4b41" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index c0e5901b8b7..47beee8d412 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -1744,6 +1744,10 @@ components: be muted. example: false type: boolean + notify_end_states: + $ref: '#/components/schemas/NotifyEndStates' + notify_end_types: + $ref: '#/components/schemas/NotifyEndTypes' parent_id: description: ID of the parent Downtime. example: 123 @@ -1880,6 +1884,10 @@ components: be muted. example: false type: boolean + notify_end_states: + $ref: '#/components/schemas/NotifyEndStates' + notify_end_types: + $ref: '#/components/schemas/NotifyEndTypes' parent_id: description: ID of the parent Downtime. example: 123 @@ -8399,6 +8407,60 @@ components: format: int64 type: integer type: object + NotifyEndState: + description: A notification end state. + enum: + - alert + - no data + - warn + example: alert + type: string + x-enum-varnames: + - ALERT + - NO_DATA + - WARN + NotifyEndStates: + default: + - alert + - no data + - warn + description: States for which `notify_end_types` sends out notifications for. + example: + - alert + - no data + - warn + items: + $ref: '#/components/schemas/NotifyEndState' + type: array + NotifyEndType: + description: A notification end type. + enum: + - canceled + - expired + example: expired + type: string + x-enum-varnames: + - CANCELED + - EXPIRED + NotifyEndTypes: + default: + - expired + description: 'If set, notifies if a monitor is in an alert-worthy state (`ALERT`, + `WARNING`, or `NO DATA`) + + when this downtime expires or is canceled. Applied to monitors that change + states during + + the downtime (such as from `OK` to `ALERT`, `WARNING`, or `NO DATA`), and + to monitors that + + already have an alert-worthy state when downtime begins.' + example: + - canceled + - expired + items: + $ref: '#/components/schemas/NotifyEndType' + type: array OnMissingDataOption: description: 'Controls how groups or monitors are treated if an evaluation does not return any data points. diff --git a/examples/v1/downtimes/CreateDowntime_2908359488.java b/examples/v1/downtimes/CreateDowntime_2908359488.java index 5d09da3cf20..acd3b891c98 100644 --- a/examples/v1/downtimes/CreateDowntime_2908359488.java +++ b/examples/v1/downtimes/CreateDowntime_2908359488.java @@ -4,6 +4,8 @@ import com.datadog.api.client.v1.api.DowntimesApi; import com.datadog.api.client.v1.model.Downtime; import com.datadog.api.client.v1.model.DowntimeRecurrence; +import com.datadog.api.client.v1.model.NotifyEndState; +import com.datadog.api.client.v1.model.NotifyEndType; import java.time.OffsetDateTime; import java.util.Arrays; import java.util.Collections; @@ -27,7 +29,9 @@ public static void main(String[] args) { .end(OffsetDateTime.now().plusHours(1).toInstant().getEpochSecond()) .timezone("Etc/UTC") .muteFirstRecoveryNotification(true) - .monitorTags(Collections.singletonList("tag0")); + .monitorTags(Collections.singletonList("tag0")) + .notifyEndStates(Collections.singletonList(NotifyEndState.ALERT)) + .notifyEndTypes(Collections.singletonList(NotifyEndType.CANCELED)); try { Downtime result = apiInstance.createDowntime(body); diff --git a/examples/v1/downtimes/CreateDowntime_3059354445.java b/examples/v1/downtimes/CreateDowntime_3059354445.java index e376a2988ef..8055a2653ec 100644 --- a/examples/v1/downtimes/CreateDowntime_3059354445.java +++ b/examples/v1/downtimes/CreateDowntime_3059354445.java @@ -4,7 +4,10 @@ import com.datadog.api.client.v1.api.DowntimesApi; import com.datadog.api.client.v1.model.Downtime; import com.datadog.api.client.v1.model.DowntimeRecurrence; +import com.datadog.api.client.v1.model.NotifyEndState; +import com.datadog.api.client.v1.model.NotifyEndType; import java.time.OffsetDateTime; +import java.util.Arrays; import java.util.Collections; public class Example { @@ -21,7 +24,9 @@ public static void main(String[] args) { .end(OffsetDateTime.now().plusHours(1).toInstant().getEpochSecond()) .timezone("Etc/UTC") .muteFirstRecoveryNotification(true) - .monitorTags(Collections.singletonList("tag0")); + .monitorTags(Collections.singletonList("tag0")) + .notifyEndStates(Arrays.asList(NotifyEndState.ALERT, NotifyEndState.WARN)) + .notifyEndTypes(Collections.singletonList(NotifyEndType.EXPIRED)); try { Downtime result = apiInstance.createDowntime(body); diff --git a/src/main/java/com/datadog/api/client/v1/model/Downtime.java b/src/main/java/com/datadog/api/client/v1/model/Downtime.java index 6d81364065a..1e220f38eca 100644 --- a/src/main/java/com/datadog/api/client/v1/model/Downtime.java +++ b/src/main/java/com/datadog/api/client/v1/model/Downtime.java @@ -33,6 +33,8 @@ Downtime.JSON_PROPERTY_MONITOR_ID, Downtime.JSON_PROPERTY_MONITOR_TAGS, Downtime.JSON_PROPERTY_MUTE_FIRST_RECOVERY_NOTIFICATION, + Downtime.JSON_PROPERTY_NOTIFY_END_STATES, + Downtime.JSON_PROPERTY_NOTIFY_END_TYPES, Downtime.JSON_PROPERTY_PARENT_ID, Downtime.JSON_PROPERTY_RECURRENCE, Downtime.JSON_PROPERTY_SCOPE, @@ -81,6 +83,12 @@ public class Downtime { "mute_first_recovery_notification"; private Boolean muteFirstRecoveryNotification; + public static final String JSON_PROPERTY_NOTIFY_END_STATES = "notify_end_states"; + private List notifyEndStates = null; + + public static final String JSON_PROPERTY_NOTIFY_END_TYPES = "notify_end_types"; + private List notifyEndTypes = null; + public static final String JSON_PROPERTY_PARENT_ID = "parent_id"; private JsonNullable parentId = JsonNullable.undefined(); @@ -374,6 +382,70 @@ public void setMuteFirstRecoveryNotification(Boolean muteFirstRecoveryNotificati this.muteFirstRecoveryNotification = muteFirstRecoveryNotification; } + public Downtime notifyEndStates(List notifyEndStates) { + this.notifyEndStates = notifyEndStates; + return this; + } + + public Downtime addNotifyEndStatesItem(NotifyEndState notifyEndStatesItem) { + if (this.notifyEndStates == null) { + this.notifyEndStates = new ArrayList<>(); + } + this.notifyEndStates.add(notifyEndStatesItem); + this.unparsed |= !notifyEndStatesItem.isValid(); + return this; + } + + /** + * States for which notify_end_types sends out notifications for. + * + * @return notifyEndStates + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NOTIFY_END_STATES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getNotifyEndStates() { + return notifyEndStates; + } + + public void setNotifyEndStates(List notifyEndStates) { + this.notifyEndStates = notifyEndStates; + } + + public Downtime notifyEndTypes(List notifyEndTypes) { + this.notifyEndTypes = notifyEndTypes; + return this; + } + + public Downtime addNotifyEndTypesItem(NotifyEndType notifyEndTypesItem) { + if (this.notifyEndTypes == null) { + this.notifyEndTypes = new ArrayList<>(); + } + this.notifyEndTypes.add(notifyEndTypesItem); + this.unparsed |= !notifyEndTypesItem.isValid(); + return this; + } + + /** + * If set, notifies if a monitor is in an alert-worthy state (ALERT, WARNING + * , or NO DATA) when this downtime expires or is canceled. Applied to + * monitors that change states during the downtime (such as from OK to ALERT + * , WARNING, or NO DATA), and to monitors that already have an + * alert-worthy state when downtime begins. + * + * @return notifyEndTypes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NOTIFY_END_TYPES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getNotifyEndTypes() { + return notifyEndTypes; + } + + public void setNotifyEndTypes(List notifyEndTypes) { + this.notifyEndTypes = notifyEndTypes; + } + public Downtime parentId(Long parentId) { this.parentId = JsonNullable.of(parentId); return this; @@ -560,6 +632,8 @@ public boolean equals(Object o) { && Objects.equals(this.monitorTags, downtime.monitorTags) && Objects.equals( this.muteFirstRecoveryNotification, downtime.muteFirstRecoveryNotification) + && Objects.equals(this.notifyEndStates, downtime.notifyEndStates) + && Objects.equals(this.notifyEndTypes, downtime.notifyEndTypes) && Objects.equals(this.parentId, downtime.parentId) && Objects.equals(this.recurrence, downtime.recurrence) && Objects.equals(this.scope, downtime.scope) @@ -583,6 +657,8 @@ public int hashCode() { monitorId, monitorTags, muteFirstRecoveryNotification, + notifyEndStates, + notifyEndTypes, parentId, recurrence, scope, @@ -609,6 +685,8 @@ public String toString() { sb.append(" muteFirstRecoveryNotification: ") .append(toIndentedString(muteFirstRecoveryNotification)) .append("\n"); + sb.append(" notifyEndStates: ").append(toIndentedString(notifyEndStates)).append("\n"); + sb.append(" notifyEndTypes: ").append(toIndentedString(notifyEndTypes)).append("\n"); sb.append(" parentId: ").append(toIndentedString(parentId)).append("\n"); sb.append(" recurrence: ").append(toIndentedString(recurrence)).append("\n"); sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); diff --git a/src/main/java/com/datadog/api/client/v1/model/DowntimeChild.java b/src/main/java/com/datadog/api/client/v1/model/DowntimeChild.java index 09ea7fe9904..21d933f4859 100644 --- a/src/main/java/com/datadog/api/client/v1/model/DowntimeChild.java +++ b/src/main/java/com/datadog/api/client/v1/model/DowntimeChild.java @@ -31,6 +31,8 @@ DowntimeChild.JSON_PROPERTY_MONITOR_ID, DowntimeChild.JSON_PROPERTY_MONITOR_TAGS, DowntimeChild.JSON_PROPERTY_MUTE_FIRST_RECOVERY_NOTIFICATION, + DowntimeChild.JSON_PROPERTY_NOTIFY_END_STATES, + DowntimeChild.JSON_PROPERTY_NOTIFY_END_TYPES, DowntimeChild.JSON_PROPERTY_PARENT_ID, DowntimeChild.JSON_PROPERTY_RECURRENCE, DowntimeChild.JSON_PROPERTY_SCOPE, @@ -76,6 +78,12 @@ public class DowntimeChild { "mute_first_recovery_notification"; private Boolean muteFirstRecoveryNotification; + public static final String JSON_PROPERTY_NOTIFY_END_STATES = "notify_end_states"; + private List notifyEndStates = null; + + public static final String JSON_PROPERTY_NOTIFY_END_TYPES = "notify_end_types"; + private List notifyEndTypes = null; + public static final String JSON_PROPERTY_PARENT_ID = "parent_id"; private JsonNullable parentId = JsonNullable.undefined(); @@ -342,6 +350,70 @@ public void setMuteFirstRecoveryNotification(Boolean muteFirstRecoveryNotificati this.muteFirstRecoveryNotification = muteFirstRecoveryNotification; } + public DowntimeChild notifyEndStates(List notifyEndStates) { + this.notifyEndStates = notifyEndStates; + return this; + } + + public DowntimeChild addNotifyEndStatesItem(NotifyEndState notifyEndStatesItem) { + if (this.notifyEndStates == null) { + this.notifyEndStates = new ArrayList<>(); + } + this.notifyEndStates.add(notifyEndStatesItem); + this.unparsed |= !notifyEndStatesItem.isValid(); + return this; + } + + /** + * States for which notify_end_types sends out notifications for. + * + * @return notifyEndStates + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NOTIFY_END_STATES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getNotifyEndStates() { + return notifyEndStates; + } + + public void setNotifyEndStates(List notifyEndStates) { + this.notifyEndStates = notifyEndStates; + } + + public DowntimeChild notifyEndTypes(List notifyEndTypes) { + this.notifyEndTypes = notifyEndTypes; + return this; + } + + public DowntimeChild addNotifyEndTypesItem(NotifyEndType notifyEndTypesItem) { + if (this.notifyEndTypes == null) { + this.notifyEndTypes = new ArrayList<>(); + } + this.notifyEndTypes.add(notifyEndTypesItem); + this.unparsed |= !notifyEndTypesItem.isValid(); + return this; + } + + /** + * If set, notifies if a monitor is in an alert-worthy state (ALERT, WARNING + * , or NO DATA) when this downtime expires or is canceled. Applied to + * monitors that change states during the downtime (such as from OK to ALERT + * , WARNING, or NO DATA), and to monitors that already have an + * alert-worthy state when downtime begins. + * + * @return notifyEndTypes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NOTIFY_END_TYPES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getNotifyEndTypes() { + return notifyEndTypes; + } + + public void setNotifyEndTypes(List notifyEndTypes) { + this.notifyEndTypes = notifyEndTypes; + } + public DowntimeChild parentId(Long parentId) { this.parentId = JsonNullable.of(parentId); return this; @@ -527,6 +599,8 @@ public boolean equals(Object o) { && Objects.equals(this.monitorTags, downtimeChild.monitorTags) && Objects.equals( this.muteFirstRecoveryNotification, downtimeChild.muteFirstRecoveryNotification) + && Objects.equals(this.notifyEndStates, downtimeChild.notifyEndStates) + && Objects.equals(this.notifyEndTypes, downtimeChild.notifyEndTypes) && Objects.equals(this.parentId, downtimeChild.parentId) && Objects.equals(this.recurrence, downtimeChild.recurrence) && Objects.equals(this.scope, downtimeChild.scope) @@ -549,6 +623,8 @@ public int hashCode() { monitorId, monitorTags, muteFirstRecoveryNotification, + notifyEndStates, + notifyEndTypes, parentId, recurrence, scope, @@ -574,6 +650,8 @@ public String toString() { sb.append(" muteFirstRecoveryNotification: ") .append(toIndentedString(muteFirstRecoveryNotification)) .append("\n"); + sb.append(" notifyEndStates: ").append(toIndentedString(notifyEndStates)).append("\n"); + sb.append(" notifyEndTypes: ").append(toIndentedString(notifyEndTypes)).append("\n"); sb.append(" parentId: ").append(toIndentedString(parentId)).append("\n"); sb.append(" recurrence: ").append(toIndentedString(recurrence)).append("\n"); sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); diff --git a/src/main/java/com/datadog/api/client/v1/model/NotifyEndState.java b/src/main/java/com/datadog/api/client/v1/model/NotifyEndState.java new file mode 100644 index 00000000000..19552e393da --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/NotifyEndState.java @@ -0,0 +1,94 @@ +/* + * 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.v1.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import java.util.Set; + +/** A notification end state. */ +@JsonSerialize(using = NotifyEndState.NotifyEndStateSerializer.class) +public class NotifyEndState { + + public static final NotifyEndState ALERT = new NotifyEndState("alert"); + public static final NotifyEndState NO_DATA = new NotifyEndState("no data"); + public static final NotifyEndState WARN = new NotifyEndState("warn"); + + private static final Set allowedValues = + new HashSet(Arrays.asList("alert", "no data", "warn")); + + private String value; + + public boolean isValid() { + return allowedValues.contains(this.value); + } + + NotifyEndState(String value) { + this.value = value; + } + + public static class NotifyEndStateSerializer extends StdSerializer { + public NotifyEndStateSerializer(Class t) { + super(t); + } + + public NotifyEndStateSerializer() { + this(null); + } + + @Override + public void serialize(NotifyEndState value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonValue + public String getValue() { + return this.value; + } + + public void setValue(String value) { + this.value = value; + } + + /** Return true if this NotifyEndState object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return this.value.equals(((NotifyEndState) o).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static NotifyEndState fromValue(String value) { + return new NotifyEndState(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/NotifyEndType.java b/src/main/java/com/datadog/api/client/v1/model/NotifyEndType.java new file mode 100644 index 00000000000..e7cd5a6a2dc --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/NotifyEndType.java @@ -0,0 +1,93 @@ +/* + * 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.v1.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import java.util.Set; + +/** A notification end type. */ +@JsonSerialize(using = NotifyEndType.NotifyEndTypeSerializer.class) +public class NotifyEndType { + + public static final NotifyEndType CANCELED = new NotifyEndType("canceled"); + public static final NotifyEndType EXPIRED = new NotifyEndType("expired"); + + private static final Set allowedValues = + new HashSet(Arrays.asList("canceled", "expired")); + + private String value; + + public boolean isValid() { + return allowedValues.contains(this.value); + } + + NotifyEndType(String value) { + this.value = value; + } + + public static class NotifyEndTypeSerializer extends StdSerializer { + public NotifyEndTypeSerializer(Class t) { + super(t); + } + + public NotifyEndTypeSerializer() { + this(null); + } + + @Override + public void serialize(NotifyEndType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonValue + public String getValue() { + return this.value; + } + + public void setValue(String value) { + this.value = value; + } + + /** Return true if this NotifyEndType object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return this.value.equals(((NotifyEndType) o).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static NotifyEndType fromValue(String value) { + return new NotifyEndType(value); + } +} diff --git a/src/test/resources/cassettes/features/v1/Schedule_a_downtime_once_a_year.freeze b/src/test/resources/cassettes/features/v1/Schedule_a_downtime_once_a_year.freeze index c4daf74f595..f41c357b11f 100644 --- a/src/test/resources/cassettes/features/v1/Schedule_a_downtime_once_a_year.freeze +++ b/src/test/resources/cassettes/features/v1/Schedule_a_downtime_once_a_year.freeze @@ -1 +1 @@ -2022-07-12T22:07:44.361Z \ No newline at end of file +2023-05-04T18:17:37.941Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Schedule_a_downtime_once_a_year.json b/src/test/resources/cassettes/features/v1/Schedule_a_downtime_once_a_year.json index 069927dbfae..acf94bcf445 100644 --- a/src/test/resources/cassettes/features/v1/Schedule_a_downtime_once_a_year.json +++ b/src/test/resources/cassettes/features/v1/Schedule_a_downtime_once_a_year.json @@ -3,7 +3,7 @@ "httpRequest": { "body": { "type": "JSON", - "json": "{\"end\":1657667264,\"message\":\"Test-Schedule_a_downtime_once_a_year-1657663664\",\"monitor_tags\":[\"tag0\"],\"mute_first_recovery_notification\":true,\"recurrence\":{\"period\":1,\"type\":\"years\"},\"scope\":[\"*\"],\"start\":1657663664,\"timezone\":\"Etc/UTC\"}" + "json": "{\"end\":1683227857,\"message\":\"Test-Schedule_a_downtime_once_a_year-1683224257\",\"monitor_tags\":[\"tag0\"],\"mute_first_recovery_notification\":true,\"notify_end_states\":[\"alert\",\"warn\"],\"notify_end_types\":[\"expired\"],\"recurrence\":{\"period\":1,\"type\":\"years\"},\"scope\":[\"*\"],\"start\":1683224257,\"timezone\":\"Etc/UTC\"}" }, "headers": {}, "method": "POST", @@ -12,7 +12,7 @@ "secure": true }, "httpResponse": { - "body": "{\"recurrence\":{\"until_date\":null,\"until_occurrences\":null,\"week_days\":null,\"type\":\"years\",\"period\":1},\"end\":1657667264,\"monitor_tags\":[\"tag0\"],\"child_id\":null,\"canceled\":null,\"monitor_id\":null,\"mute_first_recovery_notification\":true,\"created\":1657663664,\"org_id\":321813,\"modified\":1657663664,\"disabled\":false,\"start\":1657663664,\"creator_id\":1445416,\"parent_id\":null,\"timezone\":\"Etc/UTC\",\"active\":true,\"scope\":[\"*\"],\"message\":\"Test-Schedule_a_downtime_once_a_year-1657663664\",\"downtime_type\":0,\"id\":2082107265,\"updater_id\":null}", + "body": "{\"id\":2890657808,\"monitor_id\":null,\"org_id\":321813,\"start\":1683224257,\"end\":1683227857,\"canceled\":null,\"created\":1683224258,\"modified\":1683224258,\"message\":\"Test-Schedule_a_downtime_once_a_year-1683224257\",\"active\":true,\"disabled\":false,\"recurrence\":{\"type\":\"years\",\"period\":1,\"week_days\":null,\"until_occurrences\":null,\"until_date\":null},\"timezone\":\"Etc/UTC\",\"parent_id\":null,\"child_id\":null,\"creator_id\":1445416,\"updater_id\":null,\"downtime_type\":0,\"status\":\"active\",\"monitor_tags\":[\"tag0\"],\"mute_first_recovery_notification\":true,\"notify_end_types\":[\"expired\"],\"notify_end_states\":[\"alert\",\"warn\"],\"uuid\":\"f3d207ba-eaa7-11ed-8667-da7ad0900002\",\"scope\":[\"*\"]}\n", "headers": { "Content-Type": [ "application/json" @@ -27,18 +27,22 @@ "timeToLive": { "unlimited": true }, - "id": "30aaec19-23a8-99ea-e116-6631aca74d2a" + "id": "5e64524d-b39a-a3bf-4d78-57d27caec5ac" }, { "httpRequest": { "headers": {}, "method": "DELETE", - "path": "/api/v1/downtime/2082107265", + "path": "/api/v1/downtime/2890657808", "keepAlive": false, "secure": true }, "httpResponse": { - "headers": {}, + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, "statusCode": 204, "reasonPhrase": "No Content" }, @@ -48,6 +52,6 @@ "timeToLive": { "unlimited": true }, - "id": "afad726b-3db6-3119-27a3-b5c4da7a1b57" + "id": "12770b59-a1db-f4b4-7693-e0adc60e8c5b" } ] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Schedule_a_downtime_until_date.freeze b/src/test/resources/cassettes/features/v1/Schedule_a_downtime_until_date.freeze index b99e9dc6db6..fac4dcfa33e 100644 --- a/src/test/resources/cassettes/features/v1/Schedule_a_downtime_until_date.freeze +++ b/src/test/resources/cassettes/features/v1/Schedule_a_downtime_until_date.freeze @@ -1 +1 @@ -2022-07-12T22:07:45.319Z \ No newline at end of file +2023-05-04T18:17:39.364Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Schedule_a_downtime_until_date.json b/src/test/resources/cassettes/features/v1/Schedule_a_downtime_until_date.json index cc4087f6d9f..8e00a7cfbc0 100644 --- a/src/test/resources/cassettes/features/v1/Schedule_a_downtime_until_date.json +++ b/src/test/resources/cassettes/features/v1/Schedule_a_downtime_until_date.json @@ -3,7 +3,7 @@ "httpRequest": { "body": { "type": "JSON", - "json": "{\"end\":1657667265,\"message\":\"Test-Schedule_a_downtime_until_date-1657663665\",\"monitor_tags\":[\"tag0\"],\"mute_first_recovery_notification\":true,\"recurrence\":{\"period\":1,\"type\":\"weeks\",\"until_date\":1659478065,\"week_days\":[\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\"]},\"scope\":[\"*\"],\"start\":1657663665,\"timezone\":\"Etc/UTC\"}" + "json": "{\"end\":1683227859,\"message\":\"Test-Schedule_a_downtime_until_date-1683224259\",\"monitor_tags\":[\"tag0\"],\"mute_first_recovery_notification\":true,\"notify_end_states\":[\"alert\"],\"notify_end_types\":[\"canceled\"],\"recurrence\":{\"period\":1,\"type\":\"weeks\",\"until_date\":1685038659,\"week_days\":[\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\"]},\"scope\":[\"*\"],\"start\":1683224259,\"timezone\":\"Etc/UTC\"}" }, "headers": {}, "method": "POST", @@ -12,7 +12,7 @@ "secure": true }, "httpResponse": { - "body": "{\"recurrence\":{\"until_date\":1659478065,\"until_occurrences\":null,\"week_days\":[\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\"],\"type\":\"weeks\",\"period\":1},\"end\":1657667265,\"monitor_tags\":[\"tag0\"],\"child_id\":null,\"canceled\":null,\"monitor_id\":null,\"mute_first_recovery_notification\":true,\"created\":1657663665,\"org_id\":321813,\"modified\":1657663665,\"disabled\":false,\"start\":1657663665,\"creator_id\":1445416,\"parent_id\":null,\"timezone\":\"Etc/UTC\",\"active\":true,\"scope\":[\"*\"],\"message\":\"Test-Schedule_a_downtime_until_date-1657663665\",\"downtime_type\":0,\"id\":2082107326,\"updater_id\":null}", + "body": "{\"id\":2890657859,\"monitor_id\":null,\"org_id\":321813,\"start\":1683224259,\"end\":1683227859,\"canceled\":null,\"created\":1683224259,\"modified\":1683224259,\"message\":\"Test-Schedule_a_downtime_until_date-1683224259\",\"active\":true,\"disabled\":false,\"recurrence\":{\"type\":\"weeks\",\"period\":1,\"week_days\":[\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\"],\"until_occurrences\":null,\"until_date\":1685038659},\"timezone\":\"Etc/UTC\",\"parent_id\":null,\"child_id\":null,\"creator_id\":1445416,\"updater_id\":null,\"downtime_type\":0,\"status\":\"active\",\"monitor_tags\":[\"tag0\"],\"mute_first_recovery_notification\":true,\"notify_end_types\":[\"canceled\"],\"notify_end_states\":[\"alert\"],\"uuid\":\"f441cca8-eaa7-11ed-8c83-da7ad0900002\",\"scope\":[\"*\"]}\n", "headers": { "Content-Type": [ "application/json" @@ -27,18 +27,22 @@ "timeToLive": { "unlimited": true }, - "id": "12b7245e-c3be-818e-1c61-6283e42ced84" + "id": "1dc7c720-93e1-bb9f-e5bc-c134c2490a0f" }, { "httpRequest": { "headers": {}, "method": "DELETE", - "path": "/api/v1/downtime/2082107326", + "path": "/api/v1/downtime/2890657859", "keepAlive": false, "secure": true }, "httpResponse": { - "headers": {}, + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, "statusCode": 204, "reasonPhrase": "No Content" }, @@ -48,6 +52,6 @@ "timeToLive": { "unlimited": true }, - "id": "bba9256a-5216-06f6-03f5-c10857934d6a" + "id": "14de950b-93c3-8dc2-be91-42d4ed317fdd" } ] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v1/api/downtime_recurrence_payload_once_a_year.json b/src/test/resources/com/datadog/api/client/v1/api/downtime_recurrence_payload_once_a_year.json index 4f200a93d29..b4aef621419 100644 --- a/src/test/resources/com/datadog/api/client/v1/api/downtime_recurrence_payload_once_a_year.json +++ b/src/test/resources/com/datadog/api/client/v1/api/downtime_recurrence_payload_once_a_year.json @@ -11,5 +11,12 @@ "mute_first_recovery_notification": true, "monitor_tags": [ "tag0" + ], + "notify_end_states": [ + "alert", + "warn" + ], + "notify_end_types": [ + "expired" ] } diff --git a/src/test/resources/com/datadog/api/client/v1/api/downtime_recurrence_payload_until_date.json b/src/test/resources/com/datadog/api/client/v1/api/downtime_recurrence_payload_until_date.json index f5eff309479..0b064f0afdd 100644 --- a/src/test/resources/com/datadog/api/client/v1/api/downtime_recurrence_payload_until_date.json +++ b/src/test/resources/com/datadog/api/client/v1/api/downtime_recurrence_payload_until_date.json @@ -13,5 +13,11 @@ "mute_first_recovery_notification": true, "monitor_tags": [ "tag0" + ], + "notify_end_states": [ + "alert" + ], + "notify_end_types": [ + "canceled" ] } diff --git a/src/test/resources/com/datadog/api/client/v1/api/downtimes.feature b/src/test/resources/com/datadog/api/client/v1/api/downtimes.feature index 8335d9a24f7..100fe3841a8 100644 --- a/src/test/resources/com/datadog/api/client/v1/api/downtimes.feature +++ b/src/test/resources/com/datadog/api/client/v1/api/downtimes.feature @@ -175,7 +175,7 @@ Feature: Downtimes Scenario: Update a downtime returns "Bad Request" response Given new "UpdateDowntime" request And request contains "downtime_id" parameter from "REPLACE.ME" - And body with value {"disabled": false, "end": 1412793983, "message": "Message on the downtime", "monitor_id": 123456, "monitor_tags": ["*"], "mute_first_recovery_notification": false, "parent_id": 123, "recurrence": {"period": 1, "rrule": "FREQ=MONTHLY;BYSETPOS=3;BYDAY=WE;INTERVAL=1", "type": "weeks", "until_date": 1447786293, "until_occurrences": 2, "week_days": ["Mon", "Tue"]}, "scope": ["env:staging"], "start": 1412792983, "timezone": "America/New_York"} + And body with value {"disabled": false, "end": 1412793983, "message": "Message on the downtime", "monitor_id": 123456, "monitor_tags": ["*"], "mute_first_recovery_notification": false, "notify_end_states": ["alert", "no data", "warn"], "notify_end_types": ["canceled", "expired"], "parent_id": 123, "recurrence": {"period": 1, "rrule": "FREQ=MONTHLY;BYSETPOS=3;BYDAY=WE;INTERVAL=1", "type": "weeks", "until_date": 1447786293, "until_occurrences": 2, "week_days": ["Mon", "Tue"]}, "scope": ["env:staging"], "start": 1412792983, "timezone": "America/New_York"} When the request is sent Then the response status is 400 Bad Request @@ -183,7 +183,7 @@ Feature: Downtimes Scenario: Update a downtime returns "Downtime not found" response Given new "UpdateDowntime" request And request contains "downtime_id" parameter from "REPLACE.ME" - And body with value {"disabled": false, "end": 1412793983, "message": "Message on the downtime", "monitor_id": 123456, "monitor_tags": ["*"], "mute_first_recovery_notification": false, "parent_id": 123, "recurrence": {"period": 1, "rrule": "FREQ=MONTHLY;BYSETPOS=3;BYDAY=WE;INTERVAL=1", "type": "weeks", "until_date": 1447786293, "until_occurrences": 2, "week_days": ["Mon", "Tue"]}, "scope": ["env:staging"], "start": 1412792983, "timezone": "America/New_York"} + And body with value {"disabled": false, "end": 1412793983, "message": "Message on the downtime", "monitor_id": 123456, "monitor_tags": ["*"], "mute_first_recovery_notification": false, "notify_end_states": ["alert", "no data", "warn"], "notify_end_types": ["canceled", "expired"], "parent_id": 123, "recurrence": {"period": 1, "rrule": "FREQ=MONTHLY;BYSETPOS=3;BYDAY=WE;INTERVAL=1", "type": "weeks", "until_date": 1447786293, "until_occurrences": 2, "week_days": ["Mon", "Tue"]}, "scope": ["env:staging"], "start": 1412792983, "timezone": "America/New_York"} When the request is sent Then the response status is 404 Downtime not found