diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 7056d83d64b..817b35746ca 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -1780,14 +1780,11 @@ components: - INVITE - EMBED DashboardSummary: - description: Dashboard summary response. - properties: - dashboards: - description: List of dashboard definitions. - items: - $ref: "#/components/schemas/DashboardSummaryDefinition" - type: array - type: object + description: Dashboard summary response with API-versioned representations. + oneOf: + - $ref: "#/components/schemas/DashboardSummary_V1" + - $ref: "#/components/schemas/DashboardSummary_20270101" + x-datadog-api-versioned: true DashboardSummaryDefinition: description: Dashboard definition. properties: @@ -1825,6 +1822,108 @@ components: description: URL of the dashboard. type: string type: object + DashboardSummaryDefinition_20270101: + description: Dashboard definition. + properties: + author: + $ref: "#/components/schemas/Creator" + created: + description: Date of creation of the dashboard. + format: date-time + nullable: true + readOnly: true + type: string + icon: + description: URL to the icon of the dashboard. + nullable: true + readOnly: true + type: string + id: + $ref: "#/components/schemas/DashboardSummaryID_20270101" + integration_id: + description: The short name of the integration. + nullable: true + readOnly: true + type: string + is_favorite: + description: Whether the dashboard is in the favorites. + readOnly: true + type: boolean + is_read_only: + description: Whether the dashboard is read only. + readOnly: true + type: boolean + is_shared: + description: Whether the dashboard is publicly shared. + readOnly: true + type: boolean + last_view_date: + description: Date when the dashboard was last viewed. + nullable: true + readOnly: true + type: string + modified: + description: Date of last edition of the dashboard. + format: date-time + nullable: true + readOnly: true + type: string + popularity: + description: Popularity of the dashboard. + format: int32 + maximum: 5 + readOnly: true + type: integer + tags: + description: List of team names representing ownership of the dashboard. + items: + description: The name of a Datadog team, formatted as `team:`. + type: string + nullable: true + readOnly: true + type: array + title: + description: Title of the dashboard. + readOnly: true + type: string + type: + description: The type of the dashboard. + readOnly: true + type: string + url: + description: URL path to the dashboard. + readOnly: true + type: string + type: object + DashboardSummaryID_20270101: + description: ID of the dashboard. + oneOf: + - type: string + - format: int64 + type: integer + DashboardSummary_20270101: + description: Dashboard summary response. + properties: + dashboards: + description: List of dashboard definitions. + items: + $ref: "#/components/schemas/DashboardSummaryDefinition_20270101" + type: array + total: + description: Number of dashboards. + format: int64 + readOnly: true + type: integer + type: object + DashboardSummary_V1: + description: Dashboard summary response. + properties: + dashboards: + description: List of dashboard definitions. + items: + $ref: "#/components/schemas/DashboardSummaryDefinition" + type: array + type: object DashboardTab: description: Dashboard tab for organizing widgets. properties: diff --git a/examples/v1/dashboards/ListDashboards_3883013570.java b/examples/v1/dashboards/ListDashboards_3883013570.java new file mode 100644 index 00000000000..b4518140e6d --- /dev/null +++ b/examples/v1/dashboards/ListDashboards_3883013570.java @@ -0,0 +1,26 @@ +// Get all dashboards with version "2027-01-01" 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.api.DashboardsApi.ListDashboardsOptionalParameters; +import com.datadog.api.client.v1.model.DashboardSummary; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + DashboardsApi apiInstance = new DashboardsApi(defaultClient); + + try { + DashboardSummary result = + apiInstance.listDashboards(new ListDashboardsOptionalParameters().filterShared(false)); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DashboardsApi#listDashboards"); + 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_20270101/api/DashboardsApi.java b/src/main/java/com/datadog/api/client/v1_20270101/api/DashboardsApi.java new file mode 100644 index 00000000000..26e39207f77 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1_20270101/api/DashboardsApi.java @@ -0,0 +1,328 @@ +package com.datadog.api.client.v1_20270101.api; + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.ApiResponse; +import com.datadog.api.client.PaginationIterable; +import com.datadog.api.client.Pair; +import com.datadog.api.client.v1_20270101.model.DashboardSummary; +import com.datadog.api.client.v1_20270101.model.DashboardSummaryDefinition; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DashboardsApi { + private ApiClient apiClient; + + public DashboardsApi() { + this(ApiClient.getDefaultApiClient()); + } + + public DashboardsApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client. + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client. + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** Manage optional parameters to listDashboards. */ + public static class ListDashboardsOptionalParameters { + private Boolean filterShared; + private Boolean filterDeleted; + private Long count; + private Long start; + + /** + * Set filterShared. + * + * @param filterShared When true, this query only returns shared custom created or + * cloned dashboards. (optional) + * @return ListDashboardsOptionalParameters + */ + public ListDashboardsOptionalParameters filterShared(Boolean filterShared) { + this.filterShared = filterShared; + return this; + } + + /** + * Set filterDeleted. + * + * @param filterDeleted When true, this query returns only deleted custom-created + * or cloned dashboards. This parameter is incompatible with filter[shared]. + * (optional) + * @return ListDashboardsOptionalParameters + */ + public ListDashboardsOptionalParameters filterDeleted(Boolean filterDeleted) { + this.filterDeleted = filterDeleted; + return this; + } + + /** + * Set count. + * + * @param count The maximum number of dashboards returned in the list. (optional, default to + * 100) + * @return ListDashboardsOptionalParameters + */ + public ListDashboardsOptionalParameters count(Long count) { + this.count = count; + return this; + } + + /** + * Set start. + * + * @param start The specific offset to use as the beginning of the returned response. (optional) + * @return ListDashboardsOptionalParameters + */ + public ListDashboardsOptionalParameters start(Long start) { + this.start = start; + return this; + } + } + + /** + * Get all dashboards. + * + *

See {@link #listDashboardsWithHttpInfo}. + * + * @return DashboardSummary + * @throws ApiException if fails to make API call + */ + public DashboardSummary listDashboards() throws ApiException { + return listDashboardsWithHttpInfo(new ListDashboardsOptionalParameters()).getData(); + } + + /** + * Get all dashboards. + * + *

See {@link #listDashboardsWithHttpInfoAsync}. + * + * @return CompletableFuture<DashboardSummary> + */ + public CompletableFuture listDashboardsAsync() { + return listDashboardsWithHttpInfoAsync(new ListDashboardsOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get all dashboards. + * + *

See {@link #listDashboardsWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return DashboardSummary + * @throws ApiException if fails to make API call + */ + public DashboardSummary listDashboards(ListDashboardsOptionalParameters parameters) + throws ApiException { + return listDashboardsWithHttpInfo(parameters).getData(); + } + + /** + * Get all dashboards. + * + *

See {@link #listDashboardsWithHttpInfoAsync}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<DashboardSummary> + */ + public CompletableFuture listDashboardsAsync( + ListDashboardsOptionalParameters parameters) { + return listDashboardsWithHttpInfoAsync(parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get all dashboards. + * + *

See {@link #listDashboardsWithHttpInfo}. + * + * @return PaginationIterable<DashboardSummaryDefinition> + */ + public PaginationIterable listDashboardsWithPagination() { + ListDashboardsOptionalParameters parameters = new ListDashboardsOptionalParameters(); + return listDashboardsWithPagination(parameters); + } + + /** + * Get all dashboards. + * + *

See {@link #listDashboardsWithHttpInfo}. + * + * @return DashboardSummary + */ + public PaginationIterable listDashboardsWithPagination( + ListDashboardsOptionalParameters parameters) { + String resultsPath = "getDashboards"; + String valueGetterPath = ""; + String valueSetterPath = "start"; + Boolean valueSetterParamOptional = true; + Long limit; + + if (parameters.count == null) { + limit = 100l; + parameters.count(limit); + } else { + limit = parameters.count; + } + + LinkedHashMap args = new LinkedHashMap(); + args.put("optionalParams", parameters); + + PaginationIterable iterator = + new PaginationIterable( + this, + "listDashboards", + resultsPath, + valueGetterPath, + valueSetterPath, + valueSetterParamOptional, + true, + false, + limit, + args, + 0); + + return iterator; + } + + /** + * Get all dashboards. + * + *

Note: This query will only return custom created or cloned dashboards. This + * query will not return preset dashboards. + * + * @param parameters Optional parameters for the request. + * @return ApiResponse<DashboardSummary> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
403 Authentication Error -
429 Too many requests -
+ */ + public ApiResponse listDashboardsWithHttpInfo( + ListDashboardsOptionalParameters parameters) throws ApiException { + Object localVarPostBody = null; + Boolean filterShared = parameters.filterShared; + Boolean filterDeleted = parameters.filterDeleted; + Long count = parameters.count; + Long start = parameters.start; + // create path and map variables + String localVarPath = "/api/v1/dashboard"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + localVarHeaderParams.put("DD-API-Version", "2027-01-01"); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[shared]", filterShared)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[deleted]", filterDeleted)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "count", count)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "start", start)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v1_20270101.DashboardsApi.listDashboards", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get all dashboards. + * + *

See {@link #listDashboardsWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<DashboardSummary>> + */ + public CompletableFuture> listDashboardsWithHttpInfoAsync( + ListDashboardsOptionalParameters parameters) { + Object localVarPostBody = null; + Boolean filterShared = parameters.filterShared; + Boolean filterDeleted = parameters.filterDeleted; + Long count = parameters.count; + Long start = parameters.start; + // create path and map variables + String localVarPath = "/api/v1/dashboard"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + localVarHeaderParams.put("DD-API-Version", "2027-01-01"); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[shared]", filterShared)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[deleted]", filterDeleted)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "count", count)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "start", start)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v1_20270101.DashboardsApi.listDashboards", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } +} diff --git a/src/main/java/com/datadog/api/client/v1_20270101/model/DashboardSummary.java b/src/main/java/com/datadog/api/client/v1_20270101/model/DashboardSummary.java new file mode 100644 index 00000000000..e94a4fdcdce --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1_20270101/model/DashboardSummary.java @@ -0,0 +1,176 @@ +/* + * 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_20270101.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Dashboard summary response. */ +@JsonPropertyOrder({ + DashboardSummary.JSON_PROPERTY_DASHBOARDS, + DashboardSummary.JSON_PROPERTY_TOTAL +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DashboardSummary { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DASHBOARDS = "dashboards"; + private List dashboards = null; + + public static final String JSON_PROPERTY_TOTAL = "total"; + private Long total; + + public DashboardSummary dashboards(List dashboards) { + this.dashboards = dashboards; + if (dashboards != null) { + for (DashboardSummaryDefinition item : dashboards) { + this.unparsed |= item.unparsed; + } + } + return this; + } + + public DashboardSummary addDashboardsItem(DashboardSummaryDefinition dashboardsItem) { + if (this.dashboards == null) { + this.dashboards = new ArrayList<>(); + } + this.dashboards.add(dashboardsItem); + this.unparsed |= dashboardsItem.unparsed; + return this; + } + + /** + * List of dashboard definitions. + * + * @return dashboards + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DASHBOARDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getDashboards() { + return dashboards; + } + + public void setDashboards(List dashboards) { + this.dashboards = dashboards; + if (dashboards != null) { + for (DashboardSummaryDefinition item : dashboards) { + this.unparsed |= item.unparsed; + } + } + } + + /** + * Number of dashboards. + * + * @return total + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TOTAL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getTotal() { + return total; + } + + /** + * 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 DashboardSummary + */ + @JsonAnySetter + public DashboardSummary 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 DashboardSummary object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DashboardSummary dashboardSummary = (DashboardSummary) o; + return Objects.equals(this.dashboards, dashboardSummary.dashboards) + && Objects.equals(this.total, dashboardSummary.total) + && Objects.equals(this.additionalProperties, dashboardSummary.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(dashboards, total, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DashboardSummary {\n"); + sb.append(" dashboards: ").append(toIndentedString(dashboards)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).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_20270101/model/DashboardSummaryDefinition.java b/src/main/java/com/datadog/api/client/v1_20270101/model/DashboardSummaryDefinition.java new file mode 100644 index 00000000000..2d03d26efcb --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1_20270101/model/DashboardSummaryDefinition.java @@ -0,0 +1,497 @@ +/* + * 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_20270101.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +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.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Dashboard definition. */ +@JsonPropertyOrder({ + DashboardSummaryDefinition.JSON_PROPERTY_AUTHOR, + DashboardSummaryDefinition.JSON_PROPERTY_CREATED, + DashboardSummaryDefinition.JSON_PROPERTY_ICON, + DashboardSummaryDefinition.JSON_PROPERTY_ID, + DashboardSummaryDefinition.JSON_PROPERTY_INTEGRATION_ID, + DashboardSummaryDefinition.JSON_PROPERTY_IS_FAVORITE, + DashboardSummaryDefinition.JSON_PROPERTY_IS_READ_ONLY, + DashboardSummaryDefinition.JSON_PROPERTY_IS_SHARED, + DashboardSummaryDefinition.JSON_PROPERTY_LAST_VIEW_DATE, + DashboardSummaryDefinition.JSON_PROPERTY_MODIFIED, + DashboardSummaryDefinition.JSON_PROPERTY_POPULARITY, + DashboardSummaryDefinition.JSON_PROPERTY_TAGS, + DashboardSummaryDefinition.JSON_PROPERTY_TITLE, + DashboardSummaryDefinition.JSON_PROPERTY_TYPE, + DashboardSummaryDefinition.JSON_PROPERTY_URL +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DashboardSummaryDefinition { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AUTHOR = "author"; + private com.datadog.api.client.v1.model.Creator author; + + public static final String JSON_PROPERTY_CREATED = "created"; + private JsonNullable created = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ICON = "icon"; + private JsonNullable icon = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ID = "id"; + private DashboardSummaryID id; + + public static final String JSON_PROPERTY_INTEGRATION_ID = "integration_id"; + private JsonNullable integrationId = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_IS_FAVORITE = "is_favorite"; + private Boolean isFavorite; + + public static final String JSON_PROPERTY_IS_READ_ONLY = "is_read_only"; + private Boolean isReadOnly; + + public static final String JSON_PROPERTY_IS_SHARED = "is_shared"; + private Boolean isShared; + + public static final String JSON_PROPERTY_LAST_VIEW_DATE = "last_view_date"; + private JsonNullable lastViewDate = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_MODIFIED = "modified"; + private JsonNullable modified = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_POPULARITY = "popularity"; + private Integer popularity; + + public static final String JSON_PROPERTY_TAGS = "tags"; + private JsonNullable> tags = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_TITLE = "title"; + private String title; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_URL = "url"; + private String url; + + /** + * Object describing the creator of the shared element. + * + * @return author + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_AUTHOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public com.datadog.api.client.v1.model.Creator getAuthor() { + return author; + } + + /** + * Date of creation of the dashboard. + * + * @return created + */ + @jakarta.annotation.Nullable + @JsonIgnore + public OffsetDateTime getCreated() { + + if (created == null) { + created = JsonNullable.undefined(); + } + return created.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CREATED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getCreated_JsonNullable() { + return created; + } + + @JsonProperty(JSON_PROPERTY_CREATED) + private void setCreated_JsonNullable(JsonNullable created) { + this.created = created; + } + + /** + * URL to the icon of the dashboard. + * + * @return icon + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getIcon() { + + if (icon == null) { + icon = JsonNullable.undefined(); + } + return icon.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ICON) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getIcon_JsonNullable() { + return icon; + } + + @JsonProperty(JSON_PROPERTY_ICON) + private void setIcon_JsonNullable(JsonNullable icon) { + this.icon = icon; + } + + public DashboardSummaryDefinition id(DashboardSummaryID id) { + this.id = id; + this.unparsed |= id.unparsed; + return this; + } + + /** + * ID of the dashboard. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public DashboardSummaryID getId() { + return id; + } + + public void setId(DashboardSummaryID id) { + this.id = id; + if (id != null) { + this.unparsed |= id.unparsed; + } + } + + /** + * The short name of the integration. + * + * @return integrationId + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getIntegrationId() { + + if (integrationId == null) { + integrationId = JsonNullable.undefined(); + } + return integrationId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_INTEGRATION_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getIntegrationId_JsonNullable() { + return integrationId; + } + + @JsonProperty(JSON_PROPERTY_INTEGRATION_ID) + private void setIntegrationId_JsonNullable(JsonNullable integrationId) { + this.integrationId = integrationId; + } + + /** + * Whether the dashboard is in the favorites. + * + * @return isFavorite + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_IS_FAVORITE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getIsFavorite() { + return isFavorite; + } + + /** + * Whether the dashboard is read only. + * + * @return isReadOnly + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_IS_READ_ONLY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getIsReadOnly() { + return isReadOnly; + } + + /** + * Whether the dashboard is publicly shared. + * + * @return isShared + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_IS_SHARED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getIsShared() { + return isShared; + } + + /** + * Date when the dashboard was last viewed. + * + * @return lastViewDate + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getLastViewDate() { + + if (lastViewDate == null) { + lastViewDate = JsonNullable.undefined(); + } + return lastViewDate.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_LAST_VIEW_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getLastViewDate_JsonNullable() { + return lastViewDate; + } + + @JsonProperty(JSON_PROPERTY_LAST_VIEW_DATE) + private void setLastViewDate_JsonNullable(JsonNullable lastViewDate) { + this.lastViewDate = lastViewDate; + } + + /** + * Date of last edition of the dashboard. + * + * @return modified + */ + @jakarta.annotation.Nullable + @JsonIgnore + public OffsetDateTime getModified() { + + if (modified == null) { + modified = JsonNullable.undefined(); + } + return modified.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_MODIFIED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getModified_JsonNullable() { + return modified; + } + + @JsonProperty(JSON_PROPERTY_MODIFIED) + private void setModified_JsonNullable(JsonNullable modified) { + this.modified = modified; + } + + /** + * Popularity of the dashboard. maximum: 5 + * + * @return popularity + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_POPULARITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getPopularity() { + return popularity; + } + + /** + * List of team names representing ownership of the dashboard. + * + * @return tags + */ + @jakarta.annotation.Nullable + @JsonIgnore + public List getTags() { + + if (tags == null) { + tags = JsonNullable.>undefined(); + } + return tags.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> getTags_JsonNullable() { + return tags; + } + + @JsonProperty(JSON_PROPERTY_TAGS) + private void setTags_JsonNullable(JsonNullable> tags) { + this.tags = tags; + } + + /** + * Title of the dashboard. + * + * @return title + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TITLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTitle() { + return title; + } + + /** + * The type of the dashboard. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getType() { + return type; + } + + /** + * URL path to the dashboard. + * + * @return url + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getUrl() { + return 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 DashboardSummaryDefinition + */ + @JsonAnySetter + public DashboardSummaryDefinition 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 DashboardSummaryDefinition object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DashboardSummaryDefinition dashboardSummaryDefinition = (DashboardSummaryDefinition) o; + return Objects.equals(this.author, dashboardSummaryDefinition.author) + && Objects.equals(this.created, dashboardSummaryDefinition.created) + && Objects.equals(this.icon, dashboardSummaryDefinition.icon) + && Objects.equals(this.id, dashboardSummaryDefinition.id) + && Objects.equals(this.integrationId, dashboardSummaryDefinition.integrationId) + && Objects.equals(this.isFavorite, dashboardSummaryDefinition.isFavorite) + && Objects.equals(this.isReadOnly, dashboardSummaryDefinition.isReadOnly) + && Objects.equals(this.isShared, dashboardSummaryDefinition.isShared) + && Objects.equals(this.lastViewDate, dashboardSummaryDefinition.lastViewDate) + && Objects.equals(this.modified, dashboardSummaryDefinition.modified) + && Objects.equals(this.popularity, dashboardSummaryDefinition.popularity) + && Objects.equals(this.tags, dashboardSummaryDefinition.tags) + && Objects.equals(this.title, dashboardSummaryDefinition.title) + && Objects.equals(this.type, dashboardSummaryDefinition.type) + && Objects.equals(this.url, dashboardSummaryDefinition.url) + && Objects.equals( + this.additionalProperties, dashboardSummaryDefinition.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + author, + created, + icon, + id, + integrationId, + isFavorite, + isReadOnly, + isShared, + lastViewDate, + modified, + popularity, + tags, + title, + type, + url, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DashboardSummaryDefinition {\n"); + sb.append(" author: ").append(toIndentedString(author)).append("\n"); + sb.append(" created: ").append(toIndentedString(created)).append("\n"); + sb.append(" icon: ").append(toIndentedString(icon)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" integrationId: ").append(toIndentedString(integrationId)).append("\n"); + sb.append(" isFavorite: ").append(toIndentedString(isFavorite)).append("\n"); + sb.append(" isReadOnly: ").append(toIndentedString(isReadOnly)).append("\n"); + sb.append(" isShared: ").append(toIndentedString(isShared)).append("\n"); + sb.append(" lastViewDate: ").append(toIndentedString(lastViewDate)).append("\n"); + sb.append(" modified: ").append(toIndentedString(modified)).append("\n"); + sb.append(" popularity: ").append(toIndentedString(popularity)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).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_20270101/model/DashboardSummaryID.java b/src/main/java/com/datadog/api/client/v1_20270101/model/DashboardSummaryID.java new file mode 100644 index 00000000000..b35e753339f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1_20270101/model/DashboardSummaryID.java @@ -0,0 +1,267 @@ +/* + * 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_20270101.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = DashboardSummaryID.DashboardSummaryIDDeserializer.class) +@JsonSerialize(using = DashboardSummaryID.DashboardSummaryIDSerializer.class) +public class DashboardSummaryID extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(DashboardSummaryID.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class DashboardSummaryIDSerializer extends StdSerializer { + public DashboardSummaryIDSerializer(Class t) { + super(t); + } + + public DashboardSummaryIDSerializer() { + this(null); + } + + @Override + public void serialize(DashboardSummaryID value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class DashboardSummaryIDDeserializer extends StdDeserializer { + public DashboardSummaryIDDeserializer() { + this(DashboardSummaryID.class); + } + + public DashboardSummaryIDDeserializer(Class vc) { + super(vc); + } + + @Override + public DashboardSummaryID deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize String + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (String.class.equals(Integer.class) + || String.class.equals(Long.class) + || String.class.equals(Float.class) + || String.class.equals(Double.class) + || String.class.equals(Boolean.class) + || String.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((String.class.equals(Integer.class) || String.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((String.class.equals(Float.class) || String.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (String.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (String.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(String.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + deserialized = tmp; + match++; + + log.log(Level.FINER, "Input data matches schema 'String'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'String'", e); + } + + // deserialize Long + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Long.class.equals(Integer.class) + || Long.class.equals(Long.class) + || Long.class.equals(Float.class) + || Long.class.equals(Double.class) + || Long.class.equals(Boolean.class) + || Long.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((Long.class.equals(Integer.class) || Long.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((Long.class.equals(Float.class) || Long.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (Long.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Long.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(Long.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + deserialized = tmp; + match++; + + log.log(Level.FINER, "Input data matches schema 'Long'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Long'", e); + } + + DashboardSummaryID ret = new DashboardSummaryID(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public DashboardSummaryID getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "DashboardSummaryID cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public DashboardSummaryID() { + super("oneOf", Boolean.FALSE); + } + + public DashboardSummaryID(String o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public DashboardSummaryID(Long o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("String", new GenericType() {}); + schemas.put("Long", new GenericType() {}); + JSON.registerDescendants(DashboardSummaryID.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return DashboardSummaryID.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: String, Long + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(String.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(Long.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be String, Long"); + } + + /** + * Get the actual instance, which can be the following: String, Long + * + * @return The actual instance (String, Long) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String) super.getActualInstance(); + } + + /** + * Get the actual instance of `Long`. If the actual instance is not `Long`, the ClassCastException + * will be thrown. + * + * @return The actual instance of `Long` + * @throws ClassCastException if the instance is not `Long` + */ + public Long getLong() throws ClassCastException { + return (Long) super.getActualInstance(); + } +} diff --git a/src/test/java/com/datadog/api/ClientSteps.java b/src/test/java/com/datadog/api/ClientSteps.java index a272a06584c..ce021689558 100644 --- a/src/test/java/com/datadog/api/ClientSteps.java +++ b/src/test/java/com/datadog/api/ClientSteps.java @@ -119,7 +119,7 @@ public void anInstanceOfAPI(String apiName) java.lang.NoSuchMethodException, java.lang.reflect.InvocationTargetException { apiName = apiName.replace("-", ""); - world.setupAPI(apiVersion, World.toClassName(apiName)); + world.setupAPI(world.getOperationVersion(), World.toClassName(apiName)); } @Given("operation {string} enabled") @@ -165,6 +165,20 @@ public void newRequest(String methodName) if (!TestRunner.runnerEnabled()) world.newRequest(methodName); } + @Given("new {string} with version {string} request") + public void newVersionedRequest(String methodName, String version) + throws java.lang.ClassNotFoundException, + java.lang.InstantiationException, + java.lang.IllegalAccessException, + java.lang.NoSuchMethodException, + java.lang.reflect.InvocationTargetException { + world.setOperationVersion(version); + if (!TestRunner.runnerEnabled()) { + world.setupAPI(world.getOperationVersion(), world.apiName); + world.newRequest(methodName); + } + } + @Given("request contains {string} parameter from {string}") public void requestContainsParameterFrom(String parameterName, String fixturePath) throws java.lang.IllegalAccessException, @@ -306,8 +320,15 @@ public void theResponseHasTheSameValueAs(String responsePath, String fixturePath java.lang.ClassNotFoundException, java.lang.NoSuchFieldException { Object responseData = world.responseClass.getMethod("getData").invoke(world.response); - assertEquals( - World.lookup(world.context, fixturePath), World.lookup(responseData, responsePath)); + Object expected = World.lookup(world.context, fixturePath); + Object actual = World.lookup(responseData, responsePath); + if (expected instanceof AbstractOpenApiSchema) { + expected = ((AbstractOpenApiSchema) expected).getActualInstanceRecursively(); + } + if (actual instanceof AbstractOpenApiSchema) { + actual = ((AbstractOpenApiSchema) actual).getActualInstanceRecursively(); + } + assertEquals(expected, actual); } @Then("the response {string} has length {long}") diff --git a/src/test/java/com/datadog/api/TestRunner.java b/src/test/java/com/datadog/api/TestRunner.java index b3213a0473f..d9341327a24 100644 --- a/src/test/java/com/datadog/api/TestRunner.java +++ b/src/test/java/com/datadog/api/TestRunner.java @@ -151,8 +151,13 @@ public static void applyPlan(World world, boolean pagination) throws Exception { throw new IllegalStateException("Generated request plan pagination mismatch"); } + if (plan.get("operation_version") != null) { + world.setOperationVersion(plan.get("operation_version").toString()); + } + world.setupAPI( - world.getVersion(), World.toClassName(plan.get("api").toString().replace("-", ""))); + world.getOperationVersion(), + World.toClassName(plan.get("api").toString().replace("-", ""))); world.newRequest(plan.get("operation_id").toString()); List> parameters = (List>) request.get("parameters"); diff --git a/src/test/java/com/datadog/api/World.java b/src/test/java/com/datadog/api/World.java index 3f892c87dd7..ee804b4a125 100644 --- a/src/test/java/com/datadog/api/World.java +++ b/src/test/java/com/datadog/api/World.java @@ -35,6 +35,8 @@ public class World { // Specific API information Class apiClass; public Object api; + String apiName; + String operationVersion; // Templating context public Map context; @@ -143,6 +145,14 @@ public String getVersion() { throw new IllegalStateException("API version not found in " + scenario.getUri()); } + public void setOperationVersion(String version) { + operationVersion = getVersion() + "_" + version.replace("-", ""); + } + + public String getOperationVersion() { + return operationVersion == null ? getVersion() : operationVersion; + } + private void configureClient(Class clientClass, Object client) throws java.lang.reflect.InvocationTargetException, java.lang.IllegalAccessException, @@ -236,6 +246,7 @@ public void setupAPI(String apiVersion, String apiName) java.lang.NoSuchMethodException, java.lang.reflect.InvocationTargetException { // import com.datadog.api.{{ apiVersion }}.client.api.{{ apiName }}Api + this.apiName = apiName; apiClass = Class.forName("com.datadog.api.client." + apiVersion + ".api." + apiName + "Api"); // api = new {{ apiName }}Api(client) api = apiClass.getConstructor(clientClass).newInstance(client); 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 afe8356d4cd..823ff6b6b2b 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 @@ -1374,6 +1374,8 @@ Feature: Dashboards Then the response status is 200 OK And the response "dashboards[0].title" has the same value as "dashboard.title" And the response "dashboards[0].id" has the same value as "dashboard.id" + And the response "dashboards[0]" has field "layout_type" + And the response "dashboards[0]" does not have field "popularity" @replay-only @skip-validation @team:DataDog/dashboards-backend @with-pagination Scenario: Get all dashboards returns "OK" response with pagination @@ -1383,6 +1385,18 @@ Feature: Dashboards Then the response status is 200 OK And the response has 3 items + @replay-only @team:DataDog/dashboards-backend + Scenario: Get all dashboards with version "2027-01-01" returns "OK" response + Given new "ListDashboards" with version "2027-01-01" request + And there is a valid "dashboard" in the system + And request contains "filter[shared]" parameter with value false + When the request is sent + Then the response status is 200 OK + And the response "dashboards[0].title" has the same value as "dashboard.title" + And the response "dashboards[0].id" has the same value as "dashboard.id" + And the response "dashboards[0]" has field "popularity" + And the response "dashboards[0]" does not have field "layout_type" + @generated @skip @team:DataDog/reporting-and-sharing Scenario: Get all invitations for a shared dashboard returns "Not Found" response Given new "GetPublicDashboardInvitations" request diff --git a/src/test/resources/generated-test/test-runner-data/manifest.json b/src/test/resources/generated-test/test-runner-data/manifest.json index 532fe647f8d..98223d5d653 100644 --- a/src/test/resources/generated-test/test-runner-data/manifest.json +++ b/src/test/resources/generated-test/test-runner-data/manifest.json @@ -952,6 +952,13 @@ "scenario": "Get all dashboards returns \"OK\" response with pagination", "version": "v1" }, + { + "feature": "Dashboards", + "feature_file": "../../com/datadog/api/client/v1/api/dashboards.feature", + "file": "v1/dashboards/get-all-dashboards-with-version-2027-01-01-returns-ok-response.json", + "scenario": "Get all dashboards with version \"2027-01-01\" returns \"OK\" response", + "version": "v1" + }, { "feature": "Dashboards", "feature_file": "../../com/datadog/api/client/v1/api/dashboards.feature", diff --git a/src/test/resources/generated-test/test-runner-data/v1/dashboards/get-all-dashboards-with-version-2027-01-01-returns-ok-response.json b/src/test/resources/generated-test/test-runner-data/v1/dashboards/get-all-dashboards-with-version-2027-01-01-returns-ok-response.json new file mode 100644 index 00000000000..477b170e25a --- /dev/null +++ b/src/test/resources/generated-test/test-runner-data/v1/dashboards/get-all-dashboards-with-version-2027-01-01-returns-ok-response.json @@ -0,0 +1,36 @@ +{ + "api": "Dashboards", + "expected_status": 200, + "feature": "Dashboards", + "id": "v1/Dashboards/Get all dashboards with version \"2027-01-01\" returns \"OK\" response", + "operation_id": "ListDashboards", + "operation_version": "2027-01-01", + "request": { + "body": null, + "content_type": null, + "method": "GET", + "pagination": false, + "parameters": [ + { + "explode": null, + "in": "query", + "name": "filter[shared]", + "required": false, + "schema": { + "format": null, + "ref": null, + "type": "boolean" + }, + "source": { + "type": "literal", + "value": false + }, + "style": null + } + ], + "path": "/api/v1/dashboard" + }, + "scenario": "Get all dashboards with version \"2027-01-01\" returns \"OK\" response", + "schema_version": 1, + "version": "v1" +} diff --git a/src/test/resources/generated-test/test-server-data/v1/dashboards.json b/src/test/resources/generated-test/test-server-data/v1/dashboards.json index db1ac171665..3401f8c28eb 100644 --- a/src/test/resources/generated-test/test-server-data/v1/dashboards.json +++ b/src/test/resources/generated-test/test-server-data/v1/dashboards.json @@ -12107,6 +12107,122 @@ "scenario": "Get all dashboards returns \"OK\" response with pagination", "version": "v1" }, + { + "feature": "Dashboards", + "frozen_at": "2026-08-31T12:55:49.861Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "layout_type": "ordered", + "title": "Test-Get_all_dashboards_with_version_2027_01_01_returns_OK_response-1788180949 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" + } + } + ] + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v1/dashboard", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"id\":\"3ig-3cz-upi\",\"title\":\"Test-Get_all_dashboards_with_version_2027_01_01_returns_OK_response-1788180949 with Profile Metrics Query\",\"description\":null,\"author_handle\":\"frog@datadoghq.com\",\"author_name\":null,\"layout_type\":\"ordered\",\"url\":\"/dashboard/3ig-3cz-upi/test-getalldashboardswithversion20270101returnsokresponse-1788180949-with-profil\",\"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\":5095764361376494}],\"notify_list\":null,\"created_at\":\"2026-08-31T12:55:50.697197+00:00\",\"modified_at\":\"2026-08-31T12:55:50.697197+00:00\",\"restricted_roles\":[]}" + }, + "headers": { + "content-type": "application/json" + }, + "reason": "OK", + "status": 200 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "GET", + "path": "/api/v1/dashboard", + "query": [ + [ + "filter[shared]", + "false" + ] + ] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"total\":1,\"dashboards\":[{\"id\":\"3ig-3cz-upi\",\"title\":\"Test-Get_all_dashboards_with_version_2027_01_01_returns_OK_response-1788180949 with Profile Metrics Query\",\"popularity\":0}]}\n" + }, + "headers": { + "content-type": "application/json" + }, + "reason": "OK", + "status": 200 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "DELETE", + "path": "/api/v1/dashboard/3ig-3cz-upi", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"deleted_dashboard_id\":\"3ig-3cz-upi\"}" + }, + "headers": { + "content-type": "application/json" + }, + "reason": "OK", + "status": 200 + } + } + ], + "scenario": "Get all dashboards with version \"2027-01-01\" returns \"OK\" response", + "version": "v1" + }, { "feature": "Dashboards", "frozen_at": "2024-11-15T19:33:07.625Z",