diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 731b9e51606..6bfc10500d6 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -24622,6 +24622,184 @@ components: - findings - project type: object + CreateSnapshotAdditionalConfig: + description: Additional configuration options for snapshot creation. + properties: + template_variables: + $ref: "#/components/schemas/CreateSnapshotTemplateVariables" + timeseries_legend_type: + $ref: "#/components/schemas/CreateSnapshotTimeseriesLegendType" + timezone_offset_minutes: + description: Timezone offset in minutes from UTC. Positive values are west of UTC (for example, `300` for UTC-5). Use `0` for UTC. + example: 300 + format: int64 + type: integer + type: object + CreateSnapshotDataAttributesRequest: + description: Attributes for snapshot creation. + properties: + additional_config: + $ref: "#/components/schemas/CreateSnapshotAdditionalConfig" + end: + description: End of the time window for the snapshot, in milliseconds since Unix epoch. + example: 1692464800000 + format: int64 + type: integer + height: + description: The height of the rendered snapshot in pixels. + example: 185 + format: int64 + type: integer + is_authenticated: + description: Whether the snapshot requires authentication to view. Authenticated snapshots are scoped to the creating organization. + example: false + type: boolean + start: + description: Start of the time window for the snapshot, in milliseconds since Unix epoch. + example: 1692464000000 + format: int64 + type: integer + ttl: + $ref: "#/components/schemas/CreateSnapshotTTL" + widget_definition: + additionalProperties: {} + description: The widget definition to render as a snapshot. Must include a valid `type` field and non-empty `requests` array. + example: + requests: + - q: "avg:system.cpu.user{*}" + type: timeseries + type: object + width: + description: The width of the rendered snapshot in pixels. + example: 300 + format: int64 + type: integer + required: + - widget_definition + - start + - end + type: object + CreateSnapshotDataAttributesResponse: + description: Attributes of the created snapshot. + properties: + url: + description: The URL to access the rendered snapshot image. + example: https://app.datadoghq.com/api/v2/snapshot/view/public/60d/00000000-0000-0000-0000-000000000000/1692464400000-12345678-1234-5678-9abc-def123456789.png + type: string + required: + - url + type: object + CreateSnapshotDataRequest: + description: Data envelope for snapshot creation. + properties: + attributes: + $ref: "#/components/schemas/CreateSnapshotDataAttributesRequest" + type: + $ref: "#/components/schemas/CreateSnapshotType" + required: + - type + - attributes + type: object + CreateSnapshotDataResponse: + description: Data envelope for the snapshot creation response. + properties: + attributes: + $ref: "#/components/schemas/CreateSnapshotDataAttributesResponse" + id: + description: The unique identifier of the created snapshot. + example: 12345678-1234-5678-9abc-def123456789 + type: string + type: + $ref: "#/components/schemas/CreateSnapshotType" + required: + - id + - type + - attributes + type: object + CreateSnapshotRequest: + description: Request body for creating a graph snapshot. + properties: + data: + $ref: "#/components/schemas/CreateSnapshotDataRequest" + required: + - data + type: object + CreateSnapshotResponse: + description: Response body for a snapshot creation request. + properties: + data: + $ref: "#/components/schemas/CreateSnapshotDataResponse" + required: + - data + type: object + CreateSnapshotTTL: + description: The time-to-live for the snapshot. This value corresponds to storage lifecycle policies that automatically delete the snapshot after the specified period. + enum: + - 30d + - 60d + - 90d + - 1y + - 2y + - inf + example: 60d + type: string + x-enum-varnames: + - THIRTY_DAYS + - SIXTY_DAYS + - NINETY_DAYS + - ONE_YEAR + - TWO_YEARS + - INFINITE + CreateSnapshotTemplateVariable: + description: A template variable definition for snapshot rendering. + properties: + name: + description: The template variable name. + example: host + type: string + prefix: + description: The tag prefix associated with the template variable. For example, a prefix of `host` with a value of `web-server-1` scopes the snapshot to `host:web-server-1`. + example: host + type: string + values: + description: The list of scoped values for this template variable. + example: + - web-server-1 + - web-server-2 + items: + description: A single scoped value for the template variable. + type: string + type: array + required: + - name + - prefix + - values + type: object + CreateSnapshotTemplateVariables: + description: List of template variable definitions for snapshot rendering. + items: + $ref: "#/components/schemas/CreateSnapshotTemplateVariable" + type: array + CreateSnapshotTimeseriesLegendType: + description: The legend display type for timeseries widgets. A value of `none` hides the legend entirely; omitting the field lets the frontend choose automatically. + enum: + - compact + - expanded + - none + example: expanded + type: string + x-enum-varnames: + - COMPACT + - EXPANDED + - NONE + CreateSnapshotType: + description: The type identifier for snapshot creation resources. + enum: + - create_snapshot + example: create_snapshot + type: string + x-enum-varnames: + - CREATE_SNAPSHOT CreateStatusPageRequest: description: Request object for creating a status page. example: @@ -182746,6 +182924,63 @@ paths: x-unstable: |- **Note**: This endpoint is in public beta and it's subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/snapshot: + post: + description: Create a snapshot of a graph widget. The snapshot is rendered asynchronously; the returned URL can be polled until the image is ready. + operationId: CreateSnapshot + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/CreateSnapshotRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + url: https://app.datadoghq.com/api/v2/snapshot/view/public/60d/00000000-0000-0000-0000-000000000000/1692464400000-12345678-1234-5678-9abc-def123456789.png + id: 12345678-1234-5678-9abc-def123456789 + type: create_snapshot + schema: + $ref: "#/components/schemas/CreateSnapshotResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Create a graph snapshot + tags: + - Reporting and Sharing + 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/sourcemaps: delete: description: |- @@ -197019,6 +197254,9 @@ tags: dashboard on a recurring cadence and delivers it to a set of recipients over email, Slack, or Microsoft Teams. name: Report Schedules + - description: |- + The Reporting and Sharing endpoints allow you to create snapshots of graph widgets and other shareable resources. + name: Reporting and Sharing - description: |- A restriction policy defines the access control rules for a resource, mapping a set of relations (such as editor and viewer) to a set of allowed principals (such as roles, teams, or users). diff --git a/examples/v2/reporting-and-sharing/CreateSnapshot.java b/examples/v2/reporting-and-sharing/CreateSnapshot.java new file mode 100644 index 00000000000..fad29a95b9f --- /dev/null +++ b/examples/v2/reporting-and-sharing/CreateSnapshot.java @@ -0,0 +1,66 @@ +// Create a graph snapshot returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.ReportingandSharingApi; +import com.datadog.api.client.v2.model.CreateSnapshotAdditionalConfig; +import com.datadog.api.client.v2.model.CreateSnapshotDataAttributesRequest; +import com.datadog.api.client.v2.model.CreateSnapshotDataRequest; +import com.datadog.api.client.v2.model.CreateSnapshotRequest; +import com.datadog.api.client.v2.model.CreateSnapshotResponse; +import com.datadog.api.client.v2.model.CreateSnapshotTTL; +import com.datadog.api.client.v2.model.CreateSnapshotTemplateVariable; +import com.datadog.api.client.v2.model.CreateSnapshotTimeseriesLegendType; +import com.datadog.api.client.v2.model.CreateSnapshotType; +import java.util.Arrays; +import java.util.Collections; +import java.util.Map; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createSnapshot", true); + ReportingandSharingApi apiInstance = new ReportingandSharingApi(defaultClient); + + CreateSnapshotRequest body = + new CreateSnapshotRequest() + .data( + new CreateSnapshotDataRequest() + .attributes( + new CreateSnapshotDataAttributesRequest() + .additionalConfig( + new CreateSnapshotAdditionalConfig() + .templateVariables( + Collections.singletonList( + new CreateSnapshotTemplateVariable() + .name("host") + .prefix("host") + .values( + Arrays.asList("web-server-1", "web-server-2")))) + .timeseriesLegendType( + CreateSnapshotTimeseriesLegendType.EXPANDED) + .timezoneOffsetMinutes(300L)) + .end(1692464800000L) + .height(185L) + .isAuthenticated(false) + .start(1692464000000L) + .ttl(CreateSnapshotTTL.SIXTY_DAYS) + .widgetDefinition( + Map.ofEntries( + Map.entry("requests", "[{'q': 'avg:system.cpu.user{*}'}]"), + Map.entry("type", "timeseries"))) + .width(300L)) + .type(CreateSnapshotType.CREATE_SNAPSHOT)); + + try { + CreateSnapshotResponse result = apiInstance.createSnapshot(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ReportingandSharingApi#createSnapshot"); + 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 49fff2cecfc..f8d0c42ca93 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -1242,6 +1242,7 @@ public class ApiClient { put("v2.getSLOReport", false); put("v2.getSLOReportJobStatus", false); put("v2.getSloStatus", false); + put("v2.createSnapshot", false); put("v2.getSPARecommendations", false); put("v2.getSPARecommendationsWithShard", false); put("v2.createAiCustomRule", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/ReportingAndSharingApi.java b/src/main/java/com/datadog/api/client/v2/api/ReportingAndSharingApi.java new file mode 100644 index 00000000000..1dd17720f7a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/ReportingAndSharingApi.java @@ -0,0 +1,197 @@ +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.CreateSnapshotRequest; +import com.datadog.api.client.v2.model.CreateSnapshotResponse; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +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 ReportingAndSharingApi { + private ApiClient apiClient; + + public ReportingAndSharingApi() { + this(ApiClient.getDefaultApiClient()); + } + + public ReportingAndSharingApi(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; + } + + /** + * Create a graph snapshot. + * + *

See {@link #createSnapshotWithHttpInfo}. + * + * @param body (required) + * @return CreateSnapshotResponse + * @throws ApiException if fails to make API call + */ + public CreateSnapshotResponse createSnapshot(CreateSnapshotRequest body) throws ApiException { + return createSnapshotWithHttpInfo(body).getData(); + } + + /** + * Create a graph snapshot. + * + *

See {@link #createSnapshotWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<CreateSnapshotResponse> + */ + public CompletableFuture createSnapshotAsync(CreateSnapshotRequest body) { + return createSnapshotWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create a snapshot of a graph widget. The snapshot is rendered asynchronously; the returned URL + * can be polled until the image is ready. + * + * @param body (required) + * @return ApiResponse<CreateSnapshotResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse createSnapshotWithHttpInfo(CreateSnapshotRequest body) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "createSnapshot"; + 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 = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createSnapshot"); + } + // create path and map variables + String localVarPath = "/api/v2/snapshot"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.ReportingAndSharingApi.createSnapshot", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create a graph snapshot. + * + *

See {@link #createSnapshotWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<CreateSnapshotResponse>> + */ + public CompletableFuture> createSnapshotWithHttpInfoAsync( + CreateSnapshotRequest body) { + // Check if unstable operation is enabled + String operationId = "createSnapshot"; + 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 = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling createSnapshot")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/snapshot"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.ReportingAndSharingApi.createSnapshot", + 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[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CreateSnapshotAdditionalConfig.java b/src/main/java/com/datadog/api/client/v2/model/CreateSnapshotAdditionalConfig.java new file mode 100644 index 00000000000..16b77845908 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateSnapshotAdditionalConfig.java @@ -0,0 +1,223 @@ +/* + * 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.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Additional configuration options for snapshot creation. */ +@JsonPropertyOrder({ + CreateSnapshotAdditionalConfig.JSON_PROPERTY_TEMPLATE_VARIABLES, + CreateSnapshotAdditionalConfig.JSON_PROPERTY_TIMESERIES_LEGEND_TYPE, + CreateSnapshotAdditionalConfig.JSON_PROPERTY_TIMEZONE_OFFSET_MINUTES +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreateSnapshotAdditionalConfig { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_TEMPLATE_VARIABLES = "template_variables"; + private List templateVariables = null; + + public static final String JSON_PROPERTY_TIMESERIES_LEGEND_TYPE = "timeseries_legend_type"; + private CreateSnapshotTimeseriesLegendType timeseriesLegendType; + + public static final String JSON_PROPERTY_TIMEZONE_OFFSET_MINUTES = "timezone_offset_minutes"; + private Long timezoneOffsetMinutes; + + public CreateSnapshotAdditionalConfig templateVariables( + List templateVariables) { + this.templateVariables = templateVariables; + for (CreateSnapshotTemplateVariable item : templateVariables) { + this.unparsed |= item.unparsed; + } + return this; + } + + public CreateSnapshotAdditionalConfig addTemplateVariablesItem( + CreateSnapshotTemplateVariable templateVariablesItem) { + if (this.templateVariables == null) { + this.templateVariables = new ArrayList<>(); + } + this.templateVariables.add(templateVariablesItem); + this.unparsed |= templateVariablesItem.unparsed; + return this; + } + + /** + * List of template variable definitions for snapshot rendering. + * + * @return templateVariables + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TEMPLATE_VARIABLES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTemplateVariables() { + return templateVariables; + } + + public void setTemplateVariables(List templateVariables) { + this.templateVariables = templateVariables; + } + + public CreateSnapshotAdditionalConfig timeseriesLegendType( + CreateSnapshotTimeseriesLegendType timeseriesLegendType) { + this.timeseriesLegendType = timeseriesLegendType; + this.unparsed |= !timeseriesLegendType.isValid(); + return this; + } + + /** + * The legend display type for timeseries widgets. A value of none hides the legend + * entirely; omitting the field lets the frontend choose automatically. + * + * @return timeseriesLegendType + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TIMESERIES_LEGEND_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CreateSnapshotTimeseriesLegendType getTimeseriesLegendType() { + return timeseriesLegendType; + } + + public void setTimeseriesLegendType(CreateSnapshotTimeseriesLegendType timeseriesLegendType) { + if (!timeseriesLegendType.isValid()) { + this.unparsed = true; + } + this.timeseriesLegendType = timeseriesLegendType; + } + + public CreateSnapshotAdditionalConfig timezoneOffsetMinutes(Long timezoneOffsetMinutes) { + this.timezoneOffsetMinutes = timezoneOffsetMinutes; + return this; + } + + /** + * Timezone offset in minutes from UTC. Positive values are west of UTC (for example, 300 + * for UTC-5). Use 0 for UTC. + * + * @return timezoneOffsetMinutes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TIMEZONE_OFFSET_MINUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getTimezoneOffsetMinutes() { + return timezoneOffsetMinutes; + } + + public void setTimezoneOffsetMinutes(Long timezoneOffsetMinutes) { + this.timezoneOffsetMinutes = timezoneOffsetMinutes; + } + + /** + * 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 CreateSnapshotAdditionalConfig + */ + @JsonAnySetter + public CreateSnapshotAdditionalConfig 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 CreateSnapshotAdditionalConfig object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateSnapshotAdditionalConfig createSnapshotAdditionalConfig = + (CreateSnapshotAdditionalConfig) o; + return Objects.equals(this.templateVariables, createSnapshotAdditionalConfig.templateVariables) + && Objects.equals( + this.timeseriesLegendType, createSnapshotAdditionalConfig.timeseriesLegendType) + && Objects.equals( + this.timezoneOffsetMinutes, createSnapshotAdditionalConfig.timezoneOffsetMinutes) + && Objects.equals( + this.additionalProperties, createSnapshotAdditionalConfig.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + templateVariables, timeseriesLegendType, timezoneOffsetMinutes, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSnapshotAdditionalConfig {\n"); + sb.append(" templateVariables: ").append(toIndentedString(templateVariables)).append("\n"); + sb.append(" timeseriesLegendType: ") + .append(toIndentedString(timeseriesLegendType)) + .append("\n"); + sb.append(" timezoneOffsetMinutes: ") + .append(toIndentedString(timezoneOffsetMinutes)) + .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/CreateSnapshotDataAttributesRequest.java b/src/main/java/com/datadog/api/client/v2/model/CreateSnapshotDataAttributesRequest.java new file mode 100644 index 00000000000..5a2d216d051 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateSnapshotDataAttributesRequest.java @@ -0,0 +1,366 @@ +/* + * 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 for snapshot creation. */ +@JsonPropertyOrder({ + CreateSnapshotDataAttributesRequest.JSON_PROPERTY_ADDITIONAL_CONFIG, + CreateSnapshotDataAttributesRequest.JSON_PROPERTY_END, + CreateSnapshotDataAttributesRequest.JSON_PROPERTY_HEIGHT, + CreateSnapshotDataAttributesRequest.JSON_PROPERTY_IS_AUTHENTICATED, + CreateSnapshotDataAttributesRequest.JSON_PROPERTY_START, + CreateSnapshotDataAttributesRequest.JSON_PROPERTY_TTL, + CreateSnapshotDataAttributesRequest.JSON_PROPERTY_WIDGET_DEFINITION, + CreateSnapshotDataAttributesRequest.JSON_PROPERTY_WIDTH +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreateSnapshotDataAttributesRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ADDITIONAL_CONFIG = "additional_config"; + private CreateSnapshotAdditionalConfig additionalConfig; + + public static final String JSON_PROPERTY_END = "end"; + private Long end; + + public static final String JSON_PROPERTY_HEIGHT = "height"; + private Long height; + + public static final String JSON_PROPERTY_IS_AUTHENTICATED = "is_authenticated"; + private Boolean isAuthenticated; + + public static final String JSON_PROPERTY_START = "start"; + private Long start; + + public static final String JSON_PROPERTY_TTL = "ttl"; + private CreateSnapshotTTL ttl; + + public static final String JSON_PROPERTY_WIDGET_DEFINITION = "widget_definition"; + private Map widgetDefinition = new HashMap(); + + public static final String JSON_PROPERTY_WIDTH = "width"; + private Long width; + + public CreateSnapshotDataAttributesRequest() {} + + @JsonCreator + public CreateSnapshotDataAttributesRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_END) Long end, + @JsonProperty(required = true, value = JSON_PROPERTY_START) Long start, + @JsonProperty(required = true, value = JSON_PROPERTY_WIDGET_DEFINITION) + Map widgetDefinition) { + this.end = end; + this.start = start; + this.widgetDefinition = widgetDefinition; + } + + public CreateSnapshotDataAttributesRequest additionalConfig( + CreateSnapshotAdditionalConfig additionalConfig) { + this.additionalConfig = additionalConfig; + this.unparsed |= additionalConfig.unparsed; + return this; + } + + /** + * Additional configuration options for snapshot creation. + * + * @return additionalConfig + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ADDITIONAL_CONFIG) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CreateSnapshotAdditionalConfig getAdditionalConfig() { + return additionalConfig; + } + + public void setAdditionalConfig(CreateSnapshotAdditionalConfig additionalConfig) { + this.additionalConfig = additionalConfig; + } + + public CreateSnapshotDataAttributesRequest end(Long end) { + this.end = end; + return this; + } + + /** + * End of the time window for the snapshot, in milliseconds since Unix epoch. + * + * @return end + */ + @JsonProperty(JSON_PROPERTY_END) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getEnd() { + return end; + } + + public void setEnd(Long end) { + this.end = end; + } + + public CreateSnapshotDataAttributesRequest height(Long height) { + this.height = height; + return this; + } + + /** + * The height of the rendered snapshot in pixels. + * + * @return height + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_HEIGHT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getHeight() { + return height; + } + + public void setHeight(Long height) { + this.height = height; + } + + public CreateSnapshotDataAttributesRequest isAuthenticated(Boolean isAuthenticated) { + this.isAuthenticated = isAuthenticated; + return this; + } + + /** + * Whether the snapshot requires authentication to view. Authenticated snapshots are scoped to the + * creating organization. + * + * @return isAuthenticated + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_IS_AUTHENTICATED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getIsAuthenticated() { + return isAuthenticated; + } + + public void setIsAuthenticated(Boolean isAuthenticated) { + this.isAuthenticated = isAuthenticated; + } + + public CreateSnapshotDataAttributesRequest start(Long start) { + this.start = start; + return this; + } + + /** + * Start of the time window for the snapshot, in milliseconds since Unix epoch. + * + * @return start + */ + @JsonProperty(JSON_PROPERTY_START) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getStart() { + return start; + } + + public void setStart(Long start) { + this.start = start; + } + + public CreateSnapshotDataAttributesRequest ttl(CreateSnapshotTTL ttl) { + this.ttl = ttl; + this.unparsed |= !ttl.isValid(); + return this; + } + + /** + * The time-to-live for the snapshot. This value corresponds to storage lifecycle policies that + * automatically delete the snapshot after the specified period. + * + * @return ttl + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TTL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CreateSnapshotTTL getTtl() { + return ttl; + } + + public void setTtl(CreateSnapshotTTL ttl) { + if (!ttl.isValid()) { + this.unparsed = true; + } + this.ttl = ttl; + } + + public CreateSnapshotDataAttributesRequest widgetDefinition( + Map widgetDefinition) { + this.widgetDefinition = widgetDefinition; + return this; + } + + public CreateSnapshotDataAttributesRequest putWidgetDefinitionItem( + String key, Object widgetDefinitionItem) { + this.widgetDefinition.put(key, widgetDefinitionItem); + return this; + } + + /** + * The widget definition to render as a snapshot. Must include a valid type field and + * non-empty requests array. + * + * @return widgetDefinition + */ + @JsonProperty(JSON_PROPERTY_WIDGET_DEFINITION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Map getWidgetDefinition() { + return widgetDefinition; + } + + public void setWidgetDefinition(Map widgetDefinition) { + this.widgetDefinition = widgetDefinition; + } + + public CreateSnapshotDataAttributesRequest width(Long width) { + this.width = width; + return this; + } + + /** + * The width of the rendered snapshot in pixels. + * + * @return width + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_WIDTH) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getWidth() { + return width; + } + + public void setWidth(Long width) { + this.width = width; + } + + /** + * 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 CreateSnapshotDataAttributesRequest + */ + @JsonAnySetter + public CreateSnapshotDataAttributesRequest 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 CreateSnapshotDataAttributesRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateSnapshotDataAttributesRequest createSnapshotDataAttributesRequest = + (CreateSnapshotDataAttributesRequest) o; + return Objects.equals( + this.additionalConfig, createSnapshotDataAttributesRequest.additionalConfig) + && Objects.equals(this.end, createSnapshotDataAttributesRequest.end) + && Objects.equals(this.height, createSnapshotDataAttributesRequest.height) + && Objects.equals(this.isAuthenticated, createSnapshotDataAttributesRequest.isAuthenticated) + && Objects.equals(this.start, createSnapshotDataAttributesRequest.start) + && Objects.equals(this.ttl, createSnapshotDataAttributesRequest.ttl) + && Objects.equals( + this.widgetDefinition, createSnapshotDataAttributesRequest.widgetDefinition) + && Objects.equals(this.width, createSnapshotDataAttributesRequest.width) + && Objects.equals( + this.additionalProperties, createSnapshotDataAttributesRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + additionalConfig, + end, + height, + isAuthenticated, + start, + ttl, + widgetDefinition, + width, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSnapshotDataAttributesRequest {\n"); + sb.append(" additionalConfig: ").append(toIndentedString(additionalConfig)).append("\n"); + sb.append(" end: ").append(toIndentedString(end)).append("\n"); + sb.append(" height: ").append(toIndentedString(height)).append("\n"); + sb.append(" isAuthenticated: ").append(toIndentedString(isAuthenticated)).append("\n"); + sb.append(" start: ").append(toIndentedString(start)).append("\n"); + sb.append(" ttl: ").append(toIndentedString(ttl)).append("\n"); + sb.append(" widgetDefinition: ").append(toIndentedString(widgetDefinition)).append("\n"); + sb.append(" width: ").append(toIndentedString(width)).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/CreateSnapshotDataAttributesResponse.java b/src/main/java/com/datadog/api/client/v2/model/CreateSnapshotDataAttributesResponse.java new file mode 100644 index 00000000000..c5e6b4e1154 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateSnapshotDataAttributesResponse.java @@ -0,0 +1,145 @@ +/* + * 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 the created snapshot. */ +@JsonPropertyOrder({CreateSnapshotDataAttributesResponse.JSON_PROPERTY_URL}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreateSnapshotDataAttributesResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_URL = "url"; + private String url; + + public CreateSnapshotDataAttributesResponse() {} + + @JsonCreator + public CreateSnapshotDataAttributesResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_URL) String url) { + this.url = url; + } + + public CreateSnapshotDataAttributesResponse url(String url) { + this.url = url; + return this; + } + + /** + * The URL to access the rendered snapshot image. + * + * @return url + */ + @JsonProperty(JSON_PROPERTY_URL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = 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 CreateSnapshotDataAttributesResponse + */ + @JsonAnySetter + public CreateSnapshotDataAttributesResponse 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 CreateSnapshotDataAttributesResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateSnapshotDataAttributesResponse createSnapshotDataAttributesResponse = + (CreateSnapshotDataAttributesResponse) o; + return Objects.equals(this.url, createSnapshotDataAttributesResponse.url) + && Objects.equals( + this.additionalProperties, createSnapshotDataAttributesResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(url, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSnapshotDataAttributesResponse {\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/v2/model/CreateSnapshotDataRequest.java b/src/main/java/com/datadog/api/client/v2/model/CreateSnapshotDataRequest.java new file mode 100644 index 00000000000..db86793b9ad --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateSnapshotDataRequest.java @@ -0,0 +1,182 @@ +/* + * 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; + +/** Data envelope for snapshot creation. */ +@JsonPropertyOrder({ + CreateSnapshotDataRequest.JSON_PROPERTY_ATTRIBUTES, + CreateSnapshotDataRequest.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreateSnapshotDataRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private CreateSnapshotDataAttributesRequest attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CreateSnapshotType type; + + public CreateSnapshotDataRequest() {} + + @JsonCreator + public CreateSnapshotDataRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + CreateSnapshotDataAttributesRequest attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) CreateSnapshotType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CreateSnapshotDataRequest attributes(CreateSnapshotDataAttributesRequest attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for snapshot creation. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CreateSnapshotDataAttributesRequest getAttributes() { + return attributes; + } + + public void setAttributes(CreateSnapshotDataAttributesRequest attributes) { + this.attributes = attributes; + } + + public CreateSnapshotDataRequest type(CreateSnapshotType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type identifier for snapshot creation resources. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CreateSnapshotType getType() { + return type; + } + + public void setType(CreateSnapshotType 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 CreateSnapshotDataRequest + */ + @JsonAnySetter + public CreateSnapshotDataRequest 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 CreateSnapshotDataRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateSnapshotDataRequest createSnapshotDataRequest = (CreateSnapshotDataRequest) o; + return Objects.equals(this.attributes, createSnapshotDataRequest.attributes) + && Objects.equals(this.type, createSnapshotDataRequest.type) + && Objects.equals( + this.additionalProperties, createSnapshotDataRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSnapshotDataRequest {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).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/CreateSnapshotDataResponse.java b/src/main/java/com/datadog/api/client/v2/model/CreateSnapshotDataResponse.java new file mode 100644 index 00000000000..d1e7d7cba69 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateSnapshotDataResponse.java @@ -0,0 +1,210 @@ +/* + * 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; + +/** Data envelope for the snapshot creation response. */ +@JsonPropertyOrder({ + CreateSnapshotDataResponse.JSON_PROPERTY_ATTRIBUTES, + CreateSnapshotDataResponse.JSON_PROPERTY_ID, + CreateSnapshotDataResponse.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreateSnapshotDataResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private CreateSnapshotDataAttributesResponse attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CreateSnapshotType type; + + public CreateSnapshotDataResponse() {} + + @JsonCreator + public CreateSnapshotDataResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + CreateSnapshotDataAttributesResponse attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) CreateSnapshotType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CreateSnapshotDataResponse attributes(CreateSnapshotDataAttributesResponse attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of the created snapshot. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CreateSnapshotDataAttributesResponse getAttributes() { + return attributes; + } + + public void setAttributes(CreateSnapshotDataAttributesResponse attributes) { + this.attributes = attributes; + } + + public CreateSnapshotDataResponse id(String id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the created snapshot. + * + * @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 CreateSnapshotDataResponse type(CreateSnapshotType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type identifier for snapshot creation resources. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CreateSnapshotType getType() { + return type; + } + + public void setType(CreateSnapshotType 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 CreateSnapshotDataResponse + */ + @JsonAnySetter + public CreateSnapshotDataResponse 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 CreateSnapshotDataResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateSnapshotDataResponse createSnapshotDataResponse = (CreateSnapshotDataResponse) o; + return Objects.equals(this.attributes, createSnapshotDataResponse.attributes) + && Objects.equals(this.id, createSnapshotDataResponse.id) + && Objects.equals(this.type, createSnapshotDataResponse.type) + && Objects.equals( + this.additionalProperties, createSnapshotDataResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSnapshotDataResponse {\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/CreateSnapshotRequest.java b/src/main/java/com/datadog/api/client/v2/model/CreateSnapshotRequest.java new file mode 100644 index 00000000000..f3680988b60 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateSnapshotRequest.java @@ -0,0 +1,145 @@ +/* + * 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; + +/** Request body for creating a graph snapshot. */ +@JsonPropertyOrder({CreateSnapshotRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreateSnapshotRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private CreateSnapshotDataRequest data; + + public CreateSnapshotRequest() {} + + @JsonCreator + public CreateSnapshotRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) CreateSnapshotDataRequest data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public CreateSnapshotRequest data(CreateSnapshotDataRequest data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data envelope for snapshot creation. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CreateSnapshotDataRequest getData() { + return data; + } + + public void setData(CreateSnapshotDataRequest 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 CreateSnapshotRequest + */ + @JsonAnySetter + public CreateSnapshotRequest 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 CreateSnapshotRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateSnapshotRequest createSnapshotRequest = (CreateSnapshotRequest) o; + return Objects.equals(this.data, createSnapshotRequest.data) + && Objects.equals(this.additionalProperties, createSnapshotRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSnapshotRequest {\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/CreateSnapshotResponse.java b/src/main/java/com/datadog/api/client/v2/model/CreateSnapshotResponse.java new file mode 100644 index 00000000000..ae247084d86 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateSnapshotResponse.java @@ -0,0 +1,145 @@ +/* + * 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; + +/** Response body for a snapshot creation request. */ +@JsonPropertyOrder({CreateSnapshotResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreateSnapshotResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private CreateSnapshotDataResponse data; + + public CreateSnapshotResponse() {} + + @JsonCreator + public CreateSnapshotResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) CreateSnapshotDataResponse data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public CreateSnapshotResponse data(CreateSnapshotDataResponse data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data envelope for the snapshot creation response. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CreateSnapshotDataResponse getData() { + return data; + } + + public void setData(CreateSnapshotDataResponse 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 CreateSnapshotResponse + */ + @JsonAnySetter + public CreateSnapshotResponse 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 CreateSnapshotResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateSnapshotResponse createSnapshotResponse = (CreateSnapshotResponse) o; + return Objects.equals(this.data, createSnapshotResponse.data) + && Objects.equals(this.additionalProperties, createSnapshotResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSnapshotResponse {\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/CreateSnapshotTTL.java b/src/main/java/com/datadog/api/client/v2/model/CreateSnapshotTTL.java new file mode 100644 index 00000000000..1f50db0702e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateSnapshotTTL.java @@ -0,0 +1,62 @@ +/* + * 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; + +/** + * The time-to-live for the snapshot. This value corresponds to storage lifecycle policies that + * automatically delete the snapshot after the specified period. + */ +@JsonSerialize(using = CreateSnapshotTTL.CreateSnapshotTTLSerializer.class) +public class CreateSnapshotTTL extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("30d", "60d", "90d", "1y", "2y", "inf")); + + public static final CreateSnapshotTTL THIRTY_DAYS = new CreateSnapshotTTL("30d"); + public static final CreateSnapshotTTL SIXTY_DAYS = new CreateSnapshotTTL("60d"); + public static final CreateSnapshotTTL NINETY_DAYS = new CreateSnapshotTTL("90d"); + public static final CreateSnapshotTTL ONE_YEAR = new CreateSnapshotTTL("1y"); + public static final CreateSnapshotTTL TWO_YEARS = new CreateSnapshotTTL("2y"); + public static final CreateSnapshotTTL INFINITE = new CreateSnapshotTTL("inf"); + + CreateSnapshotTTL(String value) { + super(value, allowedValues); + } + + public static class CreateSnapshotTTLSerializer extends StdSerializer { + public CreateSnapshotTTLSerializer(Class t) { + super(t); + } + + public CreateSnapshotTTLSerializer() { + this(null); + } + + @Override + public void serialize(CreateSnapshotTTL value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CreateSnapshotTTL fromValue(String value) { + return new CreateSnapshotTTL(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CreateSnapshotTemplateVariable.java b/src/main/java/com/datadog/api/client/v2/model/CreateSnapshotTemplateVariable.java new file mode 100644 index 00000000000..3a7996299d4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateSnapshotTemplateVariable.java @@ -0,0 +1,212 @@ +/* + * 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; + +/** A template variable definition for snapshot rendering. */ +@JsonPropertyOrder({ + CreateSnapshotTemplateVariable.JSON_PROPERTY_NAME, + CreateSnapshotTemplateVariable.JSON_PROPERTY_PREFIX, + CreateSnapshotTemplateVariable.JSON_PROPERTY_VALUES +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreateSnapshotTemplateVariable { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_PREFIX = "prefix"; + private String prefix; + + public static final String JSON_PROPERTY_VALUES = "values"; + private List values = new ArrayList<>(); + + public CreateSnapshotTemplateVariable() {} + + @JsonCreator + public CreateSnapshotTemplateVariable( + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_PREFIX) String prefix, + @JsonProperty(required = true, value = JSON_PROPERTY_VALUES) List values) { + this.name = name; + this.prefix = prefix; + this.values = values; + } + + public CreateSnapshotTemplateVariable name(String name) { + this.name = name; + return this; + } + + /** + * The template variable name. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public CreateSnapshotTemplateVariable prefix(String prefix) { + this.prefix = prefix; + return this; + } + + /** + * The tag prefix associated with the template variable. For example, a prefix of host + * with a value of web-server-1 scopes the snapshot to + * host:web-server-1. + * + * @return prefix + */ + @JsonProperty(JSON_PROPERTY_PREFIX) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getPrefix() { + return prefix; + } + + public void setPrefix(String prefix) { + this.prefix = prefix; + } + + public CreateSnapshotTemplateVariable values(List values) { + this.values = values; + return this; + } + + public CreateSnapshotTemplateVariable addValuesItem(String valuesItem) { + this.values.add(valuesItem); + return this; + } + + /** + * The list of scoped values for this template variable. + * + * @return values + */ + @JsonProperty(JSON_PROPERTY_VALUES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getValues() { + return values; + } + + public void setValues(List values) { + this.values = values; + } + + /** + * 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 CreateSnapshotTemplateVariable + */ + @JsonAnySetter + public CreateSnapshotTemplateVariable 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 CreateSnapshotTemplateVariable object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateSnapshotTemplateVariable createSnapshotTemplateVariable = + (CreateSnapshotTemplateVariable) o; + return Objects.equals(this.name, createSnapshotTemplateVariable.name) + && Objects.equals(this.prefix, createSnapshotTemplateVariable.prefix) + && Objects.equals(this.values, createSnapshotTemplateVariable.values) + && Objects.equals( + this.additionalProperties, createSnapshotTemplateVariable.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, prefix, values, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSnapshotTemplateVariable {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" prefix: ").append(toIndentedString(prefix)).append("\n"); + sb.append(" values: ").append(toIndentedString(values)).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/CreateSnapshotTimeseriesLegendType.java b/src/main/java/com/datadog/api/client/v2/model/CreateSnapshotTimeseriesLegendType.java new file mode 100644 index 00000000000..8d1e0e86a34 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateSnapshotTimeseriesLegendType.java @@ -0,0 +1,66 @@ +/* + * 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; + +/** + * The legend display type for timeseries widgets. A value of none hides the legend + * entirely; omitting the field lets the frontend choose automatically. + */ +@JsonSerialize( + using = CreateSnapshotTimeseriesLegendType.CreateSnapshotTimeseriesLegendTypeSerializer.class) +public class CreateSnapshotTimeseriesLegendType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("compact", "expanded", "none")); + + public static final CreateSnapshotTimeseriesLegendType COMPACT = + new CreateSnapshotTimeseriesLegendType("compact"); + public static final CreateSnapshotTimeseriesLegendType EXPANDED = + new CreateSnapshotTimeseriesLegendType("expanded"); + public static final CreateSnapshotTimeseriesLegendType NONE = + new CreateSnapshotTimeseriesLegendType("none"); + + CreateSnapshotTimeseriesLegendType(String value) { + super(value, allowedValues); + } + + public static class CreateSnapshotTimeseriesLegendTypeSerializer + extends StdSerializer { + public CreateSnapshotTimeseriesLegendTypeSerializer( + Class t) { + super(t); + } + + public CreateSnapshotTimeseriesLegendTypeSerializer() { + this(null); + } + + @Override + public void serialize( + CreateSnapshotTimeseriesLegendType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CreateSnapshotTimeseriesLegendType fromValue(String value) { + return new CreateSnapshotTimeseriesLegendType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CreateSnapshotType.java b/src/main/java/com/datadog/api/client/v2/model/CreateSnapshotType.java new file mode 100644 index 00000000000..de709cc4ebf --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateSnapshotType.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; + +/** The type identifier for snapshot creation resources. */ +@JsonSerialize(using = CreateSnapshotType.CreateSnapshotTypeSerializer.class) +public class CreateSnapshotType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("create_snapshot")); + + public static final CreateSnapshotType CREATE_SNAPSHOT = + new CreateSnapshotType("create_snapshot"); + + CreateSnapshotType(String value) { + super(value, allowedValues); + } + + public static class CreateSnapshotTypeSerializer extends StdSerializer { + public CreateSnapshotTypeSerializer(Class t) { + super(t); + } + + public CreateSnapshotTypeSerializer() { + this(null); + } + + @Override + public void serialize(CreateSnapshotType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CreateSnapshotType fromValue(String value) { + return new CreateSnapshotType(value); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/reporting_and_sharing.feature b/src/test/resources/com/datadog/api/client/v2/api/reporting_and_sharing.feature new file mode 100644 index 00000000000..f852b68d44f --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/reporting_and_sharing.feature @@ -0,0 +1,27 @@ +@endpoint(reporting-and-sharing) @endpoint(reporting-and-sharing-v2) +Feature: Reporting and Sharing + The Reporting and Sharing endpoints allow you to create snapshots of graph + widgets and other shareable resources. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "ReportingandSharing" API + And operation "CreateSnapshot" enabled + And new "CreateSnapshot" request + And body with value {"data": {"attributes": {"additional_config": {"template_variables": [{"name": "host", "prefix": "host", "values": ["web-server-1", "web-server-2"]}], "timeseries_legend_type": "expanded", "timezone_offset_minutes": 300}, "end": 1692464800000, "height": 185, "is_authenticated": false, "start": 1692464000000, "ttl": "60d", "widget_definition": {"requests": [{"q": "avg:system.cpu.user{*}"}], "type": "timeseries"}, "width": 300}, "type": "create_snapshot"}} + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Create a graph snapshot returns "Bad Request" response + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Create a graph snapshot returns "Not Found" response + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Create a graph snapshot returns "OK" response + When the request is sent + Then the response status is 200 OK 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 486933f758d..c589f22d8b2 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 @@ -8184,6 +8184,12 @@ "type": "safe" } }, + "CreateSnapshot": { + "tag": "Reporting and Sharing", + "undo": { + "type": "unsafe" + } + }, "GetSPARecommendations": { "tag": "Spa", "undo": {