From ae3f6ab3dcdf114f1b67da5cf3d134a835e94729 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 30 Jun 2025 17:07:13 +0000 Subject: [PATCH] Regenerate client from commit d8e7ee77 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v1/openapi.yaml | 13 ++ .../CreateDashboard_1751391372.java | 59 +++++++ .../CreatePublicDashboard_1668947073.java | 49 ++++++ .../UpdatePublicDashboard_1708268778.java | 48 ++++++ .../v1/model/DashboardTemplateVariable.java | 43 +++++- .../SelectableTemplateVariableItems.java | 40 ++++- ...able_type_field_returns_OK_response.freeze | 1 + ...riable_type_field_returns_OK_response.json | 58 +++++++ ...mplate_variable_returns_OK_response.freeze | 1 + ...template_variable_returns_OK_response.json | 114 ++++++++++++++ ...e_template_vars_returns_OK_response.freeze | 1 + ...ble_template_vars_returns_OK_response.json | 144 ++++++++++++++++++ .../api/client/v1/api/dashboards.feature | 46 +++++- 14 files changed, 615 insertions(+), 10 deletions(-) create mode 100644 examples/v1/dashboards/CreateDashboard_1751391372.java create mode 100644 examples/v1/dashboards/CreatePublicDashboard_1668947073.java create mode 100644 examples/v1/dashboards/UpdatePublicDashboard_1708268778.java create mode 100644 src/test/resources/cassettes/features/v1/Create_a_new_dashboard_with_template_variable_type_field_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v1/Create_a_new_dashboard_with_template_variable_type_field_returns_OK_response.json create mode 100644 src/test/resources/cassettes/features/v1/Create_a_shared_dashboard_with_a_group_template_variable_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v1/Create_a_shared_dashboard_with_a_group_template_variable_returns_OK_response.json create mode 100644 src/test/resources/cassettes/features/v1/Update_a_shared_dashboard_with_selectable_template_vars_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v1/Update_a_shared_dashboard_with_selectable_template_vars_returns_OK_response.json diff --git a/.apigentools-info b/.apigentools-info index 7979c1a0f92..a99c312e325 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-06-30 10:29:37.915889", - "spec_repo_commit": "be63084a" + "regenerated": "2025-06-30 17:05:05.986606", + "spec_repo_commit": "d8e7ee77" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-06-30 10:29:37.934362", - "spec_repo_commit": "be63084a" + "regenerated": "2025-06-30 17:05:06.003684", + "spec_repo_commit": "d8e7ee77" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index be8276b7592..8731af7d928 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -1550,6 +1550,13 @@ components: example: host nullable: true type: string + type: + description: The type of variable. This is to differentiate between filter + variables (interpolated in query) and group by variables (interpolated + into group by). + example: group + nullable: true + type: string required: - name type: object @@ -12578,6 +12585,12 @@ components: prefix: description: The tag/attribute key associated with the template variable. type: string + type: + description: The type of variable. This is to differentiate between filter + variables (interpolated in query) and group by variables (interpolated + into group by). + nullable: true + type: string visible_tags: description: List of visible tag values on the shared dashboard. items: diff --git a/examples/v1/dashboards/CreateDashboard_1751391372.java b/examples/v1/dashboards/CreateDashboard_1751391372.java new file mode 100644 index 00000000000..f14ba13e1cd --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_1751391372.java @@ -0,0 +1,59 @@ +// Create a new dashboard with template variable type field returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v1.api.DashboardsApi; +import com.datadog.api.client.v1.model.Dashboard; +import com.datadog.api.client.v1.model.DashboardLayoutType; +import com.datadog.api.client.v1.model.DashboardReflowType; +import com.datadog.api.client.v1.model.DashboardTemplateVariable; +import com.datadog.api.client.v1.model.HostMapRequest; +import com.datadog.api.client.v1.model.HostMapWidgetDefinition; +import com.datadog.api.client.v1.model.HostMapWidgetDefinitionRequests; +import com.datadog.api.client.v1.model.HostMapWidgetDefinitionType; +import com.datadog.api.client.v1.model.Widget; +import com.datadog.api.client.v1.model.WidgetDefinition; +import java.util.Arrays; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + DashboardsApi apiInstance = new DashboardsApi(defaultClient); + + Dashboard body = + new Dashboard() + .description(null) + .layoutType(DashboardLayoutType.ORDERED) + .reflowType(DashboardReflowType.AUTO) + .templateVariables( + Collections.singletonList( + new DashboardTemplateVariable() + .availableValues(Arrays.asList("service", "datacenter", "env")) + .defaults(Arrays.asList("service", "datacenter")) + .name("group_by_var") + .type("group"))) + .title("") + .widgets( + Collections.singletonList( + new Widget() + .definition( + new WidgetDefinition( + new HostMapWidgetDefinition() + .requests( + new HostMapWidgetDefinitionRequests() + .fill(new HostMapRequest().q("avg:system.cpu.user{*}"))) + .type(HostMapWidgetDefinitionType.HOSTMAP))))); + + try { + Dashboard result = apiInstance.createDashboard(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DashboardsApi#createDashboard"); + 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/v1/dashboards/CreatePublicDashboard_1668947073.java b/examples/v1/dashboards/CreatePublicDashboard_1668947073.java new file mode 100644 index 00000000000..e3a8b16b130 --- /dev/null +++ b/examples/v1/dashboards/CreatePublicDashboard_1668947073.java @@ -0,0 +1,49 @@ +// Create a shared dashboard with a group template variable returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v1.api.DashboardsApi; +import com.datadog.api.client.v1.model.DashboardGlobalTime; +import com.datadog.api.client.v1.model.DashboardGlobalTimeLiveSpan; +import com.datadog.api.client.v1.model.DashboardShareType; +import com.datadog.api.client.v1.model.DashboardType; +import com.datadog.api.client.v1.model.SelectableTemplateVariableItems; +import com.datadog.api.client.v1.model.SharedDashboard; +import java.util.Arrays; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + DashboardsApi apiInstance = new DashboardsApi(defaultClient); + + // there is a valid "dashboard" in the system + String DASHBOARD_ID = System.getenv("DASHBOARD_ID"); + + SharedDashboard body = + new SharedDashboard() + .dashboardId(DASHBOARD_ID) + .dashboardType(DashboardType.CUSTOM_TIMEBOARD) + .shareType(DashboardShareType.OPEN) + .globalTime( + new DashboardGlobalTime().liveSpan(DashboardGlobalTimeLiveSpan.PAST_ONE_HOUR)) + .selectableTemplateVars( + Collections.singletonList( + new SelectableTemplateVariableItems() + .defaultValue("*") + .name("group_by_var") + .type("group") + .visibleTags(Arrays.asList("selectableValue1", "selectableValue2")))); + + try { + SharedDashboard result = apiInstance.createPublicDashboard(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DashboardsApi#createPublicDashboard"); + 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/v1/dashboards/UpdatePublicDashboard_1708268778.java b/examples/v1/dashboards/UpdatePublicDashboard_1708268778.java new file mode 100644 index 00000000000..d41784484bf --- /dev/null +++ b/examples/v1/dashboards/UpdatePublicDashboard_1708268778.java @@ -0,0 +1,48 @@ +// Update a shared dashboard with selectable_template_vars returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v1.api.DashboardsApi; +import com.datadog.api.client.v1.model.DashboardGlobalTimeLiveSpan; +import com.datadog.api.client.v1.model.DashboardShareType; +import com.datadog.api.client.v1.model.SelectableTemplateVariableItems; +import com.datadog.api.client.v1.model.SharedDashboard; +import com.datadog.api.client.v1.model.SharedDashboardUpdateRequest; +import com.datadog.api.client.v1.model.SharedDashboardUpdateRequestGlobalTime; +import java.util.Arrays; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + DashboardsApi apiInstance = new DashboardsApi(defaultClient); + + // there is a valid "shared_dashboard" in the system + String SHARED_DASHBOARD_TOKEN = System.getenv("SHARED_DASHBOARD_TOKEN"); + + SharedDashboardUpdateRequest body = + new SharedDashboardUpdateRequest() + .globalTime( + new SharedDashboardUpdateRequestGlobalTime() + .liveSpan(DashboardGlobalTimeLiveSpan.PAST_FIFTEEN_MINUTES)) + .shareType(DashboardShareType.OPEN) + .selectableTemplateVars( + Collections.singletonList( + new SelectableTemplateVariableItems() + .defaultValue("*") + .name("group_by_var") + .type("group") + .visibleTags(Arrays.asList("selectableValue1", "selectableValue2")))); + + try { + SharedDashboard result = apiInstance.updatePublicDashboard(SHARED_DASHBOARD_TOKEN, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DashboardsApi#updatePublicDashboard"); + 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/v1/model/DashboardTemplateVariable.java b/src/main/java/com/datadog/api/client/v1/model/DashboardTemplateVariable.java index 4309d6a02c6..85a6e8d9099 100644 --- a/src/main/java/com/datadog/api/client/v1/model/DashboardTemplateVariable.java +++ b/src/main/java/com/datadog/api/client/v1/model/DashboardTemplateVariable.java @@ -26,7 +26,8 @@ DashboardTemplateVariable.JSON_PROPERTY_DEFAULT, DashboardTemplateVariable.JSON_PROPERTY_DEFAULTS, DashboardTemplateVariable.JSON_PROPERTY_NAME, - DashboardTemplateVariable.JSON_PROPERTY_PREFIX + DashboardTemplateVariable.JSON_PROPERTY_PREFIX, + DashboardTemplateVariable.JSON_PROPERTY_TYPE }) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") @@ -47,6 +48,9 @@ public class DashboardTemplateVariable { public static final String JSON_PROPERTY_PREFIX = "prefix"; private JsonNullable prefix = JsonNullable.undefined(); + public static final String JSON_PROPERTY_TYPE = "type"; + private JsonNullable type = JsonNullable.undefined(); + public DashboardTemplateVariable() {} @JsonCreator @@ -216,6 +220,38 @@ public void setPrefix(String prefix) { this.prefix = JsonNullable.of(prefix); } + public DashboardTemplateVariable type(String type) { + this.type = JsonNullable.of(type); + return this; + } + + /** + * The type of variable. This is to differentiate between filter variables (interpolated in query) + * and group by variables (interpolated into group by). + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getType() { + return type.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getType_JsonNullable() { + return type; + } + + @JsonProperty(JSON_PROPERTY_TYPE) + public void setType_JsonNullable(JsonNullable type) { + this.type = type; + } + + public void setType(String type) { + this.type = JsonNullable.of(type); + } + /** * A container for additional, undeclared properties. This is a holder for any undeclared * properties as specified with the 'additionalProperties' keyword in the OAS document. @@ -277,13 +313,15 @@ public boolean equals(Object o) { && Objects.equals(this.defaults, dashboardTemplateVariable.defaults) && Objects.equals(this.name, dashboardTemplateVariable.name) && Objects.equals(this.prefix, dashboardTemplateVariable.prefix) + && Objects.equals(this.type, dashboardTemplateVariable.type) && Objects.equals( this.additionalProperties, dashboardTemplateVariable.additionalProperties); } @Override public int hashCode() { - return Objects.hash(availableValues, _default, defaults, name, prefix, additionalProperties); + return Objects.hash( + availableValues, _default, defaults, name, prefix, type, additionalProperties); } @Override @@ -295,6 +333,7 @@ public String toString() { sb.append(" defaults: ").append(toIndentedString(defaults)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" prefix: ").append(toIndentedString(prefix)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) .append("\n"); diff --git a/src/main/java/com/datadog/api/client/v1/model/SelectableTemplateVariableItems.java b/src/main/java/com/datadog/api/client/v1/model/SelectableTemplateVariableItems.java index c8d275d85ae..52a0b7ead24 100644 --- a/src/main/java/com/datadog/api/client/v1/model/SelectableTemplateVariableItems.java +++ b/src/main/java/com/datadog/api/client/v1/model/SelectableTemplateVariableItems.java @@ -27,6 +27,7 @@ SelectableTemplateVariableItems.JSON_PROPERTY_DEFAULT_VALUE, SelectableTemplateVariableItems.JSON_PROPERTY_NAME, SelectableTemplateVariableItems.JSON_PROPERTY_PREFIX, + SelectableTemplateVariableItems.JSON_PROPERTY_TYPE, SelectableTemplateVariableItems.JSON_PROPERTY_VISIBLE_TAGS }) @jakarta.annotation.Generated( @@ -42,6 +43,9 @@ public class SelectableTemplateVariableItems { public static final String JSON_PROPERTY_PREFIX = "prefix"; private String prefix; + public static final String JSON_PROPERTY_TYPE = "type"; + private JsonNullable type = JsonNullable.undefined(); + public static final String JSON_PROPERTY_VISIBLE_TAGS = "visible_tags"; private JsonNullable> visibleTags = JsonNullable.>undefined(); @@ -108,6 +112,38 @@ public void setPrefix(String prefix) { this.prefix = prefix; } + public SelectableTemplateVariableItems type(String type) { + this.type = JsonNullable.of(type); + return this; + } + + /** + * The type of variable. This is to differentiate between filter variables (interpolated in query) + * and group by variables (interpolated into group by). + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getType() { + return type.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getType_JsonNullable() { + return type; + } + + @JsonProperty(JSON_PROPERTY_TYPE) + public void setType_JsonNullable(JsonNullable type) { + this.type = type; + } + + public void setType(String type) { + this.type = JsonNullable.of(type); + } + public SelectableTemplateVariableItems visibleTags(List visibleTags) { this.visibleTags = JsonNullable.>of(visibleTags); return this; @@ -211,6 +247,7 @@ public boolean equals(Object o) { return Objects.equals(this.defaultValue, selectableTemplateVariableItems.defaultValue) && Objects.equals(this.name, selectableTemplateVariableItems.name) && Objects.equals(this.prefix, selectableTemplateVariableItems.prefix) + && Objects.equals(this.type, selectableTemplateVariableItems.type) && Objects.equals(this.visibleTags, selectableTemplateVariableItems.visibleTags) && Objects.equals( this.additionalProperties, selectableTemplateVariableItems.additionalProperties); @@ -218,7 +255,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(defaultValue, name, prefix, visibleTags, additionalProperties); + return Objects.hash(defaultValue, name, prefix, type, visibleTags, additionalProperties); } @Override @@ -228,6 +265,7 @@ public String toString() { sb.append(" defaultValue: ").append(toIndentedString(defaultValue)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" prefix: ").append(toIndentedString(prefix)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" visibleTags: ").append(toIndentedString(visibleTags)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) diff --git a/src/test/resources/cassettes/features/v1/Create_a_new_dashboard_with_template_variable_type_field_returns_OK_response.freeze b/src/test/resources/cassettes/features/v1/Create_a_new_dashboard_with_template_variable_type_field_returns_OK_response.freeze new file mode 100644 index 00000000000..52a99a47002 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Create_a_new_dashboard_with_template_variable_type_field_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-06-30T15:47:16.966Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Create_a_new_dashboard_with_template_variable_type_field_returns_OK_response.json b/src/test/resources/cassettes/features/v1/Create_a_new_dashboard_with_template_variable_type_field_returns_OK_response.json new file mode 100644 index 00000000000..2104e8b1f28 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Create_a_new_dashboard_with_template_variable_type_field_returns_OK_response.json @@ -0,0 +1,58 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"description\":null,\"layout_type\":\"ordered\",\"notify_list\":[],\"reflow_type\":\"auto\",\"restricted_roles\":[],\"template_variables\":[{\"available_values\":[\"service\",\"datacenter\",\"env\"],\"defaults\":[\"service\",\"datacenter\"],\"name\":\"group_by_var\",\"type\":\"group\"}],\"title\":\"\",\"widgets\":[{\"definition\":{\"requests\":{\"fill\":{\"q\":\"avg:system.cpu.user{*}\"}},\"type\":\"hostmap\"}}]}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v1/dashboard", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"id\":\"zb6-rsj-zej\",\"title\":\"\",\"description\":null,\"author_handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"author_name\":\"CI Account\",\"layout_type\":\"ordered\",\"url\":\"/dashboard/zb6-rsj-zej/\",\"template_variables\":[{\"available_values\":[\"service\",\"datacenter\",\"env\"],\"defaults\":[\"service\",\"datacenter\"],\"name\":\"group_by_var\",\"type\":\"group\"}],\"widgets\":[{\"definition\":{\"requests\":{\"fill\":{\"q\":\"avg:system.cpu.user{*}\"}},\"type\":\"hostmap\"},\"id\":2230877325217406}],\"notify_list\":[],\"created_at\":\"2025-06-30T15:47:17.444093+00:00\",\"modified_at\":\"2025-06-30T15:47:17.444093+00:00\",\"reflow_type\":\"auto\",\"restricted_roles\":[]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "e19ba140-5d58-fecb-6844-03c0bbec2cc6" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v1/dashboard/zb6-rsj-zej", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"deleted_dashboard_id\":\"zb6-rsj-zej\"}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "afe984cf-a557-4d10-1a33-9622816f5b0f" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Create_a_shared_dashboard_with_a_group_template_variable_returns_OK_response.freeze b/src/test/resources/cassettes/features/v1/Create_a_shared_dashboard_with_a_group_template_variable_returns_OK_response.freeze new file mode 100644 index 00000000000..2116d8d718b --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Create_a_shared_dashboard_with_a_group_template_variable_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-06-30T15:47:18.224Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Create_a_shared_dashboard_with_a_group_template_variable_returns_OK_response.json b/src/test/resources/cassettes/features/v1/Create_a_shared_dashboard_with_a_group_template_variable_returns_OK_response.json new file mode 100644 index 00000000000..ac1907dd098 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Create_a_shared_dashboard_with_a_group_template_variable_returns_OK_response.json @@ -0,0 +1,114 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"layout_type\":\"ordered\",\"title\":\"Test-Create_a_shared_dashboard_with_a_group_template_variable_returns_OK_response-1751298438 with Profile Metrics Query\",\"widgets\":[{\"definition\":{\"requests\":[{\"profile_metrics_query\":{\"compute\":{\"aggregation\":\"sum\",\"facet\":\"@prof_core_cpu_cores\"},\"group_by\":[{\"facet\":\"service\",\"limit\":10,\"sort\":{\"aggregation\":\"sum\",\"facet\":\"@prof_core_cpu_cores\",\"order\":\"desc\"}}],\"search\":{\"query\":\"runtime:jvm\"}}}],\"type\":\"timeseries\"}}]}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v1/dashboard", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"id\":\"73x-8zb-5cq\",\"title\":\"Test-Create_a_shared_dashboard_with_a_group_template_variable_returns_OK_response-1751298438 with Profile Metrics Query\",\"description\":null,\"author_handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"author_name\":\"CI Account\",\"layout_type\":\"ordered\",\"url\":\"/dashboard/73x-8zb-5cq/test-createashareddashboardwithagrouptemplatevariablereturnsokresponse-175129843\",\"template_variables\":null,\"widgets\":[{\"definition\":{\"requests\":[{\"profile_metrics_query\":{\"compute\":{\"aggregation\":\"sum\",\"facet\":\"@prof_core_cpu_cores\"},\"group_by\":[{\"facet\":\"service\",\"limit\":10,\"sort\":{\"aggregation\":\"sum\",\"facet\":\"@prof_core_cpu_cores\",\"order\":\"desc\"}}],\"search\":{\"query\":\"runtime:jvm\"}}}],\"type\":\"timeseries\"},\"id\":81881431996576}],\"notify_list\":null,\"created_at\":\"2025-06-30T15:47:18.625228+00:00\",\"modified_at\":\"2025-06-30T15:47:18.625228+00:00\",\"restricted_roles\":[]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "1a39c72f-a68e-1fe1-b401-17a7c546f4a2" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"dashboard_id\":\"73x-8zb-5cq\",\"dashboard_type\":\"custom_timeboard\",\"global_time\":{\"live_span\":\"1h\"},\"selectable_template_vars\":[{\"default_value\":\"*\",\"name\":\"group_by_var\",\"type\":\"group\",\"visible_tags\":[\"selectableValue1\",\"selectableValue2\"]}],\"share_type\":\"open\"}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v1/dashboard/public", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"author\":{\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"dashboard_id\":\"73x-8zb-5cq\",\"dashboard_type\":\"custom_timeboard\",\"status\":\"active\",\"title\":\"Test-Create_a_shared_dashboard_with_a_group_template_variable_returns_OK_response-1751298438 with Profile Metrics Query\",\"viewing_preferences\":{},\"expiration\":null,\"last_accessed\":null,\"global_time_selectable_enabled\":false,\"global_time\":{\"live_span\":\"1h\"},\"selectable_template_vars\":[{\"default_value\":\"*\",\"name\":\"group_by_var\",\"type\":\"group\",\"visible_tags\":[\"selectableValue1\",\"selectableValue2\"]}],\"token\":\"fasjyydbcgwwc2uc-546a27681750cfe1aa43a9930683c116\",\"public_url\":\"https://p.datadoghq.com/sb/fasjyydbcgwwc2uc-546a27681750cfe1aa43a9930683c116\",\"created\":\"2025-06-30T15:47:19.275023+00:00\",\"share_type\":\"open\",\"share_list\":null,\"session_duration_in_days\":null,\"invitees\":[],\"embeddable_domains\":[]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "6d02ce4b-4d9d-def2-a422-5236a54aa781" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v1/dashboard/public/fasjyydbcgwwc2uc-546a27681750cfe1aa43a9930683c116", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"deleted_public_dashboard_token\":\"fasjyydbcgwwc2uc-546a27681750cfe1aa43a9930683c116\"}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "fdc42e58-a2ed-9877-5f77-c002c44d533f" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v1/dashboard/73x-8zb-5cq", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"deleted_dashboard_id\":\"73x-8zb-5cq\"}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "17c3feae-282c-1a7d-d89d-79469000d3ae" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Update_a_shared_dashboard_with_selectable_template_vars_returns_OK_response.freeze b/src/test/resources/cassettes/features/v1/Update_a_shared_dashboard_with_selectable_template_vars_returns_OK_response.freeze new file mode 100644 index 00000000000..22ac13e5749 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Update_a_shared_dashboard_with_selectable_template_vars_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-06-30T15:47:20.325Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Update_a_shared_dashboard_with_selectable_template_vars_returns_OK_response.json b/src/test/resources/cassettes/features/v1/Update_a_shared_dashboard_with_selectable_template_vars_returns_OK_response.json new file mode 100644 index 00000000000..c258076420c --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Update_a_shared_dashboard_with_selectable_template_vars_returns_OK_response.json @@ -0,0 +1,144 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"layout_type\":\"ordered\",\"title\":\"Test-Update_a_shared_dashboard_with_selectable_template_vars_returns_OK_response-1751298440 with Profile Metrics Query\",\"widgets\":[{\"definition\":{\"requests\":[{\"profile_metrics_query\":{\"compute\":{\"aggregation\":\"sum\",\"facet\":\"@prof_core_cpu_cores\"},\"group_by\":[{\"facet\":\"service\",\"limit\":10,\"sort\":{\"aggregation\":\"sum\",\"facet\":\"@prof_core_cpu_cores\",\"order\":\"desc\"}}],\"search\":{\"query\":\"runtime:jvm\"}}}],\"type\":\"timeseries\"}}]}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v1/dashboard", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"id\":\"u77-2y3-a8u\",\"title\":\"Test-Update_a_shared_dashboard_with_selectable_template_vars_returns_OK_response-1751298440 with Profile Metrics Query\",\"description\":null,\"author_handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"author_name\":\"CI Account\",\"layout_type\":\"ordered\",\"url\":\"/dashboard/u77-2y3-a8u/test-updateashareddashboardwithselectabletemplatevarsreturnsokresponse-175129844\",\"template_variables\":null,\"widgets\":[{\"definition\":{\"requests\":[{\"profile_metrics_query\":{\"compute\":{\"aggregation\":\"sum\",\"facet\":\"@prof_core_cpu_cores\"},\"group_by\":[{\"facet\":\"service\",\"limit\":10,\"sort\":{\"aggregation\":\"sum\",\"facet\":\"@prof_core_cpu_cores\",\"order\":\"desc\"}}],\"search\":{\"query\":\"runtime:jvm\"}}}],\"type\":\"timeseries\"},\"id\":1909539592049195}],\"notify_list\":null,\"created_at\":\"2025-06-30T15:47:20.724680+00:00\",\"modified_at\":\"2025-06-30T15:47:20.724680+00:00\",\"restricted_roles\":[]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "a69f9aa1-ff20-8eb7-92dd-9a6be8c8e7b9" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"dashboard_id\":\"u77-2y3-a8u\",\"dashboard_type\":\"custom_timeboard\",\"global_time\":{\"live_span\":\"1h\"},\"share_list\":[\"testupdateashareddashboardwithselectabletemplatevarsreturnsokresponse1751298440@datadoghq.com\"],\"share_type\":\"invite\"}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v1/dashboard/public", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"author\":{\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"dashboard_id\":\"u77-2y3-a8u\",\"dashboard_type\":\"custom_timeboard\",\"status\":\"active\",\"title\":\"Test-Update_a_shared_dashboard_with_selectable_template_vars_returns_OK_response-1751298440 with Profile Metrics Query\",\"viewing_preferences\":{},\"expiration\":null,\"last_accessed\":null,\"global_time_selectable_enabled\":false,\"global_time\":{\"live_span\":\"1h\"},\"selectable_template_vars\":null,\"token\":\"fasjyydbcgwwc2uc-e45981fc09294b85d655016fc6109985\",\"public_url\":\"https://p.datadoghq.com/sb/fasjyydbcgwwc2uc-e45981fc09294b85d655016fc6109985\",\"created\":\"2025-06-30T15:47:21.395152+00:00\",\"share_type\":\"invite\",\"share_list\":[\"testupdateashareddashboardwithselectabletemplatevarsreturnsokresponse1751298440@datadoghq.com\"],\"session_duration_in_days\":30,\"invitees\":[{\"email\":\"testupdateashareddashboardwithselectabletemplatevarsreturnsokresponse1751298440@datadoghq.com\",\"access_expiration\":null,\"last_accessed\":null,\"created_at\":\"2025-06-30T15:47:21.429277+00:00\"}],\"embeddable_domains\":[]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "d9798be2-be49-d1aa-2ef4-68e43f11fa15" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"global_time\":{\"live_span\":\"15m\"},\"selectable_template_vars\":[{\"default_value\":\"*\",\"name\":\"group_by_var\",\"type\":\"group\",\"visible_tags\":[\"selectableValue1\",\"selectableValue2\"]}],\"share_list\":[],\"share_type\":\"open\"}" + }, + "headers": {}, + "method": "PUT", + "path": "/api/v1/dashboard/public/fasjyydbcgwwc2uc-e45981fc09294b85d655016fc6109985", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"author\":{\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\"},\"dashboard_id\":\"u77-2y3-a8u\",\"dashboard_type\":\"custom_timeboard\",\"status\":\"active\",\"title\":\"Test-Update_a_shared_dashboard_with_selectable_template_vars_returns_OK_response-1751298440 with Profile Metrics Query\",\"viewing_preferences\":{},\"expiration\":null,\"last_accessed\":null,\"global_time_selectable_enabled\":false,\"global_time\":{\"live_span\":\"15m\"},\"selectable_template_vars\":[{\"default_value\":\"*\",\"name\":\"group_by_var\",\"type\":\"group\",\"visible_tags\":[\"selectableValue1\",\"selectableValue2\"]}],\"token\":\"fasjyydbcgwwc2uc-e45981fc09294b85d655016fc6109985\",\"public_url\":\"https://p.datadoghq.com/sb/fasjyydbcgwwc2uc-e45981fc09294b85d655016fc6109985\",\"created\":\"2025-06-30T15:47:21.395152+00:00\",\"share_type\":\"open\",\"share_list\":[],\"session_duration_in_days\":30,\"invitees\":[],\"embeddable_domains\":[]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "319c7ac3-7f6a-b7da-f9f0-e1931cd21cd2" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v1/dashboard/public/fasjyydbcgwwc2uc-e45981fc09294b85d655016fc6109985", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"deleted_public_dashboard_token\":\"fasjyydbcgwwc2uc-e45981fc09294b85d655016fc6109985\"}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "bb48a95d-33fb-211f-7847-ef9f60e31e2a" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v1/dashboard/u77-2y3-a8u", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"deleted_dashboard_id\":\"u77-2y3-a8u\"}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "5102d474-5307-ed96-8024-1894f4dc04ad" + } +] \ 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 e8b16f667ee..47794c745f4 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 @@ -75,7 +75,7 @@ Feature: Dashboards @generated @skip @team:DataDog/dashboards-backend Scenario: Create a new dashboard returns "Bad Request" response Given new "CreateDashboard" request - And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]} + And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]} When the request is sent Then the response status is 400 Bad Request @@ -807,6 +807,17 @@ Feature: Dashboards And the response "template_variable_presets[0].template_variables[0].name" is equal to "datacenter" And the response "template_variable_presets[0].template_variables[0].values[0]" is equal to "*" + @team:DataDog/dashboards-backend + Scenario: Create a new dashboard with template variable type field returns "OK" response + Given new "CreateDashboard" request + And body with value {"description": null, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "template_variables": [{"available_values": ["service", "datacenter", "env"], "defaults": ["service", "datacenter"], "name": "group_by_var", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]} + When the request is sent + Then the response status is 200 OK + And the response "template_variables[0].name" is equal to "group_by_var" + And the response "template_variables[0].available_values[0]" is equal to "service" + And the response "template_variables[0].defaults[0]" is equal to "service" + And the response "template_variables[0].type" is equal to "group" + @team:DataDog/dashboards-backend Scenario: Create a new dashboard with timeseries widget and formula style attributes Given new "CreateDashboard" request @@ -960,6 +971,18 @@ Feature: Dashboards And the response "dashboard_id" has the same value as "dashboard.id" And the response "dashboard_type" is equal to "custom_timeboard" + @team:DataDog/reporting-and-sharing + Scenario: Create a shared dashboard with a group template variable returns "OK" response + Given there is a valid "dashboard" in the system + And new "CreatePublicDashboard" request + And body with value {"dashboard_id": "{{dashboard.id}}", "dashboard_type": "custom_timeboard", "share_type": "open", "global_time": {"live_span": "1h"}, "selectable_template_vars": [{"default_value": "*", "name": "group_by_var", "type": "group", "visible_tags": ["selectableValue1", "selectableValue2"]}]} + When the request is sent + Then the response status is 200 OK + And the response "dashboard_id" has the same value as "dashboard.id" + And the response "dashboard_type" is equal to "custom_timeboard" + And the response "selectable_template_vars[0].name" is equal to "group_by_var" + And the response "selectable_template_vars[0].type" is equal to "group" + @generated @skip @team:DataDog/dashboards-backend Scenario: Delete a dashboard returns "Dashboards Not Found" response Given new "DeleteDashboard" request @@ -1172,7 +1195,7 @@ Feature: Dashboards Scenario: Update a dashboard returns "Bad Request" response Given new "UpdateDashboard" request And request contains "dashboard_id" parameter from "REPLACE.ME" - And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]} + And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]} When the request is sent Then the response status is 400 Bad Request @@ -1180,7 +1203,7 @@ Feature: Dashboards Scenario: Update a dashboard returns "Item Not Found" response Given new "UpdateDashboard" request And request contains "dashboard_id" parameter from "REPLACE.ME" - And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]} + And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]} When the request is sent Then the response status is 404 Item Not Found @@ -1234,3 +1257,20 @@ Feature: Dashboards And the response "global_time.live_span" is equal to "15m" And the response "share_type" is equal to "open" And the response "share_list" has length 0 + + @team:DataDog/reporting-and-sharing + Scenario: Update a shared dashboard with selectable_template_vars returns "OK" response + Given there is a valid "dashboard" in the system + And there is a valid "shared_dashboard" in the system + And new "UpdatePublicDashboard" request + And request contains "token" parameter from "shared_dashboard.token" + And body with value {"global_time": {"live_span": "15m"}, "share_list": [], "share_type": "open", "selectable_template_vars": [{"default_value": "*", "name": "group_by_var", "type": "group", "visible_tags": ["selectableValue1", "selectableValue2"]}]} + When the request is sent + Then the response status is 200 OK + And the response "dashboard_id" has the same value as "dashboard.id" + And the response "dashboard_type" is equal to "custom_timeboard" + And the response "global_time.live_span" is equal to "15m" + And the response "share_type" is equal to "open" + And the response "share_list" has length 0 + And the response "selectable_template_vars[0].name" is equal to "group_by_var" + And the response "selectable_template_vars[0].type" is equal to "group"