diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 52c5ef104a4..7f143003a39 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -86739,6 +86739,89 @@ components: required: - data type: object + StegadographyGetWidgetsRequest: + description: Multipart form data containing the PNG image to scan for watermarks. + properties: + image: + description: PNG image file to scan for embedded watermarks. + example: "screenshot.png" + format: binary + type: string + required: + - image + type: object + StegadographyGetWidgetsResponse: + description: Response containing watermarked widgets recovered from an image. + properties: + data: + $ref: "#/components/schemas/StegadographyWidgetItems" + required: + - data + type: object + StegadographyWidget: + description: A single watermarked widget resource recovered from an image. + properties: + attributes: + $ref: "#/components/schemas/StegadographyWidgetAttributes" + id: + description: Composite identifier formed from the organization ID and watermark, separated by a colon. + example: "abc123:0123456789abcdef" + type: string + type: + $ref: "#/components/schemas/StegadographyWidgetType" + required: + - id + - type + - attributes + type: object + StegadographyWidgetAttributes: + description: Attributes of a watermarked widget recovered from an image. + properties: + locationx: + description: Horizontal pixel coordinate where the watermark was found in the image. + example: 100 + format: int64 + type: integer + locationy: + description: Vertical pixel coordinate where the watermark was found in the image. + example: 200 + format: int64 + type: integer + rawData: + description: JSON-encoded string representing the widget state. + example: '{"widgetType":"timeseries","requests":[]}' + type: string + watermark: + description: Hex-encoded watermark string identifying the widget. + example: "0123456789abcdef" + type: string + required: + - rawData + - watermark + - locationx + - locationy + type: object + StegadographyWidgetItems: + description: List of watermarked widget resources recovered from an image. + example: + - attributes: + locationx: 100 + locationy: 200 + rawData: '{"widgetType":"timeseries","requests":[]}' + watermark: "0123456789abcdef" + id: "abc123:0123456789abcdef" + type: widget + items: + $ref: "#/components/schemas/StegadographyWidget" + type: array + StegadographyWidgetType: + description: Stegadography widget resource type. + enum: + - widget + example: widget + type: string + x-enum-varnames: + - WIDGET Step: description: A Step is a sub-component of a workflow. Each Step performs an action. properties: @@ -167338,6 +167421,75 @@ paths: - status_pages_settings_write - status_pages_public_page_publish - status_pages_internal_page_publish + /api/v2/stegadography/get-widgets: + post: + description: |- + Extracts watermarks from a PNG image and returns the cached widget data + associated with each watermark found. The image must be uploaded as a + `multipart/form-data` request with the file in the `image` field. + Only widgets belonging to the authenticated organization are returned. + operationId: GetStegadographyWidgets + requestBody: + content: + multipart/form-data: + examples: + default: + value: + image: "screenshot.png" + schema: + $ref: "#/components/schemas/StegadographyGetWidgetsRequest" + description: PNG image to extract watermarks from. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + locationx: 100 + locationy: 200 + rawData: '{"widgetType":"timeseries","requests":[]}' + watermark: "0123456789abcdef" + id: "abc123:0123456789abcdef" + type: widget + schema: + $ref: "#/components/schemas/StegadographyGetWidgetsResponse" + 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 /api/v2/synthetics/api-multistep/subtests/{public_id}: get: description: |- @@ -175651,6 +175803,8 @@ tags: externalDocs: url: https://docs.datadoghq.com/api/latest/statuspage-integration name: Statuspage Integration + - description: Extract watermarks embedded in dashboard screenshots to retrieve cached widget state. + 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/GetStegadographyWidgets.java b/examples/v2/stegadography/GetStegadographyWidgets.java new file mode 100644 index 00000000000..228c04771fe --- /dev/null +++ b/examples/v2/stegadography/GetStegadographyWidgets.java @@ -0,0 +1,26 @@ +// 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.StegadographyGetWidgetsResponse; +import java.io.File; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + StegadographyApi apiInstance = new StegadographyApi(defaultClient); + + try { + StegadographyGetWidgetsResponse result = + apiInstance.getStegadographyWidgets(new File("fixtures/stegadography/image.png")); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StegadographyApi#getStegadographyWidgets"); + 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/v2/api/StegadographyApi.java b/src/main/java/com/datadog/api/client/v2/api/StegadographyApi.java new file mode 100644 index 00000000000..c7a1189948f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/StegadographyApi.java @@ -0,0 +1,195 @@ +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.StegadographyGetWidgetsResponse; +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; + } + + /** + * Get widgets from an image. + * + *

See {@link #getStegadographyWidgetsWithHttpInfo}. + * + * @param image PNG image file to scan for embedded watermarks. (required) + * @return StegadographyGetWidgetsResponse + * @throws ApiException if fails to make API call + */ + public StegadographyGetWidgetsResponse getStegadographyWidgets(File image) throws ApiException { + return getStegadographyWidgetsWithHttpInfo(image).getData(); + } + + /** + * Get widgets from an image. + * + *

See {@link #getStegadographyWidgetsWithHttpInfoAsync}. + * + * @param image PNG image file to scan for embedded watermarks. (required) + * @return CompletableFuture<StegadographyGetWidgetsResponse> + */ + public CompletableFuture getStegadographyWidgetsAsync( + File image) { + return getStegadographyWidgetsWithHttpInfoAsync(image) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Extracts watermarks from a PNG image and returns the cached widget data associated with each + * watermark found. The image must be uploaded as a multipart/form-data request with + * the file in the image field. Only widgets belonging to the authenticated + * organization are returned. + * + * @param image PNG image file to scan for embedded watermarks. (required) + * @return ApiResponse<StegadographyGetWidgetsResponse> + * @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 getStegadographyWidgetsWithHttpInfo( + File image) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'image' is set + if (image == null) { + throw new ApiException( + 400, "Missing the required parameter 'image' when calling getStegadographyWidgets"); + } + // 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.getStegadographyWidgets", + 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 #getStegadographyWidgetsWithHttpInfo}. + * + * @param image PNG image file to scan for embedded watermarks. (required) + * @return CompletableFuture<ApiResponse<StegadographyGetWidgetsResponse>> + */ + public CompletableFuture> + getStegadographyWidgetsWithHttpInfoAsync(File image) { + Object localVarPostBody = null; + + // verify the required parameter 'image' is set + if (image == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'image' when calling getStegadographyWidgets")); + return result; + } + // 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.getStegadographyWidgets", + 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/StegadographyGetWidgetsRequest.java b/src/main/java/com/datadog/api/client/v2/model/StegadographyGetWidgetsRequest.java new file mode 100644 index 00000000000..40c1883b835 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/StegadographyGetWidgetsRequest.java @@ -0,0 +1,146 @@ +/* + * 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.io.File; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Multipart form data containing the PNG image to scan for watermarks. */ +@JsonPropertyOrder({StegadographyGetWidgetsRequest.JSON_PROPERTY_IMAGE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class StegadographyGetWidgetsRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_IMAGE = "image"; + private File image; + + public StegadographyGetWidgetsRequest() {} + + @JsonCreator + public StegadographyGetWidgetsRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_IMAGE) File image) { + this.image = image; + } + + public StegadographyGetWidgetsRequest image(File image) { + this.image = image; + return this; + } + + /** + * PNG image file to scan for embedded watermarks. + * + * @return image + */ + @JsonProperty(JSON_PROPERTY_IMAGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + 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 StegadographyGetWidgetsRequest + */ + @JsonAnySetter + public StegadographyGetWidgetsRequest 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 StegadographyGetWidgetsRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StegadographyGetWidgetsRequest stegadographyGetWidgetsRequest = + (StegadographyGetWidgetsRequest) o; + return Objects.equals(this.image, stegadographyGetWidgetsRequest.image) + && Objects.equals( + this.additionalProperties, stegadographyGetWidgetsRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(image, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StegadographyGetWidgetsRequest {\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/StegadographyGetWidgetsResponse.java b/src/main/java/com/datadog/api/client/v2/model/StegadographyGetWidgetsResponse.java new file mode 100644 index 00000000000..12ead50b9f0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/StegadographyGetWidgetsResponse.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 watermarked widgets recovered from an image. */ +@JsonPropertyOrder({StegadographyGetWidgetsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class StegadographyGetWidgetsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public StegadographyGetWidgetsResponse() {} + + @JsonCreator + public StegadographyGetWidgetsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) List data) { + this.data = data; + } + + public StegadographyGetWidgetsResponse data(List data) { + this.data = data; + for (StegadographyWidget item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public StegadographyGetWidgetsResponse addDataItem(StegadographyWidget dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * List of watermarked widget resources recovered from an 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 StegadographyGetWidgetsResponse + */ + @JsonAnySetter + public StegadographyGetWidgetsResponse 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 StegadographyGetWidgetsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StegadographyGetWidgetsResponse stegadographyGetWidgetsResponse = + (StegadographyGetWidgetsResponse) o; + return Objects.equals(this.data, stegadographyGetWidgetsResponse.data) + && Objects.equals( + this.additionalProperties, stegadographyGetWidgetsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StegadographyGetWidgetsResponse {\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/main/java/com/datadog/api/client/v2/model/StegadographyWidget.java b/src/main/java/com/datadog/api/client/v2/model/StegadographyWidget.java new file mode 100644 index 00000000000..81f9b4e9c65 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/StegadographyWidget.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 watermarked widget resource recovered from an image. */ +@JsonPropertyOrder({ + StegadographyWidget.JSON_PROPERTY_ATTRIBUTES, + StegadographyWidget.JSON_PROPERTY_ID, + StegadographyWidget.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class StegadographyWidget { + @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 StegadographyWidget() {} + + @JsonCreator + public StegadographyWidget( + @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 StegadographyWidget attributes(StegadographyWidgetAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of a watermarked widget recovered from an image. + * + * @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 StegadographyWidget id(String id) { + this.id = id; + return this; + } + + /** + * Composite identifier formed from the organization ID and watermark, separated by a colon. + * + * @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 StegadographyWidget type(StegadographyWidgetType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Stegadography 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 StegadographyWidget + */ + @JsonAnySetter + public StegadographyWidget 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 StegadographyWidget object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StegadographyWidget stegadographyWidget = (StegadographyWidget) o; + return Objects.equals(this.attributes, stegadographyWidget.attributes) + && Objects.equals(this.id, stegadographyWidget.id) + && Objects.equals(this.type, stegadographyWidget.type) + && Objects.equals(this.additionalProperties, stegadographyWidget.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StegadographyWidget {\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/StegadographyWidgetAttributes.java b/src/main/java/com/datadog/api/client/v2/model/StegadographyWidgetAttributes.java new file mode 100644 index 00000000000..ef20b63f05b --- /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 watermarked widget recovered from an image. */ +@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 where the watermark was found in 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 where the watermark was found in 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; + } + + /** + * JSON-encoded string representing the widget state. + * + * @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; + } + + /** + * Hex-encoded watermark string identifying the widget. + * + * @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/StegadographyWidgetType.java b/src/main/java/com/datadog/api/client/v2/model/StegadographyWidgetType.java new file mode 100644 index 00000000000..7381be45c82 --- /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; + +/** Stegadography 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/test/resources/com/datadog/api/client/v2/api/fixtures/stegadography/image.png b/src/test/resources/com/datadog/api/client/v2/api/fixtures/stegadography/image.png new file mode 100644 index 00000000000..94381b429d7 Binary files /dev/null and b/src/test/resources/com/datadog/api/client/v2/api/fixtures/stegadography/image.png differ 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..86c2d3a2a8b --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/stegadography.feature @@ -0,0 +1,26 @@ +@endpoint(stegadography) @endpoint(stegadography-v2) +Feature: Stegadography + Extract watermarks embedded in dashboard screenshots to retrieve cached + widget state. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "Stegadography" API + And new "GetStegadographyWidgets" 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 + + @integration-only @skip-terraform-config @skip-validation @team:DataDog/dataviz-backend-maintainers + Scenario: Get widgets from an image returns "OK" response + Given request contains "image" parameter with value "fixtures/stegadography/image.png" + 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..0ba8d5b4fa3 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" } }, + "GetStegadographyWidgets": { + "tag": "Stegadography", + "undo": { + "type": "safe" + } + }, "GetApiMultistepSubtests": { "tag": "Synthetics", "undo": {