diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 11bca0724fa..6afc012501c 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -7255,6 +7255,13 @@ components: Monitor: description: Object describing a monitor. properties: + assets: + description: The list of monitor assets tied to a monitor which represents + key links for users to help take actions on monitor alerts (for example, + runbooks) + items: + $ref: '#/components/schemas/MonitorAsset' + type: array created: description: Timestamp of the monitor creation. format: date-time @@ -7338,6 +7345,64 @@ components: - type - query type: object + MonitorAsset: + description: 'Represents key links tied to a monitor to help users take action + on alerts (Runbooks, Dashboards, Workflows) + + This feature is in Preview and only available to users with the feature enabled.' + properties: + category: + $ref: '#/components/schemas/MonitorAssetCategory' + name: + description: Name for the monitor asset + example: Monitor Runbook + type: string + options: + description: Additional options that you can set on a monitor asset. + example: + hide_in_monitor_message: true + type: object + resource_key: + description: Represents the identifier of the internal datadog resource + that this asset represents. IDs in this field should be passed in as strings. + example: '12345' + type: string + resource_type: + $ref: '#/components/schemas/MonitorAssetResourceType' + template_variables: + description: Allows you to parameterize the url for the monitor asset. + example: + env: prod + region: us-east-1 + type: object + url: + description: Url link for the asset + example: https://app.datadoghq.com + type: string + required: + - name + - url + - category + type: object + MonitorAssetCategory: + description: Indicates the type of asset this entity represents on a monitor + enum: + - dashboard + - workflow + - runbook + example: dashboard + type: string + x-enum-varnames: + - DASHBOARD + - WORKFLOW + - RUNBOOK + MonitorAssetResourceType: + description: Type of internal datadog resource associated with a monitor asset + enum: + - notebook + type: string + x-enum-varnames: + - NOTEBOOK MonitorDeviceID: description: ID of the device the Synthetics monitor is running on. Same as `SyntheticsDeviceID`. @@ -8452,6 +8517,14 @@ components: MonitorUpdateRequest: description: Object describing a monitor update request. properties: + assets: + description: The list of monitor assets tied to a monitor, which represents + key links for users to help take actions on monitor alerts (for example, + runbooks) + items: + $ref: '#/components/schemas/MonitorAsset' + nullable: true + type: array created: description: Timestamp of the monitor creation. format: date-time @@ -31529,6 +31602,13 @@ paths: required: false schema: type: boolean + - description: If this argument is set to `true`, then the returned data includes + all assets tied to this monitor. + in: query + name: with_assets + required: false + schema: + type: boolean responses: '200': content: diff --git a/src/main/java/com/datadog/api/client/v1/api/MonitorsApi.java b/src/main/java/com/datadog/api/client/v1/api/MonitorsApi.java index 6ff102148a8..579febcb7b2 100644 --- a/src/main/java/com/datadog/api/client/v1/api/MonitorsApi.java +++ b/src/main/java/com/datadog/api/client/v1/api/MonitorsApi.java @@ -863,6 +863,7 @@ public CompletableFuture> deleteMonitorWithHttpInfoA public static class GetMonitorOptionalParameters { private String groupStates; private Boolean withDowntimes; + private Boolean withAssets; /** * Set groupStates. @@ -888,6 +889,18 @@ public GetMonitorOptionalParameters withDowntimes(Boolean withDowntimes) { this.withDowntimes = withDowntimes; return this; } + + /** + * Set withAssets. + * + * @param withAssets If this argument is set to true, then the returned data + * includes all assets tied to this monitor. (optional) + * @return GetMonitorOptionalParameters + */ + public GetMonitorOptionalParameters withAssets(Boolean withAssets) { + this.withAssets = withAssets; + return this; + } } /** @@ -981,6 +994,7 @@ public ApiResponse getMonitorWithHttpInfo( } String groupStates = parameters.groupStates; Boolean withDowntimes = parameters.withDowntimes; + Boolean withAssets = parameters.withAssets; // create path and map variables String localVarPath = "/api/v1/monitor/{monitor_id}" @@ -991,6 +1005,7 @@ public ApiResponse getMonitorWithHttpInfo( localVarQueryParams.addAll(apiClient.parameterToPairs("", "group_states", groupStates)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "with_downtimes", withDowntimes)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "with_assets", withAssets)); Invocation.Builder builder = apiClient.createBuilder( @@ -1035,6 +1050,7 @@ public CompletableFuture> getMonitorWithHttpInfoAsync( } String groupStates = parameters.groupStates; Boolean withDowntimes = parameters.withDowntimes; + Boolean withAssets = parameters.withAssets; // create path and map variables String localVarPath = "/api/v1/monitor/{monitor_id}" @@ -1045,6 +1061,7 @@ public CompletableFuture> getMonitorWithHttpInfoAsync( localVarQueryParams.addAll(apiClient.parameterToPairs("", "group_states", groupStates)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "with_downtimes", withDowntimes)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "with_assets", withAssets)); Invocation.Builder builder; try { diff --git a/src/main/java/com/datadog/api/client/v1/model/Monitor.java b/src/main/java/com/datadog/api/client/v1/model/Monitor.java index 4ac05d7a48e..a8f22ce4cfb 100644 --- a/src/main/java/com/datadog/api/client/v1/model/Monitor.java +++ b/src/main/java/com/datadog/api/client/v1/model/Monitor.java @@ -23,6 +23,7 @@ /** Object describing a monitor. */ @JsonPropertyOrder({ + Monitor.JSON_PROPERTY_ASSETS, Monitor.JSON_PROPERTY_CREATED, Monitor.JSON_PROPERTY_CREATOR, Monitor.JSON_PROPERTY_DELETED, @@ -46,6 +47,9 @@ value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") public class Monitor { @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ASSETS = "assets"; + private List assets = null; + public static final String JSON_PROPERTY_CREATED = "created"; private OffsetDateTime created; @@ -111,6 +115,40 @@ public Monitor( this.unparsed |= !type.isValid(); } + public Monitor assets(List assets) { + this.assets = assets; + for (MonitorAsset item : assets) { + this.unparsed |= item.unparsed; + } + return this; + } + + public Monitor addAssetsItem(MonitorAsset assetsItem) { + if (this.assets == null) { + this.assets = new ArrayList<>(); + } + this.assets.add(assetsItem); + this.unparsed |= assetsItem.unparsed; + return this; + } + + /** + * The list of monitor assets tied to a monitor which represents key links for users to help take + * actions on monitor alerts (for example, runbooks) + * + * @return assets + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ASSETS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getAssets() { + return assets; + } + + public void setAssets(List assets) { + this.assets = assets; + } + /** * Timestamp of the monitor creation. * @@ -560,7 +598,8 @@ public boolean equals(Object o) { return false; } Monitor monitor = (Monitor) o; - return Objects.equals(this.created, monitor.created) + return Objects.equals(this.assets, monitor.assets) + && Objects.equals(this.created, monitor.created) && Objects.equals(this.creator, monitor.creator) && Objects.equals(this.deleted, monitor.deleted) && Objects.equals(this.draftStatus, monitor.draftStatus) @@ -584,6 +623,7 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( + assets, created, creator, deleted, @@ -609,6 +649,7 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Monitor {\n"); + sb.append(" assets: ").append(toIndentedString(assets)).append("\n"); sb.append(" created: ").append(toIndentedString(created)).append("\n"); sb.append(" creator: ").append(toIndentedString(creator)).append("\n"); sb.append(" deleted: ").append(toIndentedString(deleted)).append("\n"); diff --git a/src/main/java/com/datadog/api/client/v1/model/MonitorAsset.java b/src/main/java/com/datadog/api/client/v1/model/MonitorAsset.java new file mode 100644 index 00000000000..df70e346ee5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/MonitorAsset.java @@ -0,0 +1,330 @@ +/* + * 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.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; + +/** + * Represents key links tied to a monitor to help users take action on alerts (Runbooks, Dashboards, + * Workflows) This feature is in Preview and only available to users with the feature enabled. + */ +@JsonPropertyOrder({ + MonitorAsset.JSON_PROPERTY_CATEGORY, + MonitorAsset.JSON_PROPERTY_NAME, + MonitorAsset.JSON_PROPERTY_OPTIONS, + MonitorAsset.JSON_PROPERTY_RESOURCE_KEY, + MonitorAsset.JSON_PROPERTY_RESOURCE_TYPE, + MonitorAsset.JSON_PROPERTY_TEMPLATE_VARIABLES, + MonitorAsset.JSON_PROPERTY_URL +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MonitorAsset { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CATEGORY = "category"; + private MonitorAssetCategory category; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_OPTIONS = "options"; + private Object options; + + public static final String JSON_PROPERTY_RESOURCE_KEY = "resource_key"; + private String resourceKey; + + public static final String JSON_PROPERTY_RESOURCE_TYPE = "resource_type"; + private MonitorAssetResourceType resourceType; + + public static final String JSON_PROPERTY_TEMPLATE_VARIABLES = "template_variables"; + private Object templateVariables; + + public static final String JSON_PROPERTY_URL = "url"; + private String url; + + public MonitorAsset() {} + + @JsonCreator + public MonitorAsset( + @JsonProperty(required = true, value = JSON_PROPERTY_CATEGORY) MonitorAssetCategory category, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_URL) String url) { + this.category = category; + this.unparsed |= !category.isValid(); + this.name = name; + this.url = url; + } + + public MonitorAsset category(MonitorAssetCategory category) { + this.category = category; + this.unparsed |= !category.isValid(); + return this; + } + + /** + * Indicates the type of asset this entity represents on a monitor + * + * @return category + */ + @JsonProperty(JSON_PROPERTY_CATEGORY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public MonitorAssetCategory getCategory() { + return category; + } + + public void setCategory(MonitorAssetCategory category) { + if (!category.isValid()) { + this.unparsed = true; + } + this.category = category; + } + + public MonitorAsset name(String name) { + this.name = name; + return this; + } + + /** + * Name for the monitor asset + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public MonitorAsset options(Object options) { + this.options = options; + return this; + } + + /** + * Additional options that you can set on a monitor asset. + * + * @return options + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_OPTIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Object getOptions() { + return options; + } + + public void setOptions(Object options) { + this.options = options; + } + + public MonitorAsset resourceKey(String resourceKey) { + this.resourceKey = resourceKey; + return this; + } + + /** + * Represents the identifier of the internal datadog resource that this asset represents. IDs in + * this field should be passed in as strings. + * + * @return resourceKey + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RESOURCE_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getResourceKey() { + return resourceKey; + } + + public void setResourceKey(String resourceKey) { + this.resourceKey = resourceKey; + } + + public MonitorAsset resourceType(MonitorAssetResourceType resourceType) { + this.resourceType = resourceType; + this.unparsed |= !resourceType.isValid(); + return this; + } + + /** + * Type of internal datadog resource associated with a monitor asset + * + * @return resourceType + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RESOURCE_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public MonitorAssetResourceType getResourceType() { + return resourceType; + } + + public void setResourceType(MonitorAssetResourceType resourceType) { + if (!resourceType.isValid()) { + this.unparsed = true; + } + this.resourceType = resourceType; + } + + public MonitorAsset templateVariables(Object templateVariables) { + this.templateVariables = templateVariables; + return this; + } + + /** + * Allows you to parameterize the url for the monitor asset. + * + * @return templateVariables + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TEMPLATE_VARIABLES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Object getTemplateVariables() { + return templateVariables; + } + + public void setTemplateVariables(Object templateVariables) { + this.templateVariables = templateVariables; + } + + public MonitorAsset url(String url) { + this.url = url; + return this; + } + + /** + * Url link for the asset + * + * @return url + */ + @JsonProperty(JSON_PROPERTY_URL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + /** + * 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 MonitorAsset + */ + @JsonAnySetter + public MonitorAsset 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 MonitorAsset object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MonitorAsset monitorAsset = (MonitorAsset) o; + return Objects.equals(this.category, monitorAsset.category) + && Objects.equals(this.name, monitorAsset.name) + && Objects.equals(this.options, monitorAsset.options) + && Objects.equals(this.resourceKey, monitorAsset.resourceKey) + && Objects.equals(this.resourceType, monitorAsset.resourceType) + && Objects.equals(this.templateVariables, monitorAsset.templateVariables) + && Objects.equals(this.url, monitorAsset.url) + && Objects.equals(this.additionalProperties, monitorAsset.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + category, + name, + options, + resourceKey, + resourceType, + templateVariables, + url, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MonitorAsset {\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).append("\n"); + sb.append(" resourceKey: ").append(toIndentedString(resourceKey)).append("\n"); + sb.append(" resourceType: ").append(toIndentedString(resourceType)).append("\n"); + sb.append(" templateVariables: ").append(toIndentedString(templateVariables)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).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/v1/model/MonitorAssetCategory.java b/src/main/java/com/datadog/api/client/v1/model/MonitorAssetCategory.java new file mode 100644 index 00000000000..1e8ffbe28c4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/MonitorAssetCategory.java @@ -0,0 +1,57 @@ +/* + * 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.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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.Set; + +/** Indicates the type of asset this entity represents on a monitor */ +@JsonSerialize(using = MonitorAssetCategory.MonitorAssetCategorySerializer.class) +public class MonitorAssetCategory extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("dashboard", "workflow", "runbook")); + + public static final MonitorAssetCategory DASHBOARD = new MonitorAssetCategory("dashboard"); + public static final MonitorAssetCategory WORKFLOW = new MonitorAssetCategory("workflow"); + public static final MonitorAssetCategory RUNBOOK = new MonitorAssetCategory("runbook"); + + MonitorAssetCategory(String value) { + super(value, allowedValues); + } + + public static class MonitorAssetCategorySerializer extends StdSerializer { + public MonitorAssetCategorySerializer(Class t) { + super(t); + } + + public MonitorAssetCategorySerializer() { + this(null); + } + + @Override + public void serialize( + MonitorAssetCategory value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static MonitorAssetCategory fromValue(String value) { + return new MonitorAssetCategory(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/MonitorAssetResourceType.java b/src/main/java/com/datadog/api/client/v1/model/MonitorAssetResourceType.java new file mode 100644 index 00000000000..d12761a82c4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/MonitorAssetResourceType.java @@ -0,0 +1,55 @@ +/* + * 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.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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.Set; + +/** Type of internal datadog resource associated with a monitor asset */ +@JsonSerialize(using = MonitorAssetResourceType.MonitorAssetResourceTypeSerializer.class) +public class MonitorAssetResourceType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("notebook")); + + public static final MonitorAssetResourceType NOTEBOOK = new MonitorAssetResourceType("notebook"); + + MonitorAssetResourceType(String value) { + super(value, allowedValues); + } + + public static class MonitorAssetResourceTypeSerializer + extends StdSerializer { + public MonitorAssetResourceTypeSerializer(Class t) { + super(t); + } + + public MonitorAssetResourceTypeSerializer() { + this(null); + } + + @Override + public void serialize( + MonitorAssetResourceType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static MonitorAssetResourceType fromValue(String value) { + return new MonitorAssetResourceType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/MonitorUpdateRequest.java b/src/main/java/com/datadog/api/client/v1/model/MonitorUpdateRequest.java index 9a968a10f41..876a319beae 100644 --- a/src/main/java/com/datadog/api/client/v1/model/MonitorUpdateRequest.java +++ b/src/main/java/com/datadog/api/client/v1/model/MonitorUpdateRequest.java @@ -22,6 +22,7 @@ /** Object describing a monitor update request. */ @JsonPropertyOrder({ + MonitorUpdateRequest.JSON_PROPERTY_ASSETS, MonitorUpdateRequest.JSON_PROPERTY_CREATED, MonitorUpdateRequest.JSON_PROPERTY_CREATOR, MonitorUpdateRequest.JSON_PROPERTY_DELETED, @@ -44,6 +45,9 @@ value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") public class MonitorUpdateRequest { @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ASSETS = "assets"; + private JsonNullable> assets = JsonNullable.>undefined(); + public static final String JSON_PROPERTY_CREATED = "created"; private OffsetDateTime created; @@ -95,6 +99,50 @@ public class MonitorUpdateRequest { public static final String JSON_PROPERTY_TYPE = "type"; private MonitorType type; + public MonitorUpdateRequest assets(List assets) { + this.assets = JsonNullable.>of(assets); + return this; + } + + public MonitorUpdateRequest addAssetsItem(MonitorAsset assetsItem) { + if (this.assets == null || !this.assets.isPresent()) { + this.assets = JsonNullable.>of(new ArrayList<>()); + } + try { + this.assets.get().add(assetsItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * The list of monitor assets tied to a monitor, which represents key links for users to help take + * actions on monitor alerts (for example, runbooks) + * + * @return assets + */ + @jakarta.annotation.Nullable + @JsonIgnore + public List getAssets() { + return assets.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ASSETS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> getAssets_JsonNullable() { + return assets; + } + + @JsonProperty(JSON_PROPERTY_ASSETS) + public void setAssets_JsonNullable(JsonNullable> assets) { + this.assets = assets; + } + + public void setAssets(List assets) { + this.assets = JsonNullable.>of(assets); + } + /** * Timestamp of the monitor creation. * @@ -513,7 +561,8 @@ public boolean equals(Object o) { return false; } MonitorUpdateRequest monitorUpdateRequest = (MonitorUpdateRequest) o; - return Objects.equals(this.created, monitorUpdateRequest.created) + return Objects.equals(this.assets, monitorUpdateRequest.assets) + && Objects.equals(this.created, monitorUpdateRequest.created) && Objects.equals(this.creator, monitorUpdateRequest.creator) && Objects.equals(this.deleted, monitorUpdateRequest.deleted) && Objects.equals(this.draftStatus, monitorUpdateRequest.draftStatus) @@ -536,6 +585,7 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( + assets, created, creator, deleted, @@ -560,6 +610,7 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class MonitorUpdateRequest {\n"); + sb.append(" assets: ").append(toIndentedString(assets)).append("\n"); sb.append(" created: ").append(toIndentedString(created)).append("\n"); sb.append(" creator: ").append(toIndentedString(creator)).append("\n"); sb.append(" deleted: ").append(toIndentedString(deleted)).append("\n"); diff --git a/src/test/resources/com/datadog/api/client/v1/api/monitors.feature b/src/test/resources/com/datadog/api/client/v1/api/monitors.feature index 64e72f698b4..249e41a3176 100644 --- a/src/test/resources/com/datadog/api/client/v1/api/monitors.feature +++ b/src/test/resources/com/datadog/api/client/v1/api/monitors.feature @@ -169,7 +169,7 @@ Feature: Monitors Scenario: Edit a monitor returns "Bad Request" response Given new "UpdateMonitor" request And request contains "monitor_id" parameter from "REPLACE.ME" - And body with value {"draft_status": "published", "options": {"evaluation_delay": null, "include_tags": true, "min_failure_duration": 0, "min_location_failed": 1, "new_group_delay": null, "new_host_delay": 300, "no_data_timeframe": null, "notification_preset_name": "show_all", "notify_audit": false, "notify_by": [], "on_missing_data": "default", "renotify_interval": null, "renotify_occurrences": null, "renotify_statuses": ["alert"], "scheduling_options": {"custom_schedule": {"recurrences": [{"rrule": "FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR", "start": "2023-08-31T16:30:00", "timezone": "Europe/Paris"}]}, "evaluation_window": {"day_starts": "04:00", "hour_starts": 0, "month_starts": 1, "timezone": "Europe/Paris"}}, "synthetics_check_id": null, "threshold_windows": {"recovery_window": null, "trigger_window": null}, "thresholds": {"critical_recovery": null, "ok": null, "unknown": null, "warning": null, "warning_recovery": null}, "timeout_h": null, "variables": [{"compute": {"aggregation": "avg", "interval": 60000, "metric": "@duration"}, "data_source": "rum", "group_by": [{"facet": "status", "limit": 10, "sort": {"aggregation": "avg", "order": "desc"}}], "indexes": ["days-3", "days-7"], "name": "query_errors", "search": {"query": "service:query"}}]}, "priority": null, "restricted_roles": [], "tags": [], "type": "query alert"} + And body with value {"assets": [{"category": "dashboard", "name": "Monitor Runbook", "options": {"hide_in_monitor_message": true}, "resource_key": "12345", "resource_type": "notebook", "template_variables": {"env": "prod", "region": "us-east-1"}, "url": "https://app.datadoghq.com"}], "draft_status": "published", "options": {"evaluation_delay": null, "include_tags": true, "min_failure_duration": 0, "min_location_failed": 1, "new_group_delay": null, "new_host_delay": 300, "no_data_timeframe": null, "notification_preset_name": "show_all", "notify_audit": false, "notify_by": [], "on_missing_data": "default", "renotify_interval": null, "renotify_occurrences": null, "renotify_statuses": ["alert"], "scheduling_options": {"custom_schedule": {"recurrences": [{"rrule": "FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR", "start": "2023-08-31T16:30:00", "timezone": "Europe/Paris"}]}, "evaluation_window": {"day_starts": "04:00", "hour_starts": 0, "month_starts": 1, "timezone": "Europe/Paris"}}, "synthetics_check_id": null, "threshold_windows": {"recovery_window": null, "trigger_window": null}, "thresholds": {"critical_recovery": null, "ok": null, "unknown": null, "warning": null, "warning_recovery": null}, "timeout_h": null, "variables": [{"compute": {"aggregation": "avg", "interval": 60000, "metric": "@duration"}, "data_source": "rum", "group_by": [{"facet": "status", "limit": 10, "sort": {"aggregation": "avg", "order": "desc"}}], "indexes": ["days-3", "days-7"], "name": "query_errors", "search": {"query": "service:query"}}]}, "priority": null, "restricted_roles": [], "tags": [], "type": "query alert"} When the request is sent Then the response status is 400 Bad Request