From bbead8871702e691b739d0d29ea408d21171ee89 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 2 Jun 2026 22:34:59 +0000 Subject: [PATCH] Regenerate client from commit d03a328 of spec repo --- .generator/schemas/v2/openapi.yaml | 143 +++++++++++ .../v2/stegadography/GetWidgetsFromImage.java | 25 ++ .../com/datadog/api/client/ApiClient.java | 1 + .../api/client/v2/api/StegadographyApi.java | 242 ++++++++++++++++++ .../StegadographyGetWidgetsFormData.java | 138 ++++++++++ .../model/StegadographyWidgetAttributes.java | 230 +++++++++++++++++ .../v2/model/StegadographyWidgetData.java | 209 +++++++++++++++ .../v2/model/StegadographyWidgetType.java | 55 ++++ .../model/StegadographyWidgetsResponse.java | 156 +++++++++++ .../api/client/v2/api/stegadography.feature | 25 ++ .../com/datadog/api/client/v2/api/undo.json | 6 + 11 files changed, 1230 insertions(+) create mode 100644 examples/v2/stegadography/GetWidgetsFromImage.java create mode 100644 src/main/java/com/datadog/api/client/v2/api/StegadographyApi.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/StegadographyGetWidgetsFormData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/StegadographyWidgetAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/StegadographyWidgetData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/StegadographyWidgetType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/StegadographyWidgetsResponse.java create mode 100644 src/test/resources/com/datadog/api/client/v2/api/stegadography.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 52c5ef104a4..2b63bd06dd0 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -86739,6 +86739,77 @@ components: required: - data type: object + StegadographyGetWidgetsFormData: + description: The form data submitted to look up widgets from a watermarked image. + properties: + image: + description: A PNG image (for example, a dashboard screenshot) containing embedded widget watermarks. + format: binary + type: string + x-mimetype: image/png + type: object + StegadographyWidgetAttributes: + description: Attributes of a widget recovered from an image watermark. + properties: + locationx: + description: Horizontal pixel coordinate of the watermark within the image. + example: 120 + format: int64 + type: integer + locationy: + description: Vertical pixel coordinate of the watermark within the image. + example: 240 + format: int64 + type: integer + rawData: + description: Stored snapshot of the widget state, returned exactly as it was cached. + example: '{"definition":{"type":"timeseries"}}' + type: string + watermark: + description: The watermark value extracted from the image that this widget was matched against. + example: "abc123" + type: string + required: + - rawData + - watermark + - locationx + - locationy + type: object + StegadographyWidgetData: + description: A single widget recovered from an image watermark. + properties: + attributes: + $ref: "#/components/schemas/StegadographyWidgetAttributes" + id: + description: Identifier of the cached widget, scoped to the organization. + example: "1a2b:abc123" + type: string + type: + $ref: "#/components/schemas/StegadographyWidgetType" + required: + - id + - type + - attributes + type: object + StegadographyWidgetType: + description: Widget resource type. + enum: + - widget + example: widget + type: string + x-enum-varnames: + - WIDGET + StegadographyWidgetsResponse: + description: Response containing the widgets recovered from the uploaded image. + properties: + data: + description: List of widgets matched to watermarks found in the image. + items: + $ref: "#/components/schemas/StegadographyWidgetData" + type: array + required: + - data + type: object Step: description: A Step is a sub-component of a workflow. Each Step performs an action. properties: @@ -167338,6 +167409,76 @@ paths: - status_pages_settings_write - status_pages_public_page_publish - status_pages_internal_page_publish + /api/v2/stegadography/get-widgets: + post: + description: |- + Extracts embedded watermarks from an uploaded PNG image (for example, a dashboard screenshot) + and returns the cached widget state matching each watermark found. + operationId: GetWidgetsFromImage + requestBody: + content: + multipart/form-data: + examples: + default: + value: {} + schema: + $ref: "#/components/schemas/StegadographyGetWidgetsFormData" + description: The image to extract widget watermarks from. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + locationx: 120 + locationy: 240 + rawData: '{"definition":{"type":"timeseries"}}' + watermark: "abc123" + id: "1a2b:abc123" + type: widget + schema: + $ref: "#/components/schemas/StegadographyWidgetsResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "415": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unsupported Media Type + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Internal Server Error + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Get widgets from an image + tags: + - Stegadography + x-codegen-request-body-name: body + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/synthetics/api-multistep/subtests/{public_id}: get: description: |- @@ -175651,6 +175792,8 @@ tags: externalDocs: url: https://docs.datadoghq.com/api/latest/statuspage-integration name: Statuspage Integration + - description: Recover dashboard widget data from watermarks embedded in images. + name: Stegadography - description: |- Enable Storage Management for S3 buckets, GCS buckets, and Azure containers. Each configuration registers the destination that holds inventory reports for the storage being monitored. name: Storage Management diff --git a/examples/v2/stegadography/GetWidgetsFromImage.java b/examples/v2/stegadography/GetWidgetsFromImage.java new file mode 100644 index 00000000000..54461972581 --- /dev/null +++ b/examples/v2/stegadography/GetWidgetsFromImage.java @@ -0,0 +1,25 @@ +// Get widgets from an image returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.StegadographyApi; +import com.datadog.api.client.v2.model.StegadographyWidgetsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getWidgetsFromImage", true); + StegadographyApi apiInstance = new StegadographyApi(defaultClient); + + try { + StegadographyWidgetsResponse result = apiInstance.getWidgetsFromImage(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StegadographyApi#getWidgetsFromImage"); + 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/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index 0dd1f292e28..fbc41cd8ff1 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -1182,6 +1182,7 @@ public class ApiClient { put("v2.revertCustomRuleRevision", false); put("v2.updateAiCustomRuleset", false); put("v2.updateCustomRuleset", false); + put("v2.getWidgetsFromImage", false); put("v2.addMemberTeam", false); put("v2.listMemberTeams", false); put("v2.removeMemberTeam", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/StegadographyApi.java b/src/main/java/com/datadog/api/client/v2/api/StegadographyApi.java new file mode 100644 index 00000000000..210ce2501b0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/StegadographyApi.java @@ -0,0 +1,242 @@ +package com.datadog.api.client.v2.api; + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.ApiResponse; +import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.StegadographyWidgetsResponse; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +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 StegadographyApi { + private ApiClient apiClient; + + public StegadographyApi() { + this(ApiClient.getDefaultApiClient()); + } + + public StegadographyApi(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 getWidgetsFromImage. */ + public static class GetWidgetsFromImageOptionalParameters { + private File image; + + /** + * Set image. + * + * @param image A PNG image (for example, a dashboard screenshot) containing embedded widget + * watermarks. (optional) + * @return GetWidgetsFromImageOptionalParameters + */ + public GetWidgetsFromImageOptionalParameters image(File image) { + this.image = image; + return this; + } + } + + /** + * Get widgets from an image. + * + *

See {@link #getWidgetsFromImageWithHttpInfo}. + * + * @return StegadographyWidgetsResponse + * @throws ApiException if fails to make API call + */ + public StegadographyWidgetsResponse getWidgetsFromImage() throws ApiException { + return getWidgetsFromImageWithHttpInfo(new GetWidgetsFromImageOptionalParameters()).getData(); + } + + /** + * Get widgets from an image. + * + *

See {@link #getWidgetsFromImageWithHttpInfoAsync}. + * + * @return CompletableFuture<StegadographyWidgetsResponse> + */ + public CompletableFuture getWidgetsFromImageAsync() { + return getWidgetsFromImageWithHttpInfoAsync(new GetWidgetsFromImageOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get widgets from an image. + * + *

See {@link #getWidgetsFromImageWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return StegadographyWidgetsResponse + * @throws ApiException if fails to make API call + */ + public StegadographyWidgetsResponse getWidgetsFromImage( + GetWidgetsFromImageOptionalParameters parameters) throws ApiException { + return getWidgetsFromImageWithHttpInfo(parameters).getData(); + } + + /** + * Get widgets from an image. + * + *

See {@link #getWidgetsFromImageWithHttpInfoAsync}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<StegadographyWidgetsResponse> + */ + public CompletableFuture getWidgetsFromImageAsync( + GetWidgetsFromImageOptionalParameters parameters) { + return getWidgetsFromImageWithHttpInfoAsync(parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Extracts embedded watermarks from an uploaded PNG image (for example, a dashboard screenshot) + * and returns the cached widget state matching each watermark found. + * + * @param parameters Optional parameters for the request. + * @return ApiResponse<StegadographyWidgetsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
415 Unsupported Media Type -
429 Too many requests -
500 Internal Server Error -
+ */ + public ApiResponse getWidgetsFromImageWithHttpInfo( + GetWidgetsFromImageOptionalParameters parameters) throws ApiException { + // Check if unstable operation is enabled + String operationId = "getWidgetsFromImage"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + File image = parameters.image; + // create path and map variables + String localVarPath = "/api/v2/stegadography/get-widgets"; + + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (image != null) { + localVarFormParams.put("image", image); + } + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.StegadographyApi.getWidgetsFromImage", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"multipart/form-data"}, + localVarPostBody, + localVarFormParams, + false, + new GenericType() {}); + } + + /** + * Get widgets from an image. + * + *

See {@link #getWidgetsFromImageWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<StegadographyWidgetsResponse>> + */ + public CompletableFuture> + getWidgetsFromImageWithHttpInfoAsync(GetWidgetsFromImageOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "getWidgetsFromImage"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + File image = parameters.image; + // create path and map variables + String localVarPath = "/api/v2/stegadography/get-widgets"; + + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (image != null) { + localVarFormParams.put("image", image); + } + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.StegadographyApi.getWidgetsFromImage", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"multipart/form-data"}, + localVarPostBody, + localVarFormParams, + false, + new GenericType() {}); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/StegadographyGetWidgetsFormData.java b/src/main/java/com/datadog/api/client/v2/model/StegadographyGetWidgetsFormData.java new file mode 100644 index 00000000000..6fe3cd43f76 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/StegadographyGetWidgetsFormData.java @@ -0,0 +1,138 @@ +/* + * 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.v2.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.io.File; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The form data submitted to look up widgets from a watermarked image. */ +@JsonPropertyOrder({StegadographyGetWidgetsFormData.JSON_PROPERTY_IMAGE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class StegadographyGetWidgetsFormData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_IMAGE = "image"; + private File image; + + public StegadographyGetWidgetsFormData image(File image) { + this.image = image; + return this; + } + + /** + * A PNG image (for example, a dashboard screenshot) containing embedded widget watermarks. + * + * @return image + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_IMAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public File getImage() { + return image; + } + + public void setImage(File image) { + this.image = image; + } + + /** + * 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 StegadographyGetWidgetsFormData + */ + @JsonAnySetter + public StegadographyGetWidgetsFormData 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 StegadographyGetWidgetsFormData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StegadographyGetWidgetsFormData stegadographyGetWidgetsFormData = + (StegadographyGetWidgetsFormData) o; + return Objects.equals(this.image, stegadographyGetWidgetsFormData.image) + && Objects.equals( + this.additionalProperties, stegadographyGetWidgetsFormData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(image, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StegadographyGetWidgetsFormData {\n"); + sb.append(" image: ").append(toIndentedString(image)).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/v2/model/StegadographyWidgetAttributes.java b/src/main/java/com/datadog/api/client/v2/model/StegadographyWidgetAttributes.java new file mode 100644 index 00000000000..eb4b2ba03af --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/StegadographyWidgetAttributes.java @@ -0,0 +1,230 @@ +/* + * 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.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Attributes of a widget recovered from an image watermark. */ +@JsonPropertyOrder({ + StegadographyWidgetAttributes.JSON_PROPERTY_LOCATIONX, + StegadographyWidgetAttributes.JSON_PROPERTY_LOCATIONY, + StegadographyWidgetAttributes.JSON_PROPERTY_RAW_DATA, + StegadographyWidgetAttributes.JSON_PROPERTY_WATERMARK +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class StegadographyWidgetAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_LOCATIONX = "locationx"; + private Long locationx; + + public static final String JSON_PROPERTY_LOCATIONY = "locationy"; + private Long locationy; + + public static final String JSON_PROPERTY_RAW_DATA = "rawData"; + private String rawData; + + public static final String JSON_PROPERTY_WATERMARK = "watermark"; + private String watermark; + + public StegadographyWidgetAttributes() {} + + @JsonCreator + public StegadographyWidgetAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_LOCATIONX) Long locationx, + @JsonProperty(required = true, value = JSON_PROPERTY_LOCATIONY) Long locationy, + @JsonProperty(required = true, value = JSON_PROPERTY_RAW_DATA) String rawData, + @JsonProperty(required = true, value = JSON_PROPERTY_WATERMARK) String watermark) { + this.locationx = locationx; + this.locationy = locationy; + this.rawData = rawData; + this.watermark = watermark; + } + + public StegadographyWidgetAttributes locationx(Long locationx) { + this.locationx = locationx; + return this; + } + + /** + * Horizontal pixel coordinate of the watermark within the image. + * + * @return locationx + */ + @JsonProperty(JSON_PROPERTY_LOCATIONX) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getLocationx() { + return locationx; + } + + public void setLocationx(Long locationx) { + this.locationx = locationx; + } + + public StegadographyWidgetAttributes locationy(Long locationy) { + this.locationy = locationy; + return this; + } + + /** + * Vertical pixel coordinate of the watermark within the image. + * + * @return locationy + */ + @JsonProperty(JSON_PROPERTY_LOCATIONY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getLocationy() { + return locationy; + } + + public void setLocationy(Long locationy) { + this.locationy = locationy; + } + + public StegadographyWidgetAttributes rawData(String rawData) { + this.rawData = rawData; + return this; + } + + /** + * Stored snapshot of the widget state, returned exactly as it was cached. + * + * @return rawData + */ + @JsonProperty(JSON_PROPERTY_RAW_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getRawData() { + return rawData; + } + + public void setRawData(String rawData) { + this.rawData = rawData; + } + + public StegadographyWidgetAttributes watermark(String watermark) { + this.watermark = watermark; + return this; + } + + /** + * The watermark value extracted from the image that this widget was matched against. + * + * @return watermark + */ + @JsonProperty(JSON_PROPERTY_WATERMARK) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getWatermark() { + return watermark; + } + + public void setWatermark(String watermark) { + this.watermark = watermark; + } + + /** + * 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 StegadographyWidgetAttributes + */ + @JsonAnySetter + public StegadographyWidgetAttributes 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 StegadographyWidgetAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StegadographyWidgetAttributes stegadographyWidgetAttributes = (StegadographyWidgetAttributes) o; + return Objects.equals(this.locationx, stegadographyWidgetAttributes.locationx) + && Objects.equals(this.locationy, stegadographyWidgetAttributes.locationy) + && Objects.equals(this.rawData, stegadographyWidgetAttributes.rawData) + && Objects.equals(this.watermark, stegadographyWidgetAttributes.watermark) + && Objects.equals( + this.additionalProperties, stegadographyWidgetAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(locationx, locationy, rawData, watermark, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StegadographyWidgetAttributes {\n"); + sb.append(" locationx: ").append(toIndentedString(locationx)).append("\n"); + sb.append(" locationy: ").append(toIndentedString(locationy)).append("\n"); + sb.append(" rawData: ").append(toIndentedString(rawData)).append("\n"); + sb.append(" watermark: ").append(toIndentedString(watermark)).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/v2/model/StegadographyWidgetData.java b/src/main/java/com/datadog/api/client/v2/model/StegadographyWidgetData.java new file mode 100644 index 00000000000..03760772879 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/StegadographyWidgetData.java @@ -0,0 +1,209 @@ +/* + * 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.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A single widget recovered from an image watermark. */ +@JsonPropertyOrder({ + StegadographyWidgetData.JSON_PROPERTY_ATTRIBUTES, + StegadographyWidgetData.JSON_PROPERTY_ID, + StegadographyWidgetData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class StegadographyWidgetData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private StegadographyWidgetAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private StegadographyWidgetType type; + + public StegadographyWidgetData() {} + + @JsonCreator + public StegadographyWidgetData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + StegadographyWidgetAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) StegadographyWidgetType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public StegadographyWidgetData attributes(StegadographyWidgetAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of a widget recovered from an image watermark. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public StegadographyWidgetAttributes getAttributes() { + return attributes; + } + + public void setAttributes(StegadographyWidgetAttributes attributes) { + this.attributes = attributes; + } + + public StegadographyWidgetData id(String id) { + this.id = id; + return this; + } + + /** + * Identifier of the cached widget, scoped to the organization. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public StegadographyWidgetData type(StegadographyWidgetType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Widget resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public StegadographyWidgetType getType() { + return type; + } + + public void setType(StegadographyWidgetType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = 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. + */ + 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 StegadographyWidgetData + */ + @JsonAnySetter + public StegadographyWidgetData 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 StegadographyWidgetData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StegadographyWidgetData stegadographyWidgetData = (StegadographyWidgetData) o; + return Objects.equals(this.attributes, stegadographyWidgetData.attributes) + && Objects.equals(this.id, stegadographyWidgetData.id) + && Objects.equals(this.type, stegadographyWidgetData.type) + && Objects.equals(this.additionalProperties, stegadographyWidgetData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StegadographyWidgetData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).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/v2/model/StegadographyWidgetType.java b/src/main/java/com/datadog/api/client/v2/model/StegadographyWidgetType.java new file mode 100644 index 00000000000..c7a509f15ab --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/StegadographyWidgetType.java @@ -0,0 +1,55 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Widget resource type. */ +@JsonSerialize(using = StegadographyWidgetType.StegadographyWidgetTypeSerializer.class) +public class StegadographyWidgetType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("widget")); + + public static final StegadographyWidgetType WIDGET = new StegadographyWidgetType("widget"); + + StegadographyWidgetType(String value) { + super(value, allowedValues); + } + + public static class StegadographyWidgetTypeSerializer + extends StdSerializer { + public StegadographyWidgetTypeSerializer(Class t) { + super(t); + } + + public StegadographyWidgetTypeSerializer() { + this(null); + } + + @Override + public void serialize( + StegadographyWidgetType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static StegadographyWidgetType fromValue(String value) { + return new StegadographyWidgetType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/StegadographyWidgetsResponse.java b/src/main/java/com/datadog/api/client/v2/model/StegadographyWidgetsResponse.java new file mode 100644 index 00000000000..cd8a9d2836e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/StegadographyWidgetsResponse.java @@ -0,0 +1,156 @@ +/* + * 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.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Response containing the widgets recovered from the uploaded image. */ +@JsonPropertyOrder({StegadographyWidgetsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class StegadographyWidgetsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public StegadographyWidgetsResponse() {} + + @JsonCreator + public StegadographyWidgetsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + List data) { + this.data = data; + } + + public StegadographyWidgetsResponse data(List data) { + this.data = data; + for (StegadographyWidgetData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public StegadographyWidgetsResponse addDataItem(StegadographyWidgetData dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * List of widgets matched to watermarks found in the image. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + /** + * 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 StegadographyWidgetsResponse + */ + @JsonAnySetter + public StegadographyWidgetsResponse 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 StegadographyWidgetsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StegadographyWidgetsResponse stegadographyWidgetsResponse = (StegadographyWidgetsResponse) o; + return Objects.equals(this.data, stegadographyWidgetsResponse.data) + && Objects.equals( + this.additionalProperties, stegadographyWidgetsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StegadographyWidgetsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).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/test/resources/com/datadog/api/client/v2/api/stegadography.feature b/src/test/resources/com/datadog/api/client/v2/api/stegadography.feature new file mode 100644 index 00000000000..b33a502f263 --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/stegadography.feature @@ -0,0 +1,25 @@ +@endpoint(stegadography) @endpoint(stegadography-v2) +Feature: Stegadography + Recover dashboard widget data from watermarks embedded in images. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "Stegadography" API + And operation "GetWidgetsFromImage" enabled + And new "GetWidgetsFromImage" request + + @generated @skip @team:DataDog/dataviz-backend-maintainers + Scenario: Get widgets from an image returns "Bad Request" response + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/dataviz-backend-maintainers + Scenario: Get widgets from an image returns "OK" response + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/dataviz-backend-maintainers + Scenario: Get widgets from an image returns "Unsupported Media Type" response + When the request is sent + Then the response status is 415 Unsupported Media Type diff --git a/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index f60cf1a2f73..ba316f6d900 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/undo.json @@ -7918,6 +7918,12 @@ "type": "idempotent" } }, + "GetWidgetsFromImage": { + "tag": "Stegadography", + "undo": { + "type": "safe" + } + }, "GetApiMultistepSubtests": { "tag": "Synthetics", "undo": {