diff --git a/.apigentools-info b/.apigentools-info index 01046042a64..c4f33b9edde 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.4", - "regenerated": "2023-04-28 14:00:24.272893", - "spec_repo_commit": "108ecd5c" + "regenerated": "2023-05-01 17:21:10.702976", + "spec_repo_commit": "4d58341b" }, "v2": { "apigentools_version": "1.6.4", - "regenerated": "2023-04-28 14:00:24.286050", - "spec_repo_commit": "108ecd5c" + "regenerated": "2023-05-01 17:21:10.716036", + "spec_repo_commit": "4d58341b" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 6370b0cec4b..cf1a971769b 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -10222,6 +10222,9 @@ components: description: Use the SLO and uptime widget to track your SLOs (Service Level Objectives) and uptime on screenboards and timeboards. properties: + additional_query_filters: + description: Additional filters applied to the SLO query. + type: string global_time_target: description: Defined global time target. type: string diff --git a/examples/v1/dashboards/CreateDashboard_173805046.java b/examples/v1/dashboards/CreateDashboard_173805046.java index 73de4478bc6..79abc3b934e 100644 --- a/examples/v1/dashboards/CreateDashboard_173805046.java +++ b/examples/v1/dashboards/CreateDashboard_173805046.java @@ -43,7 +43,8 @@ public static void main(String[] args) { .sloId(SLO_DATA_0_ID) .showErrorBudget(true) .viewMode(WidgetViewMode.OVERALL) - .globalTimeTarget("0"))))) + .globalTimeTarget("0") + .additionalQueryFilters("!host:excluded_host"))))) .layoutType(DashboardLayoutType.FREE) .isReadOnly(false); diff --git a/src/main/java/com/datadog/api/client/v1/model/SLOWidgetDefinition.java b/src/main/java/com/datadog/api/client/v1/model/SLOWidgetDefinition.java index f32514fe0a5..deaba72c054 100644 --- a/src/main/java/com/datadog/api/client/v1/model/SLOWidgetDefinition.java +++ b/src/main/java/com/datadog/api/client/v1/model/SLOWidgetDefinition.java @@ -20,6 +20,7 @@ * screenboards and timeboards. */ @JsonPropertyOrder({ + SLOWidgetDefinition.JSON_PROPERTY_ADDITIONAL_QUERY_FILTERS, SLOWidgetDefinition.JSON_PROPERTY_GLOBAL_TIME_TARGET, SLOWidgetDefinition.JSON_PROPERTY_SHOW_ERROR_BUDGET, SLOWidgetDefinition.JSON_PROPERTY_SLO_ID, @@ -35,6 +36,9 @@ value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") public class SLOWidgetDefinition { @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ADDITIONAL_QUERY_FILTERS = "additional_query_filters"; + private String additionalQueryFilters; + public static final String JSON_PROPERTY_GLOBAL_TIME_TARGET = "global_time_target"; private String globalTimeTarget; @@ -76,6 +80,27 @@ public SLOWidgetDefinition( this.viewType = viewType; } + public SLOWidgetDefinition additionalQueryFilters(String additionalQueryFilters) { + this.additionalQueryFilters = additionalQueryFilters; + return this; + } + + /** + * Additional filters applied to the SLO query. + * + * @return additionalQueryFilters + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ADDITIONAL_QUERY_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAdditionalQueryFilters() { + return additionalQueryFilters; + } + + public void setAdditionalQueryFilters(String additionalQueryFilters) { + this.additionalQueryFilters = additionalQueryFilters; + } + public SLOWidgetDefinition globalTimeTarget(String globalTimeTarget) { this.globalTimeTarget = globalTimeTarget; return this; @@ -315,7 +340,8 @@ public boolean equals(Object o) { return false; } SLOWidgetDefinition sloWidgetDefinition = (SLOWidgetDefinition) o; - return Objects.equals(this.globalTimeTarget, sloWidgetDefinition.globalTimeTarget) + return Objects.equals(this.additionalQueryFilters, sloWidgetDefinition.additionalQueryFilters) + && Objects.equals(this.globalTimeTarget, sloWidgetDefinition.globalTimeTarget) && Objects.equals(this.showErrorBudget, sloWidgetDefinition.showErrorBudget) && Objects.equals(this.sloId, sloWidgetDefinition.sloId) && Objects.equals(this.timeWindows, sloWidgetDefinition.timeWindows) @@ -330,6 +356,7 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( + additionalQueryFilters, globalTimeTarget, showErrorBudget, sloId, @@ -346,6 +373,9 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class SLOWidgetDefinition {\n"); + sb.append(" additionalQueryFilters: ") + .append(toIndentedString(additionalQueryFilters)) + .append("\n"); sb.append(" globalTimeTarget: ").append(toIndentedString(globalTimeTarget)).append("\n"); sb.append(" showErrorBudget: ").append(toIndentedString(showErrorBudget)).append("\n"); sb.append(" sloId: ").append(toIndentedString(sloId)).append("\n"); diff --git a/src/test/resources/cassettes/features/v1/Create_a_new_dashboard_with_slo_widget.freeze b/src/test/resources/cassettes/features/v1/Create_a_new_dashboard_with_slo_widget.freeze index 3bd4563bcb0..422ceb22087 100644 --- a/src/test/resources/cassettes/features/v1/Create_a_new_dashboard_with_slo_widget.freeze +++ b/src/test/resources/cassettes/features/v1/Create_a_new_dashboard_with_slo_widget.freeze @@ -1 +1 @@ -2022-01-06T00:50:40.134Z \ No newline at end of file +2023-05-01T17:17:36.249Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Create_a_new_dashboard_with_slo_widget.json b/src/test/resources/cassettes/features/v1/Create_a_new_dashboard_with_slo_widget.json index 4253106e6d3..120ff02bdec 100644 --- a/src/test/resources/cassettes/features/v1/Create_a_new_dashboard_with_slo_widget.json +++ b/src/test/resources/cassettes/features/v1/Create_a_new_dashboard_with_slo_widget.json @@ -3,7 +3,7 @@ "httpRequest": { "body": { "type": "JSON", - "json": "{\"name\": \"Test-Create_a_new_dashboard_with_slo_widget-1641430240\", \"query\": {\"denominator\": \"sum:httpservice.hits{!code:3xx}.as_count()\", \"numerator\": \"sum:httpservice.hits{code:2xx}.as_count()\"}, \"thresholds\": [{\"target\": 95.0, \"timeframe\": \"7d\", \"warning\": 98.0}], \"type\": \"metric\"}" + "json": "{\"name\": \"Test-Create_a_new_dashboard_with_slo_widget-1682961456\", \"query\": {\"denominator\": \"sum:httpservice.hits{!code:3xx}.as_count()\", \"numerator\": \"sum:httpservice.hits{code:2xx}.as_count()\"}, \"thresholds\": [{\"target\": 95.0, \"timeframe\": \"7d\", \"warning\": 98.0}], \"type\": \"metric\"}" }, "headers": {}, "method": "POST", @@ -12,7 +12,7 @@ "secure": true }, "httpResponse": { - "body": "{\"data\":[{\"description\":\"\",\"monitor_tags\":[],\"creator\":{\"handle\":\"frog@datadoghq.com\",\"name\":null,\"email\":\"frog@datadoghq.com\"},\"thresholds\":[{\"warning\":98,\"warning_display\":\"98.\",\"target\":95,\"target_display\":\"95.\",\"timeframe\":\"7d\"}],\"type_id\":1,\"query\":{\"denominator\":\"sum:httpservice.hits{!code:3xx}.as_count()\",\"numerator\":\"sum:httpservice.hits{code:2xx}.as_count()\"},\"id\":\"dda0096b964856baa7e4cae291511f97\",\"name\":\"Test-Create_a_new_dashboard_with_slo_widget-1641430240\",\"created_at\":1641430240,\"tags\":[],\"modified_at\":1641430240,\"type\":\"metric\"}],\"error\":null}", + "body": "{\"data\":[{\"id\":\"91c07f67612e5483b52e566f81ef101c\",\"name\":\"Test-Create_a_new_dashboard_with_slo_widget-1682961456\",\"tags\":[],\"monitor_tags\":[],\"thresholds\":[{\"timeframe\":\"7d\",\"target\":95.0,\"target_display\":\"95.\",\"warning\":98.0,\"warning_display\":\"98.\"}],\"type\":\"metric\",\"type_id\":1,\"description\":\"\",\"timeframe\":\"7d\",\"warning_threshold\":98,\"target_threshold\":95,\"query\":{\"denominator\":\"sum:httpservice.hits{!code:3xx}.as_count()\",\"numerator\":\"sum:httpservice.hits{code:2xx}.as_count()\"},\"creator\":{\"name\":null,\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\"},\"created_at\":1682961456,\"modified_at\":1682961456}],\"error\":null}\n", "headers": { "Content-Type": [ "application/json" @@ -27,13 +27,13 @@ "timeToLive": { "unlimited": true }, - "id": "43e9b1d4-52be-68d6-b2e2-e39b09a627fd" + "id": "c24624df-97ba-fa49-ff8f-d6666103cd35" }, { "httpRequest": { "body": { "type": "JSON", - "json": "{\"description\":\"\",\"is_read_only\":false,\"layout_type\":\"free\",\"notify_list\":[],\"template_variables\":[],\"title\":\"Test-Create_a_new_dashboard_with_slo_widget-1641430240\",\"widgets\":[{\"definition\":{\"global_time_target\":\"0\",\"show_error_budget\":true,\"slo_id\":\"dda0096b964856baa7e4cae291511f97\",\"time_windows\":[\"7d\"],\"title_align\":\"left\",\"title_size\":\"16\",\"type\":\"slo\",\"view_mode\":\"overall\",\"view_type\":\"detail\"},\"layout\":{\"height\":21,\"width\":60,\"x\":0,\"y\":0}}]}" + "json": "{\"description\":\"\",\"is_read_only\":false,\"layout_type\":\"free\",\"notify_list\":[],\"template_variables\":[],\"title\":\"Test-Create_a_new_dashboard_with_slo_widget-1682961456\",\"widgets\":[{\"definition\":{\"additional_query_filters\":\"!host:excluded_host\",\"global_time_target\":\"0\",\"show_error_budget\":true,\"slo_id\":\"91c07f67612e5483b52e566f81ef101c\",\"time_windows\":[\"7d\"],\"title_align\":\"left\",\"title_size\":\"16\",\"type\":\"slo\",\"view_mode\":\"overall\",\"view_type\":\"detail\"},\"layout\":{\"height\":21,\"width\":60,\"x\":0,\"y\":0}}]}" }, "headers": {}, "method": "POST", @@ -42,7 +42,7 @@ "secure": true }, "httpResponse": { - "body": "{\"notify_list\":[],\"description\":\"\",\"restricted_roles\":[],\"author_name\":null,\"template_variables\":[],\"is_read_only\":false,\"id\":\"m5p-qa8-p3i\",\"title\":\"Test-Create_a_new_dashboard_with_slo_widget-1641430240\",\"url\":\"/dashboard/m5p-qa8-p3i/test-createanewdashboardwithslowidget-1641430240\",\"created_at\":\"2022-01-06T00:50:40.523050+00:00\",\"modified_at\":\"2022-01-06T00:50:40.523050+00:00\",\"author_handle\":\"frog@datadoghq.com\",\"widgets\":[{\"definition\":{\"time_windows\":[\"7d\"],\"title_size\":\"16\",\"show_error_budget\":true,\"view_type\":\"detail\",\"title_align\":\"left\",\"slo_id\":\"dda0096b964856baa7e4cae291511f97\",\"view_mode\":\"overall\",\"global_time_target\":\"0\",\"type\":\"slo\"},\"layout\":{\"y\":0,\"width\":60,\"x\":0,\"height\":21},\"id\":8329644624424358}],\"layout_type\":\"free\"}", + "body": "{\"id\":\"s2k-6ak-vwz\",\"title\":\"Test-Create_a_new_dashboard_with_slo_widget-1682961456\",\"description\":\"\",\"author_handle\":\"frog@datadoghq.com\",\"author_name\":null,\"layout_type\":\"free\",\"url\":\"/dashboard/s2k-6ak-vwz/test-createanewdashboardwithslowidget-1682961456\",\"is_read_only\":false,\"template_variables\":[],\"widgets\":[{\"definition\":{\"additional_query_filters\":\"!host:excluded_host\",\"global_time_target\":\"0\",\"show_error_budget\":true,\"slo_id\":\"91c07f67612e5483b52e566f81ef101c\",\"time_windows\":[\"7d\"],\"title_align\":\"left\",\"title_size\":\"16\",\"type\":\"slo\",\"view_mode\":\"overall\",\"view_type\":\"detail\"},\"layout\":{\"height\":21,\"width\":60,\"x\":0,\"y\":0},\"id\":5115893324048055}],\"notify_list\":[],\"created_at\":\"2023-05-01T17:17:36.970593+00:00\",\"modified_at\":\"2023-05-01T17:17:36.970593+00:00\",\"restricted_roles\":[]}\n", "headers": { "Content-Type": [ "application/json" @@ -57,18 +57,18 @@ "timeToLive": { "unlimited": true }, - "id": "260ff849-762d-6195-4538-cf71b8e46249" + "id": "2fe18e53-ff2f-81c9-9c23-8af6670191cc" }, { "httpRequest": { "headers": {}, "method": "DELETE", - "path": "/api/v1/dashboard/m5p-qa8-p3i", + "path": "/api/v1/dashboard/s2k-6ak-vwz", "keepAlive": false, "secure": true }, "httpResponse": { - "body": "{\"deleted_dashboard_id\":\"m5p-qa8-p3i\"}", + "body": "{\"deleted_dashboard_id\":\"s2k-6ak-vwz\"}\n", "headers": { "Content-Type": [ "application/json" @@ -83,18 +83,18 @@ "timeToLive": { "unlimited": true }, - "id": "adf38327-4ad2-314d-7f68-72ffd80219b9" + "id": "8882dea9-e8e3-b4c3-b4b5-4c43d22e28a1" }, { "httpRequest": { "headers": {}, "method": "DELETE", - "path": "/api/v1/slo/dda0096b964856baa7e4cae291511f97", + "path": "/api/v1/slo/91c07f67612e5483b52e566f81ef101c", "keepAlive": false, "secure": true }, "httpResponse": { - "body": "{\"data\":[\"dda0096b964856baa7e4cae291511f97\"],\"error\":null}", + "body": "{\"data\":[\"91c07f67612e5483b52e566f81ef101c\"],\"error\":null}\n", "headers": { "Content-Type": [ "application/json" @@ -109,6 +109,6 @@ "timeToLive": { "unlimited": true }, - "id": "15dceac8-042f-9f8d-56ac-7501b8e6635d" + "id": "8bcec8dc-e840-8e58-62e2-dd0519f24606" } ] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v1/api/dashboards.feature b/src/test/resources/com/datadog/api/client/v1/api/dashboards.feature index b00fe078ffd..ce57b53f297 100644 --- a/src/test/resources/com/datadog/api/client/v1/api/dashboards.feature +++ b/src/test/resources/com/datadog/api/client/v1/api/dashboards.feature @@ -532,6 +532,7 @@ Feature: Dashboards Then the response status is 200 OK And the response "widgets[0].definition.type" is equal to "slo" And the response "widgets[0].definition.slo_id" is equal to "{{ slo.data[0].id }}" + And the response "widgets[0].definition.additional_query_filters" is equal to "!host:excluded_host" @team:DataDog/dashboards Scenario: Create a new dashboard with sunburst widget and metrics data diff --git a/src/test/resources/com/datadog/api/client/v1/api/dashboards_json_payload/slo_widget.json b/src/test/resources/com/datadog/api/client/v1/api/dashboards_json_payload/slo_widget.json index 1993c70a1cb..ae88c387a0b 100644 --- a/src/test/resources/com/datadog/api/client/v1/api/dashboards_json_payload/slo_widget.json +++ b/src/test/resources/com/datadog/api/client/v1/api/dashboards_json_payload/slo_widget.json @@ -20,7 +20,8 @@ "slo_id":"{{ slo.data[0].id }}", "show_error_budget":true, "view_mode":"overall", - "global_time_target":"0" + "global_time_target":"0", + "additional_query_filters": "!host:excluded_host" } } ],