From 4997d9bf07489e158f0aadffeb6129a6b0571456 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 13 May 2026 15:58:50 +0000 Subject: [PATCH] Regenerate client from commit 679aa75 of spec repo --- .generator/schemas/v2/openapi.yaml | 403 ++++++++++++++ .../cloud-cost-management/GetCostAnomaly.java | 25 + .../ListCostAnomalies.java | 25 + .../com/datadog/api/client/ApiClient.java | 2 + .../client/v2/api/CloudCostManagementApi.java | 518 ++++++++++++++++++ .../v2/model/CostAnomaliesResponse.java | 139 +++++ .../v2/model/CostAnomaliesResponseData.java | 211 +++++++ .../CostAnomaliesResponseDataAttributes.java | 283 ++++++++++ .../model/CostAnomaliesResponseDataType.java | 56 ++ .../api/client/v2/model/CostAnomaly.java | 457 +++++++++++++++ .../client/v2/model/CostAnomalyDismissal.java | 257 +++++++++ .../client/v2/model/CostAnomalyResponse.java | 136 +++++ .../v2/model/CostAnomalyResponseData.java | 209 +++++++ .../v2/api/cloud_cost_management.feature | 38 ++ .../com/datadog/api/client/v2/api/undo.json | 12 + 15 files changed, 2771 insertions(+) create mode 100644 examples/v2/cloud-cost-management/GetCostAnomaly.java create mode 100644 examples/v2/cloud-cost-management/ListCostAnomalies.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CostAnomaliesResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CostAnomaliesResponseData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CostAnomaliesResponseDataAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CostAnomaliesResponseDataType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CostAnomaly.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CostAnomalyDismissal.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CostAnomalyResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CostAnomalyResponseData.java diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 5808b5f7964..4cefb983dba 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -93,6 +93,13 @@ components: required: true schema: type: string + AnomalyID: + description: The UUID of the cost anomaly. + in: path + name: anomaly_id + required: true + schema: + type: string ApplicationKeyFilterCreatedAtEndParameter: description: Only include application keys created on or before the specified date. in: query @@ -15490,6 +15497,204 @@ components: type: string x-enum-varnames: - CUMULATIVE + CostAnomaliesResponse: + description: Response object containing a list of detected Cloud Cost Management anomalies and aggregated totals. + properties: + data: + $ref: "#/components/schemas/CostAnomaliesResponseData" + type: object + CostAnomaliesResponseData: + description: Resource wrapper for the list of cost anomalies and aggregated totals. + properties: + attributes: + $ref: "#/components/schemas/CostAnomaliesResponseDataAttributes" + id: + description: Static identifier of the cost anomalies collection resource. + example: anomalies + type: string + type: + $ref: "#/components/schemas/CostAnomaliesResponseDataType" + required: + - id + - type + - attributes + type: object + CostAnomaliesResponseDataAttributes: + description: Cost anomaly results and aggregated totals for the queried window. + properties: + anomalies: + description: The list of cost anomalies that match the request. + items: + $ref: "#/components/schemas/CostAnomaly" + type: array + avg_daily_anomalous_cost: + description: Average daily anomalous cost change across the queried window. + example: 625.375 + format: double + type: number + total_actual_cost: + description: Total actual cost spent across the queried window for the matching providers. + example: 3001.24 + format: double + type: number + total_anomalous_cost: + description: Sum of the anomalous cost change across all returned anomalies. + example: 1250.75 + format: double + type: number + total_count: + description: Total number of anomalies that match the request. + example: 1 + format: int64 + type: integer + required: + - anomalies + - total_count + - total_anomalous_cost + - total_actual_cost + - avg_daily_anomalous_cost + type: object + CostAnomaliesResponseDataType: + default: anomalies + description: Type of the cost anomalies collection resource. Must be `anomalies`. + enum: + - anomalies + example: anomalies + type: string + x-enum-varnames: + - ANOMALIES + CostAnomaly: + description: A single detected Cloud Cost Management anomaly. + properties: + actual_cost: + description: Actual cost incurred during the anomaly window. + example: 3001.24 + format: double + type: number + anomalous_cost_change: + description: Anomalous cost change relative to the expected baseline. + example: 1250.75 + format: double + type: number + anomaly_end: + description: Anomaly end timestamp in Unix milliseconds. + example: 1730429150000 + format: int64 + type: integer + anomaly_start: + description: Anomaly start timestamp in Unix milliseconds. + example: 1730259950000 + format: int64 + type: integer + correlated_tags: + $ref: "#/components/schemas/CostAnomalyCorrelatedTags" + dimensions: + $ref: "#/components/schemas/CostAnomalyDimensions" + dismissal: + $ref: "#/components/schemas/CostAnomalyDismissal" + max_cost: + description: Maximum cost observed during the anomaly window. + example: 5000.5 + format: double + type: number + provider: + description: Cloud or SaaS provider associated with the anomaly (for example `aws`, `gcp`, `azure`). + example: aws + type: string + query: + description: The metrics query that detected the anomaly. + example: sum:aws.cost.net.amortized{aws_cost_type IN (Usage,DiscountedUsage,SavingsPlanCoveredUsage) AND aws_product NOT IN (supportenterprise) AND service:"ec2"}.rollup(sum, daily) + type: string + uuid: + description: The unique identifier of the anomaly. + example: b0a6aaa9-3c4c-48cb-9447-a0d1338b3e09 + type: string + required: + - uuid + - anomaly_start + - anomaly_end + - query + - dimensions + - correlated_tags + - anomalous_cost_change + - actual_cost + - max_cost + - provider + type: object + CostAnomalyCorrelatedTags: + additionalProperties: + description: The list of correlated values for the tag key. + items: + type: string + type: array + description: Map of correlated tag keys to the list of correlated tag values. + example: + region: + - us-east-1 + - us-west-2 + nullable: true + type: object + CostAnomalyDimensions: + additionalProperties: + description: The dimension value. + type: string + description: Map of cost dimension keys to their values for the anomaly grouping. + example: + service: ec2 + type: object + CostAnomalyDismissal: + description: Resolution metadata for an anomaly that has been dismissed. + properties: + cause: + description: Reason the anomaly was dismissed. + example: false_positive + type: string + dismissal_id: + description: Unique identifier of the dismissal record. + example: 12345678-1234-1234-1234-123456789abc + type: string + message: + description: Optional message explaining the dismissal. + example: This was expected due to planned infrastructure changes. + type: string + updated_at: + description: Timestamp of the last dismissal update in Unix milliseconds. + example: 1730344150000 + format: int64 + type: integer + updated_by: + description: Identifier of the user that last updated the dismissal. + example: user@example.com + type: string + required: + - dismissal_id + - cause + - message + - updated_at + - updated_by + type: object + CostAnomalyResponse: + description: Response object containing a single Cloud Cost Management anomaly. + properties: + data: + $ref: "#/components/schemas/CostAnomalyResponseData" + type: object + CostAnomalyResponseData: + description: Resource wrapper for a single cost anomaly. + properties: + attributes: + $ref: "#/components/schemas/CostAnomaly" + id: + description: The unique identifier of the anomaly. + example: b0a6aaa9-3c4c-48cb-9447-a0d1338b3e09 + type: string + type: + $ref: "#/components/schemas/CostAnomaliesResponseDataType" + required: + - id + - type + - attributes + type: object CostAttributionAggregates: description: An array of available aggregates. items: @@ -95324,6 +95529,204 @@ paths: "x-permission": operator: OPEN permissions: [] + /api/v2/cost/anomalies: + get: + description: List detected Cloud Cost Management anomalies for the organization. + operationId: ListCostAnomalies + parameters: + - description: Start time as Unix milliseconds. Defaults to the start of the latest stable seven-day window. + in: query + name: start + required: false + schema: + example: 1730259950000 + format: int64 + type: integer + - description: End time as Unix milliseconds. Defaults to the end of the latest stable seven-day window. + in: query + name: end + required: false + schema: + example: 1730429150000 + format: int64 + type: integer + - description: 'Optional JSON object mapping cost tag keys to allowed values, for example `{"team":["payments"],"env":["prod"]}`. Filters match anomaly dimensions or correlated tags.' + in: query + name: filter + required: false + schema: + example: '{"team":["payments"]}' + type: string + - description: Minimum absolute anomalous cost change to include. Numeric value; defaults to `1`. + in: query + name: min_anomalous_threshold + required: false + schema: + example: "1.0" + type: string + - description: Minimum absolute actual cost to include. Numeric value; defaults to `0`. + in: query + name: min_cost_threshold + required: false + schema: + example: "0.0" + type: string + - description: Filter by resolution state. Use `none` for unresolved anomalies, `all` or `*` for resolved anomalies, or a comma-separated list of causes. + in: query + name: dismissal_cause + required: false + schema: + example: none + type: string + - description: Sort field. One of `start_date`, `end_date`, `duration`, `max_cost`, `anomalous_cost`, or `dismissal_date`. Defaults to `anomalous_cost`. + in: query + name: order_by + required: false + schema: + example: anomalous_cost + type: string + - description: Sort direction. One of `asc` or `desc`. Defaults to `desc`. + in: query + name: order + required: false + schema: + example: desc + type: string + - description: Maximum number of anomalies to return. Defaults to `200`. + in: query + name: limit + required: false + schema: + example: 200 + type: integer + - description: Pagination offset. Defaults to `0`. + in: query + name: offset + required: false + schema: + example: 0 + type: integer + - description: Optional repeated cloud or SaaS provider filters, such as `aws`, `gcp`, `azure`, `Oracle`, `datadog`, `OpenAI`, or `Anthropic`. + explode: true + in: query + name: provider_ids + required: false + schema: + items: + example: aws + type: string + type: array + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + anomalies: + - actual_cost: 3001.24 + anomalous_cost_change: 1250.75 + anomaly_end: 1730429150000 + anomaly_start: 1730259950000 + correlated_tags: + region: + - us-east-1 + - us-west-2 + dimensions: + service: ec2 + max_cost: 5000.5 + provider: aws + query: 'sum:aws.cost.net.amortized{aws_cost_type IN (Usage,DiscountedUsage,SavingsPlanCoveredUsage) AND aws_product NOT IN (supportenterprise) AND service:"ec2"}.rollup(sum, daily)' + uuid: b0a6aaa9-3c4c-48cb-9447-a0d1338b3e09 + avg_daily_anomalous_cost: 625.375 + total_actual_cost: 3001.24 + total_anomalous_cost: 1250.75 + total_count: 1 + id: anomalies + type: anomalies + schema: + $ref: "#/components/schemas/CostAnomaliesResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_read + summary: List cost anomalies + tags: + - Cloud Cost Management + 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/cost/anomalies/{anomaly_id}: + get: + description: Get a detected Cloud Cost Management anomaly by UUID. + operationId: GetCostAnomaly + parameters: + - $ref: "#/components/parameters/AnomalyID" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + actual_cost: 3001.24 + anomalous_cost_change: 1250.75 + anomaly_end: 1730429150000 + anomaly_start: 1730259950000 + correlated_tags: + region: + - us-east-1 + - us-west-2 + dimensions: + service: ec2 + max_cost: 5000.5 + provider: aws + query: 'sum:aws.cost.net.amortized{aws_cost_type IN (Usage,DiscountedUsage,SavingsPlanCoveredUsage) AND aws_product NOT IN (supportenterprise) AND service:"ec2"}.rollup(sum, daily)' + uuid: b0a6aaa9-3c4c-48cb-9447-a0d1338b3e09 + id: b0a6aaa9-3c4c-48cb-9447-a0d1338b3e09 + type: anomalies + schema: + $ref: "#/components/schemas/CostAnomalyResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_read + summary: Get cost anomaly + tags: + - Cloud Cost Management + 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/cost/arbitrary_rule: get: description: List all custom allocation rules - Retrieve a list of all custom allocation rules for the organization diff --git a/examples/v2/cloud-cost-management/GetCostAnomaly.java b/examples/v2/cloud-cost-management/GetCostAnomaly.java new file mode 100644 index 00000000000..5d10cdf8fbe --- /dev/null +++ b/examples/v2/cloud-cost-management/GetCostAnomaly.java @@ -0,0 +1,25 @@ +// Get cost anomaly returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CloudCostManagementApi; +import com.datadog.api.client.v2.model.CostAnomalyResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getCostAnomaly", true); + CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient); + + try { + CostAnomalyResponse result = apiInstance.getCostAnomaly("anomaly_id"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CloudCostManagementApi#getCostAnomaly"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/cloud-cost-management/ListCostAnomalies.java b/examples/v2/cloud-cost-management/ListCostAnomalies.java new file mode 100644 index 00000000000..4500ea51682 --- /dev/null +++ b/examples/v2/cloud-cost-management/ListCostAnomalies.java @@ -0,0 +1,25 @@ +// List cost anomalies returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CloudCostManagementApi; +import com.datadog.api.client.v2.model.CostAnomaliesResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listCostAnomalies", true); + CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient); + + try { + CostAnomaliesResponse result = apiInstance.listCostAnomalies(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CloudCostManagementApi#listCostAnomalies"); + 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 33d58871928..fc8d594424b 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -859,6 +859,8 @@ public class ApiClient { put("v2.searchSecurityMonitoringHistsignals", false); put("v2.getCodeCoverageBranchSummary", false); put("v2.getCodeCoverageCommitSummary", false); + put("v2.getCostAnomaly", false); + put("v2.listCostAnomalies", false); put("v2.createDashboardSecureEmbed", false); put("v2.deleteDashboardSecureEmbed", false); put("v2.getDashboardSecureEmbed", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/CloudCostManagementApi.java b/src/main/java/com/datadog/api/client/v2/api/CloudCostManagementApi.java index 7634320e2fe..844dec13eda 100644 --- a/src/main/java/com/datadog/api/client/v2/api/CloudCostManagementApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/CloudCostManagementApi.java @@ -20,6 +20,8 @@ import com.datadog.api.client.v2.model.BudgetValidationRequest; import com.datadog.api.client.v2.model.BudgetValidationResponse; import com.datadog.api.client.v2.model.BudgetWithEntries; +import com.datadog.api.client.v2.model.CostAnomaliesResponse; +import com.datadog.api.client.v2.model.CostAnomalyResponse; import com.datadog.api.client.v2.model.CostTagDescriptionsResponse; import com.datadog.api.client.v2.model.CreateRulesetRequest; import com.datadog.api.client.v2.model.CustomCostsFileGetResponse; @@ -1842,6 +1844,159 @@ public CompletableFuture> getBudgetWithHttpInfoAs new GenericType() {}); } + /** + * Get cost anomaly. + * + *

See {@link #getCostAnomalyWithHttpInfo}. + * + * @param anomalyId The UUID of the cost anomaly. (required) + * @return CostAnomalyResponse + * @throws ApiException if fails to make API call + */ + public CostAnomalyResponse getCostAnomaly(String anomalyId) throws ApiException { + return getCostAnomalyWithHttpInfo(anomalyId).getData(); + } + + /** + * Get cost anomaly. + * + *

See {@link #getCostAnomalyWithHttpInfoAsync}. + * + * @param anomalyId The UUID of the cost anomaly. (required) + * @return CompletableFuture<CostAnomalyResponse> + */ + public CompletableFuture getCostAnomalyAsync(String anomalyId) { + return getCostAnomalyWithHttpInfoAsync(anomalyId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a detected Cloud Cost Management anomaly by UUID. + * + * @param anomalyId The UUID of the cost anomaly. (required) + * @return ApiResponse<CostAnomalyResponse> + * @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 -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse getCostAnomalyWithHttpInfo(String anomalyId) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "getCostAnomaly"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'anomalyId' is set + if (anomalyId == null) { + throw new ApiException( + 400, "Missing the required parameter 'anomalyId' when calling getCostAnomaly"); + } + // create path and map variables + String localVarPath = + "/api/v2/cost/anomalies/{anomaly_id}" + .replaceAll("\\{" + "anomaly_id" + "\\}", apiClient.escapeString(anomalyId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.getCostAnomaly", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get cost anomaly. + * + *

See {@link #getCostAnomalyWithHttpInfo}. + * + * @param anomalyId The UUID of the cost anomaly. (required) + * @return CompletableFuture<ApiResponse<CostAnomalyResponse>> + */ + public CompletableFuture> getCostAnomalyWithHttpInfoAsync( + String anomalyId) { + // Check if unstable operation is enabled + String operationId = "getCostAnomaly"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'anomalyId' is set + if (anomalyId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'anomalyId' when calling getCostAnomaly")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/cost/anomalies/{anomaly_id}" + .replaceAll("\\{" + "anomaly_id" + "\\}", apiClient.escapeString(anomalyId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.getCostAnomaly", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Get cost AWS CUR config. * @@ -2769,6 +2924,369 @@ public CompletableFuture> listBudgetsWithHttpInfoAsync( new GenericType() {}); } + /** Manage optional parameters to listCostAnomalies. */ + public static class ListCostAnomaliesOptionalParameters { + private Long start; + private Long end; + private String filter; + private String minAnomalousThreshold; + private String minCostThreshold; + private String dismissalCause; + private String orderBy; + private String order; + private Integer limit; + private Integer offset; + private List providerIds; + + /** + * Set start. + * + * @param start Start time as Unix milliseconds. Defaults to the start of the latest stable + * seven-day window. (optional) + * @return ListCostAnomaliesOptionalParameters + */ + public ListCostAnomaliesOptionalParameters start(Long start) { + this.start = start; + return this; + } + + /** + * Set end. + * + * @param end End time as Unix milliseconds. Defaults to the end of the latest stable seven-day + * window. (optional) + * @return ListCostAnomaliesOptionalParameters + */ + public ListCostAnomaliesOptionalParameters end(Long end) { + this.end = end; + return this; + } + + /** + * Set filter. + * + * @param filter Optional JSON object mapping cost tag keys to allowed values, for example + * {"team":["payments"],"env":["prod"]}. Filters match anomaly dimensions or + * correlated tags. (optional) + * @return ListCostAnomaliesOptionalParameters + */ + public ListCostAnomaliesOptionalParameters filter(String filter) { + this.filter = filter; + return this; + } + + /** + * Set minAnomalousThreshold. + * + * @param minAnomalousThreshold Minimum absolute anomalous cost change to include. Numeric + * value; defaults to 1. (optional) + * @return ListCostAnomaliesOptionalParameters + */ + public ListCostAnomaliesOptionalParameters minAnomalousThreshold(String minAnomalousThreshold) { + this.minAnomalousThreshold = minAnomalousThreshold; + return this; + } + + /** + * Set minCostThreshold. + * + * @param minCostThreshold Minimum absolute actual cost to include. Numeric value; defaults to + * 0. (optional) + * @return ListCostAnomaliesOptionalParameters + */ + public ListCostAnomaliesOptionalParameters minCostThreshold(String minCostThreshold) { + this.minCostThreshold = minCostThreshold; + return this; + } + + /** + * Set dismissalCause. + * + * @param dismissalCause Filter by resolution state. Use none for unresolved + * anomalies, all or * for resolved anomalies, or a + * comma-separated list of causes. (optional) + * @return ListCostAnomaliesOptionalParameters + */ + public ListCostAnomaliesOptionalParameters dismissalCause(String dismissalCause) { + this.dismissalCause = dismissalCause; + return this; + } + + /** + * Set orderBy. + * + * @param orderBy Sort field. One of start_date, end_date, + * duration, max_cost, anomalous_cost, or + * dismissal_date. Defaults to anomalous_cost. (optional) + * @return ListCostAnomaliesOptionalParameters + */ + public ListCostAnomaliesOptionalParameters orderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + /** + * Set order. + * + * @param order Sort direction. One of asc or desc. Defaults to + * desc. (optional) + * @return ListCostAnomaliesOptionalParameters + */ + public ListCostAnomaliesOptionalParameters order(String order) { + this.order = order; + return this; + } + + /** + * Set limit. + * + * @param limit Maximum number of anomalies to return. Defaults to 200. (optional) + * @return ListCostAnomaliesOptionalParameters + */ + public ListCostAnomaliesOptionalParameters limit(Integer limit) { + this.limit = limit; + return this; + } + + /** + * Set offset. + * + * @param offset Pagination offset. Defaults to 0. (optional) + * @return ListCostAnomaliesOptionalParameters + */ + public ListCostAnomaliesOptionalParameters offset(Integer offset) { + this.offset = offset; + return this; + } + + /** + * Set providerIds. + * + * @param providerIds Optional repeated cloud or SaaS provider filters, such as aws + * , gcp, azure, Oracle, datadog, + * OpenAI, or Anthropic. (optional) + * @return ListCostAnomaliesOptionalParameters + */ + public ListCostAnomaliesOptionalParameters providerIds(List providerIds) { + this.providerIds = providerIds; + return this; + } + } + + /** + * List cost anomalies. + * + *

See {@link #listCostAnomaliesWithHttpInfo}. + * + * @return CostAnomaliesResponse + * @throws ApiException if fails to make API call + */ + public CostAnomaliesResponse listCostAnomalies() throws ApiException { + return listCostAnomaliesWithHttpInfo(new ListCostAnomaliesOptionalParameters()).getData(); + } + + /** + * List cost anomalies. + * + *

See {@link #listCostAnomaliesWithHttpInfoAsync}. + * + * @return CompletableFuture<CostAnomaliesResponse> + */ + public CompletableFuture listCostAnomaliesAsync() { + return listCostAnomaliesWithHttpInfoAsync(new ListCostAnomaliesOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List cost anomalies. + * + *

See {@link #listCostAnomaliesWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return CostAnomaliesResponse + * @throws ApiException if fails to make API call + */ + public CostAnomaliesResponse listCostAnomalies(ListCostAnomaliesOptionalParameters parameters) + throws ApiException { + return listCostAnomaliesWithHttpInfo(parameters).getData(); + } + + /** + * List cost anomalies. + * + *

See {@link #listCostAnomaliesWithHttpInfoAsync}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<CostAnomaliesResponse> + */ + public CompletableFuture listCostAnomaliesAsync( + ListCostAnomaliesOptionalParameters parameters) { + return listCostAnomaliesWithHttpInfoAsync(parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List detected Cloud Cost Management anomalies for the organization. + * + * @param parameters Optional parameters for the request. + * @return ApiResponse<CostAnomaliesResponse> + * @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 -
429 Too many requests -
+ */ + public ApiResponse listCostAnomaliesWithHttpInfo( + ListCostAnomaliesOptionalParameters parameters) throws ApiException { + // Check if unstable operation is enabled + String operationId = "listCostAnomalies"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + Long start = parameters.start; + Long end = parameters.end; + String filter = parameters.filter; + String minAnomalousThreshold = parameters.minAnomalousThreshold; + String minCostThreshold = parameters.minCostThreshold; + String dismissalCause = parameters.dismissalCause; + String orderBy = parameters.orderBy; + String order = parameters.order; + Integer limit = parameters.limit; + Integer offset = parameters.offset; + List providerIds = parameters.providerIds; + // create path and map variables + String localVarPath = "/api/v2/cost/anomalies"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "start", start)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "end", end)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter", filter)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "min_anomalous_threshold", minAnomalousThreshold)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "min_cost_threshold", minCostThreshold)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "dismissal_cause", dismissalCause)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "order_by", orderBy)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "offset", offset)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "provider_ids", providerIds)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.listCostAnomalies", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List cost anomalies. + * + *

See {@link #listCostAnomaliesWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<CostAnomaliesResponse>> + */ + public CompletableFuture> listCostAnomaliesWithHttpInfoAsync( + ListCostAnomaliesOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "listCostAnomalies"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + Long start = parameters.start; + Long end = parameters.end; + String filter = parameters.filter; + String minAnomalousThreshold = parameters.minAnomalousThreshold; + String minCostThreshold = parameters.minCostThreshold; + String dismissalCause = parameters.dismissalCause; + String orderBy = parameters.orderBy; + String order = parameters.order; + Integer limit = parameters.limit; + Integer offset = parameters.offset; + List providerIds = parameters.providerIds; + // create path and map variables + String localVarPath = "/api/v2/cost/anomalies"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "start", start)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "end", end)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter", filter)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "min_anomalous_threshold", minAnomalousThreshold)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "min_cost_threshold", minCostThreshold)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "dismissal_cause", dismissalCause)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "order_by", orderBy)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "offset", offset)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "provider_ids", providerIds)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.listCostAnomalies", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * List Cloud Cost Management AWS CUR configs. * diff --git a/src/main/java/com/datadog/api/client/v2/model/CostAnomaliesResponse.java b/src/main/java/com/datadog/api/client/v2/model/CostAnomaliesResponse.java new file mode 100644 index 00000000000..780989ff091 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CostAnomaliesResponse.java @@ -0,0 +1,139 @@ +/* + * 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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** + * Response object containing a list of detected Cloud Cost Management anomalies and aggregated + * totals. + */ +@JsonPropertyOrder({CostAnomaliesResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CostAnomaliesResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private CostAnomaliesResponseData data; + + public CostAnomaliesResponse data(CostAnomaliesResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Resource wrapper for the list of cost anomalies and aggregated totals. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CostAnomaliesResponseData getData() { + return data; + } + + public void setData(CostAnomaliesResponseData 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 CostAnomaliesResponse + */ + @JsonAnySetter + public CostAnomaliesResponse 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 CostAnomaliesResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CostAnomaliesResponse costAnomaliesResponse = (CostAnomaliesResponse) o; + return Objects.equals(this.data, costAnomaliesResponse.data) + && Objects.equals(this.additionalProperties, costAnomaliesResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CostAnomaliesResponse {\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/CostAnomaliesResponseData.java b/src/main/java/com/datadog/api/client/v2/model/CostAnomaliesResponseData.java new file mode 100644 index 00000000000..2ab72235690 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CostAnomaliesResponseData.java @@ -0,0 +1,211 @@ +/* + * 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; + +/** Resource wrapper for the list of cost anomalies and aggregated totals. */ +@JsonPropertyOrder({ + CostAnomaliesResponseData.JSON_PROPERTY_ATTRIBUTES, + CostAnomaliesResponseData.JSON_PROPERTY_ID, + CostAnomaliesResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CostAnomaliesResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private CostAnomaliesResponseDataAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CostAnomaliesResponseDataType type = CostAnomaliesResponseDataType.ANOMALIES; + + public CostAnomaliesResponseData() {} + + @JsonCreator + public CostAnomaliesResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + CostAnomaliesResponseDataAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + CostAnomaliesResponseDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CostAnomaliesResponseData attributes(CostAnomaliesResponseDataAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Cost anomaly results and aggregated totals for the queried window. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CostAnomaliesResponseDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(CostAnomaliesResponseDataAttributes attributes) { + this.attributes = attributes; + } + + public CostAnomaliesResponseData id(String id) { + this.id = id; + return this; + } + + /** + * Static identifier of the cost anomalies collection resource. + * + * @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 CostAnomaliesResponseData type(CostAnomaliesResponseDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of the cost anomalies collection resource. Must be anomalies. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CostAnomaliesResponseDataType getType() { + return type; + } + + public void setType(CostAnomaliesResponseDataType 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 CostAnomaliesResponseData + */ + @JsonAnySetter + public CostAnomaliesResponseData 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 CostAnomaliesResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CostAnomaliesResponseData costAnomaliesResponseData = (CostAnomaliesResponseData) o; + return Objects.equals(this.attributes, costAnomaliesResponseData.attributes) + && Objects.equals(this.id, costAnomaliesResponseData.id) + && Objects.equals(this.type, costAnomaliesResponseData.type) + && Objects.equals( + this.additionalProperties, costAnomaliesResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CostAnomaliesResponseData {\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/CostAnomaliesResponseDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/CostAnomaliesResponseDataAttributes.java new file mode 100644 index 00000000000..71568b0097f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CostAnomaliesResponseDataAttributes.java @@ -0,0 +1,283 @@ +/* + * 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; + +/** Cost anomaly results and aggregated totals for the queried window. */ +@JsonPropertyOrder({ + CostAnomaliesResponseDataAttributes.JSON_PROPERTY_ANOMALIES, + CostAnomaliesResponseDataAttributes.JSON_PROPERTY_AVG_DAILY_ANOMALOUS_COST, + CostAnomaliesResponseDataAttributes.JSON_PROPERTY_TOTAL_ACTUAL_COST, + CostAnomaliesResponseDataAttributes.JSON_PROPERTY_TOTAL_ANOMALOUS_COST, + CostAnomaliesResponseDataAttributes.JSON_PROPERTY_TOTAL_COUNT +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CostAnomaliesResponseDataAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ANOMALIES = "anomalies"; + private List anomalies = new ArrayList<>(); + + public static final String JSON_PROPERTY_AVG_DAILY_ANOMALOUS_COST = "avg_daily_anomalous_cost"; + private Double avgDailyAnomalousCost; + + public static final String JSON_PROPERTY_TOTAL_ACTUAL_COST = "total_actual_cost"; + private Double totalActualCost; + + public static final String JSON_PROPERTY_TOTAL_ANOMALOUS_COST = "total_anomalous_cost"; + private Double totalAnomalousCost; + + public static final String JSON_PROPERTY_TOTAL_COUNT = "total_count"; + private Long totalCount; + + public CostAnomaliesResponseDataAttributes() {} + + @JsonCreator + public CostAnomaliesResponseDataAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_ANOMALIES) List anomalies, + @JsonProperty(required = true, value = JSON_PROPERTY_AVG_DAILY_ANOMALOUS_COST) + Double avgDailyAnomalousCost, + @JsonProperty(required = true, value = JSON_PROPERTY_TOTAL_ACTUAL_COST) + Double totalActualCost, + @JsonProperty(required = true, value = JSON_PROPERTY_TOTAL_ANOMALOUS_COST) + Double totalAnomalousCost, + @JsonProperty(required = true, value = JSON_PROPERTY_TOTAL_COUNT) Long totalCount) { + this.anomalies = anomalies; + this.avgDailyAnomalousCost = avgDailyAnomalousCost; + this.totalActualCost = totalActualCost; + this.totalAnomalousCost = totalAnomalousCost; + this.totalCount = totalCount; + } + + public CostAnomaliesResponseDataAttributes anomalies(List anomalies) { + this.anomalies = anomalies; + for (CostAnomaly item : anomalies) { + this.unparsed |= item.unparsed; + } + return this; + } + + public CostAnomaliesResponseDataAttributes addAnomaliesItem(CostAnomaly anomaliesItem) { + this.anomalies.add(anomaliesItem); + this.unparsed |= anomaliesItem.unparsed; + return this; + } + + /** + * The list of cost anomalies that match the request. + * + * @return anomalies + */ + @JsonProperty(JSON_PROPERTY_ANOMALIES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getAnomalies() { + return anomalies; + } + + public void setAnomalies(List anomalies) { + this.anomalies = anomalies; + } + + public CostAnomaliesResponseDataAttributes avgDailyAnomalousCost(Double avgDailyAnomalousCost) { + this.avgDailyAnomalousCost = avgDailyAnomalousCost; + return this; + } + + /** + * Average daily anomalous cost change across the queried window. + * + * @return avgDailyAnomalousCost + */ + @JsonProperty(JSON_PROPERTY_AVG_DAILY_ANOMALOUS_COST) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Double getAvgDailyAnomalousCost() { + return avgDailyAnomalousCost; + } + + public void setAvgDailyAnomalousCost(Double avgDailyAnomalousCost) { + this.avgDailyAnomalousCost = avgDailyAnomalousCost; + } + + public CostAnomaliesResponseDataAttributes totalActualCost(Double totalActualCost) { + this.totalActualCost = totalActualCost; + return this; + } + + /** + * Total actual cost spent across the queried window for the matching providers. + * + * @return totalActualCost + */ + @JsonProperty(JSON_PROPERTY_TOTAL_ACTUAL_COST) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Double getTotalActualCost() { + return totalActualCost; + } + + public void setTotalActualCost(Double totalActualCost) { + this.totalActualCost = totalActualCost; + } + + public CostAnomaliesResponseDataAttributes totalAnomalousCost(Double totalAnomalousCost) { + this.totalAnomalousCost = totalAnomalousCost; + return this; + } + + /** + * Sum of the anomalous cost change across all returned anomalies. + * + * @return totalAnomalousCost + */ + @JsonProperty(JSON_PROPERTY_TOTAL_ANOMALOUS_COST) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Double getTotalAnomalousCost() { + return totalAnomalousCost; + } + + public void setTotalAnomalousCost(Double totalAnomalousCost) { + this.totalAnomalousCost = totalAnomalousCost; + } + + public CostAnomaliesResponseDataAttributes totalCount(Long totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * Total number of anomalies that match the request. + * + * @return totalCount + */ + @JsonProperty(JSON_PROPERTY_TOTAL_COUNT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getTotalCount() { + return totalCount; + } + + public void setTotalCount(Long totalCount) { + this.totalCount = totalCount; + } + + /** + * 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 CostAnomaliesResponseDataAttributes + */ + @JsonAnySetter + public CostAnomaliesResponseDataAttributes 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 CostAnomaliesResponseDataAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CostAnomaliesResponseDataAttributes costAnomaliesResponseDataAttributes = + (CostAnomaliesResponseDataAttributes) o; + return Objects.equals(this.anomalies, costAnomaliesResponseDataAttributes.anomalies) + && Objects.equals( + this.avgDailyAnomalousCost, costAnomaliesResponseDataAttributes.avgDailyAnomalousCost) + && Objects.equals(this.totalActualCost, costAnomaliesResponseDataAttributes.totalActualCost) + && Objects.equals( + this.totalAnomalousCost, costAnomaliesResponseDataAttributes.totalAnomalousCost) + && Objects.equals(this.totalCount, costAnomaliesResponseDataAttributes.totalCount) + && Objects.equals( + this.additionalProperties, costAnomaliesResponseDataAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + anomalies, + avgDailyAnomalousCost, + totalActualCost, + totalAnomalousCost, + totalCount, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CostAnomaliesResponseDataAttributes {\n"); + sb.append(" anomalies: ").append(toIndentedString(anomalies)).append("\n"); + sb.append(" avgDailyAnomalousCost: ") + .append(toIndentedString(avgDailyAnomalousCost)) + .append("\n"); + sb.append(" totalActualCost: ").append(toIndentedString(totalActualCost)).append("\n"); + sb.append(" totalAnomalousCost: ").append(toIndentedString(totalAnomalousCost)).append("\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).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/CostAnomaliesResponseDataType.java b/src/main/java/com/datadog/api/client/v2/model/CostAnomaliesResponseDataType.java new file mode 100644 index 00000000000..61825e40c78 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CostAnomaliesResponseDataType.java @@ -0,0 +1,56 @@ +/* + * 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; + +/** Type of the cost anomalies collection resource. Must be anomalies. */ +@JsonSerialize(using = CostAnomaliesResponseDataType.CostAnomaliesResponseDataTypeSerializer.class) +public class CostAnomaliesResponseDataType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("anomalies")); + + public static final CostAnomaliesResponseDataType ANOMALIES = + new CostAnomaliesResponseDataType("anomalies"); + + CostAnomaliesResponseDataType(String value) { + super(value, allowedValues); + } + + public static class CostAnomaliesResponseDataTypeSerializer + extends StdSerializer { + public CostAnomaliesResponseDataTypeSerializer(Class t) { + super(t); + } + + public CostAnomaliesResponseDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + CostAnomaliesResponseDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CostAnomaliesResponseDataType fromValue(String value) { + return new CostAnomaliesResponseDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CostAnomaly.java b/src/main/java/com/datadog/api/client/v2/model/CostAnomaly.java new file mode 100644 index 00000000000..83d372e74fe --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CostAnomaly.java @@ -0,0 +1,457 @@ +/* + * 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.List; +import java.util.Map; +import java.util.Objects; + +/** A single detected Cloud Cost Management anomaly. */ +@JsonPropertyOrder({ + CostAnomaly.JSON_PROPERTY_ACTUAL_COST, + CostAnomaly.JSON_PROPERTY_ANOMALOUS_COST_CHANGE, + CostAnomaly.JSON_PROPERTY_ANOMALY_END, + CostAnomaly.JSON_PROPERTY_ANOMALY_START, + CostAnomaly.JSON_PROPERTY_CORRELATED_TAGS, + CostAnomaly.JSON_PROPERTY_DIMENSIONS, + CostAnomaly.JSON_PROPERTY_DISMISSAL, + CostAnomaly.JSON_PROPERTY_MAX_COST, + CostAnomaly.JSON_PROPERTY_PROVIDER, + CostAnomaly.JSON_PROPERTY_QUERY, + CostAnomaly.JSON_PROPERTY_UUID +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CostAnomaly { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACTUAL_COST = "actual_cost"; + private Double actualCost; + + public static final String JSON_PROPERTY_ANOMALOUS_COST_CHANGE = "anomalous_cost_change"; + private Double anomalousCostChange; + + public static final String JSON_PROPERTY_ANOMALY_END = "anomaly_end"; + private Long anomalyEnd; + + public static final String JSON_PROPERTY_ANOMALY_START = "anomaly_start"; + private Long anomalyStart; + + public static final String JSON_PROPERTY_CORRELATED_TAGS = "correlated_tags"; + private Map> correlatedTags = new HashMap>(); + + public static final String JSON_PROPERTY_DIMENSIONS = "dimensions"; + private Map dimensions = new HashMap(); + + public static final String JSON_PROPERTY_DISMISSAL = "dismissal"; + private CostAnomalyDismissal dismissal; + + public static final String JSON_PROPERTY_MAX_COST = "max_cost"; + private Double maxCost; + + public static final String JSON_PROPERTY_PROVIDER = "provider"; + private String provider; + + public static final String JSON_PROPERTY_QUERY = "query"; + private String query; + + public static final String JSON_PROPERTY_UUID = "uuid"; + private String uuid; + + public CostAnomaly() {} + + @JsonCreator + public CostAnomaly( + @JsonProperty(required = true, value = JSON_PROPERTY_ACTUAL_COST) Double actualCost, + @JsonProperty(required = true, value = JSON_PROPERTY_ANOMALOUS_COST_CHANGE) + Double anomalousCostChange, + @JsonProperty(required = true, value = JSON_PROPERTY_ANOMALY_END) Long anomalyEnd, + @JsonProperty(required = true, value = JSON_PROPERTY_ANOMALY_START) Long anomalyStart, + @JsonProperty(required = true, value = JSON_PROPERTY_CORRELATED_TAGS) + Map> correlatedTags, + @JsonProperty(required = true, value = JSON_PROPERTY_DIMENSIONS) + Map dimensions, + @JsonProperty(required = true, value = JSON_PROPERTY_MAX_COST) Double maxCost, + @JsonProperty(required = true, value = JSON_PROPERTY_PROVIDER) String provider, + @JsonProperty(required = true, value = JSON_PROPERTY_QUERY) String query, + @JsonProperty(required = true, value = JSON_PROPERTY_UUID) String uuid) { + this.actualCost = actualCost; + this.anomalousCostChange = anomalousCostChange; + this.anomalyEnd = anomalyEnd; + this.anomalyStart = anomalyStart; + this.correlatedTags = correlatedTags; + if (correlatedTags != null) {} + this.dimensions = dimensions; + this.maxCost = maxCost; + this.provider = provider; + this.query = query; + this.uuid = uuid; + } + + public CostAnomaly actualCost(Double actualCost) { + this.actualCost = actualCost; + return this; + } + + /** + * Actual cost incurred during the anomaly window. + * + * @return actualCost + */ + @JsonProperty(JSON_PROPERTY_ACTUAL_COST) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Double getActualCost() { + return actualCost; + } + + public void setActualCost(Double actualCost) { + this.actualCost = actualCost; + } + + public CostAnomaly anomalousCostChange(Double anomalousCostChange) { + this.anomalousCostChange = anomalousCostChange; + return this; + } + + /** + * Anomalous cost change relative to the expected baseline. + * + * @return anomalousCostChange + */ + @JsonProperty(JSON_PROPERTY_ANOMALOUS_COST_CHANGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Double getAnomalousCostChange() { + return anomalousCostChange; + } + + public void setAnomalousCostChange(Double anomalousCostChange) { + this.anomalousCostChange = anomalousCostChange; + } + + public CostAnomaly anomalyEnd(Long anomalyEnd) { + this.anomalyEnd = anomalyEnd; + return this; + } + + /** + * Anomaly end timestamp in Unix milliseconds. + * + * @return anomalyEnd + */ + @JsonProperty(JSON_PROPERTY_ANOMALY_END) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getAnomalyEnd() { + return anomalyEnd; + } + + public void setAnomalyEnd(Long anomalyEnd) { + this.anomalyEnd = anomalyEnd; + } + + public CostAnomaly anomalyStart(Long anomalyStart) { + this.anomalyStart = anomalyStart; + return this; + } + + /** + * Anomaly start timestamp in Unix milliseconds. + * + * @return anomalyStart + */ + @JsonProperty(JSON_PROPERTY_ANOMALY_START) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getAnomalyStart() { + return anomalyStart; + } + + public void setAnomalyStart(Long anomalyStart) { + this.anomalyStart = anomalyStart; + } + + public CostAnomaly correlatedTags(Map> correlatedTags) { + this.correlatedTags = correlatedTags; + if (correlatedTags != null) {} + return this; + } + + public CostAnomaly putCorrelatedTagsItem(String key, List correlatedTagsItem) { + this.correlatedTags.put(key, correlatedTagsItem); + return this; + } + + /** + * Map of correlated tag keys to the list of correlated tag values. + * + * @return correlatedTags + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CORRELATED_TAGS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Map> getCorrelatedTags() { + return correlatedTags; + } + + public void setCorrelatedTags(Map> correlatedTags) { + this.correlatedTags = correlatedTags; + } + + public CostAnomaly dimensions(Map dimensions) { + this.dimensions = dimensions; + return this; + } + + public CostAnomaly putDimensionsItem(String key, String dimensionsItem) { + this.dimensions.put(key, dimensionsItem); + return this; + } + + /** + * Map of cost dimension keys to their values for the anomaly grouping. + * + * @return dimensions + */ + @JsonProperty(JSON_PROPERTY_DIMENSIONS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Map getDimensions() { + return dimensions; + } + + public void setDimensions(Map dimensions) { + this.dimensions = dimensions; + } + + public CostAnomaly dismissal(CostAnomalyDismissal dismissal) { + this.dismissal = dismissal; + this.unparsed |= dismissal.unparsed; + return this; + } + + /** + * Resolution metadata for an anomaly that has been dismissed. + * + * @return dismissal + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DISMISSAL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CostAnomalyDismissal getDismissal() { + return dismissal; + } + + public void setDismissal(CostAnomalyDismissal dismissal) { + this.dismissal = dismissal; + } + + public CostAnomaly maxCost(Double maxCost) { + this.maxCost = maxCost; + return this; + } + + /** + * Maximum cost observed during the anomaly window. + * + * @return maxCost + */ + @JsonProperty(JSON_PROPERTY_MAX_COST) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Double getMaxCost() { + return maxCost; + } + + public void setMaxCost(Double maxCost) { + this.maxCost = maxCost; + } + + public CostAnomaly provider(String provider) { + this.provider = provider; + return this; + } + + /** + * Cloud or SaaS provider associated with the anomaly (for example aws, gcp + * , azure). + * + * @return provider + */ + @JsonProperty(JSON_PROPERTY_PROVIDER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getProvider() { + return provider; + } + + public void setProvider(String provider) { + this.provider = provider; + } + + public CostAnomaly query(String query) { + this.query = query; + return this; + } + + /** + * The metrics query that detected the anomaly. + * + * @return query + */ + @JsonProperty(JSON_PROPERTY_QUERY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getQuery() { + return query; + } + + public void setQuery(String query) { + this.query = query; + } + + public CostAnomaly uuid(String uuid) { + this.uuid = uuid; + return this; + } + + /** + * The unique identifier of the anomaly. + * + * @return uuid + */ + @JsonProperty(JSON_PROPERTY_UUID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + /** + * 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 CostAnomaly + */ + @JsonAnySetter + public CostAnomaly 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 CostAnomaly object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CostAnomaly costAnomaly = (CostAnomaly) o; + return Objects.equals(this.actualCost, costAnomaly.actualCost) + && Objects.equals(this.anomalousCostChange, costAnomaly.anomalousCostChange) + && Objects.equals(this.anomalyEnd, costAnomaly.anomalyEnd) + && Objects.equals(this.anomalyStart, costAnomaly.anomalyStart) + && Objects.equals(this.correlatedTags, costAnomaly.correlatedTags) + && Objects.equals(this.dimensions, costAnomaly.dimensions) + && Objects.equals(this.dismissal, costAnomaly.dismissal) + && Objects.equals(this.maxCost, costAnomaly.maxCost) + && Objects.equals(this.provider, costAnomaly.provider) + && Objects.equals(this.query, costAnomaly.query) + && Objects.equals(this.uuid, costAnomaly.uuid) + && Objects.equals(this.additionalProperties, costAnomaly.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + actualCost, + anomalousCostChange, + anomalyEnd, + anomalyStart, + correlatedTags, + dimensions, + dismissal, + maxCost, + provider, + query, + uuid, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CostAnomaly {\n"); + sb.append(" actualCost: ").append(toIndentedString(actualCost)).append("\n"); + sb.append(" anomalousCostChange: ") + .append(toIndentedString(anomalousCostChange)) + .append("\n"); + sb.append(" anomalyEnd: ").append(toIndentedString(anomalyEnd)).append("\n"); + sb.append(" anomalyStart: ").append(toIndentedString(anomalyStart)).append("\n"); + sb.append(" correlatedTags: ").append(toIndentedString(correlatedTags)).append("\n"); + sb.append(" dimensions: ").append(toIndentedString(dimensions)).append("\n"); + sb.append(" dismissal: ").append(toIndentedString(dismissal)).append("\n"); + sb.append(" maxCost: ").append(toIndentedString(maxCost)).append("\n"); + sb.append(" provider: ").append(toIndentedString(provider)).append("\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).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/CostAnomalyDismissal.java b/src/main/java/com/datadog/api/client/v2/model/CostAnomalyDismissal.java new file mode 100644 index 00000000000..e9b5da15790 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CostAnomalyDismissal.java @@ -0,0 +1,257 @@ +/* + * 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; + +/** Resolution metadata for an anomaly that has been dismissed. */ +@JsonPropertyOrder({ + CostAnomalyDismissal.JSON_PROPERTY_CAUSE, + CostAnomalyDismissal.JSON_PROPERTY_DISMISSAL_ID, + CostAnomalyDismissal.JSON_PROPERTY_MESSAGE, + CostAnomalyDismissal.JSON_PROPERTY_UPDATED_AT, + CostAnomalyDismissal.JSON_PROPERTY_UPDATED_BY +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CostAnomalyDismissal { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CAUSE = "cause"; + private String cause; + + public static final String JSON_PROPERTY_DISMISSAL_ID = "dismissal_id"; + private String dismissalId; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + private String message; + + public static final String JSON_PROPERTY_UPDATED_AT = "updated_at"; + private Long updatedAt; + + public static final String JSON_PROPERTY_UPDATED_BY = "updated_by"; + private String updatedBy; + + public CostAnomalyDismissal() {} + + @JsonCreator + public CostAnomalyDismissal( + @JsonProperty(required = true, value = JSON_PROPERTY_CAUSE) String cause, + @JsonProperty(required = true, value = JSON_PROPERTY_DISMISSAL_ID) String dismissalId, + @JsonProperty(required = true, value = JSON_PROPERTY_MESSAGE) String message, + @JsonProperty(required = true, value = JSON_PROPERTY_UPDATED_AT) Long updatedAt, + @JsonProperty(required = true, value = JSON_PROPERTY_UPDATED_BY) String updatedBy) { + this.cause = cause; + this.dismissalId = dismissalId; + this.message = message; + this.updatedAt = updatedAt; + this.updatedBy = updatedBy; + } + + public CostAnomalyDismissal cause(String cause) { + this.cause = cause; + return this; + } + + /** + * Reason the anomaly was dismissed. + * + * @return cause + */ + @JsonProperty(JSON_PROPERTY_CAUSE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCause() { + return cause; + } + + public void setCause(String cause) { + this.cause = cause; + } + + public CostAnomalyDismissal dismissalId(String dismissalId) { + this.dismissalId = dismissalId; + return this; + } + + /** + * Unique identifier of the dismissal record. + * + * @return dismissalId + */ + @JsonProperty(JSON_PROPERTY_DISMISSAL_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDismissalId() { + return dismissalId; + } + + public void setDismissalId(String dismissalId) { + this.dismissalId = dismissalId; + } + + public CostAnomalyDismissal message(String message) { + this.message = message; + return this; + } + + /** + * Optional message explaining the dismissal. + * + * @return message + */ + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public CostAnomalyDismissal updatedAt(Long updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Timestamp of the last dismissal update in Unix milliseconds. + * + * @return updatedAt + */ + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(Long updatedAt) { + this.updatedAt = updatedAt; + } + + public CostAnomalyDismissal updatedBy(String updatedBy) { + this.updatedBy = updatedBy; + return this; + } + + /** + * Identifier of the user that last updated the dismissal. + * + * @return updatedBy + */ + @JsonProperty(JSON_PROPERTY_UPDATED_BY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + /** + * 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 CostAnomalyDismissal + */ + @JsonAnySetter + public CostAnomalyDismissal 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 CostAnomalyDismissal object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CostAnomalyDismissal costAnomalyDismissal = (CostAnomalyDismissal) o; + return Objects.equals(this.cause, costAnomalyDismissal.cause) + && Objects.equals(this.dismissalId, costAnomalyDismissal.dismissalId) + && Objects.equals(this.message, costAnomalyDismissal.message) + && Objects.equals(this.updatedAt, costAnomalyDismissal.updatedAt) + && Objects.equals(this.updatedBy, costAnomalyDismissal.updatedBy) + && Objects.equals(this.additionalProperties, costAnomalyDismissal.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(cause, dismissalId, message, updatedAt, updatedBy, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CostAnomalyDismissal {\n"); + sb.append(" cause: ").append(toIndentedString(cause)).append("\n"); + sb.append(" dismissalId: ").append(toIndentedString(dismissalId)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" updatedBy: ").append(toIndentedString(updatedBy)).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/CostAnomalyResponse.java b/src/main/java/com/datadog/api/client/v2/model/CostAnomalyResponse.java new file mode 100644 index 00000000000..3462060ba53 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CostAnomalyResponse.java @@ -0,0 +1,136 @@ +/* + * 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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Response object containing a single Cloud Cost Management anomaly. */ +@JsonPropertyOrder({CostAnomalyResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CostAnomalyResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private CostAnomalyResponseData data; + + public CostAnomalyResponse data(CostAnomalyResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Resource wrapper for a single cost anomaly. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CostAnomalyResponseData getData() { + return data; + } + + public void setData(CostAnomalyResponseData 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 CostAnomalyResponse + */ + @JsonAnySetter + public CostAnomalyResponse 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 CostAnomalyResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CostAnomalyResponse costAnomalyResponse = (CostAnomalyResponse) o; + return Objects.equals(this.data, costAnomalyResponse.data) + && Objects.equals(this.additionalProperties, costAnomalyResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CostAnomalyResponse {\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/CostAnomalyResponseData.java b/src/main/java/com/datadog/api/client/v2/model/CostAnomalyResponseData.java new file mode 100644 index 00000000000..8d04cee4b52 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CostAnomalyResponseData.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; + +/** Resource wrapper for a single cost anomaly. */ +@JsonPropertyOrder({ + CostAnomalyResponseData.JSON_PROPERTY_ATTRIBUTES, + CostAnomalyResponseData.JSON_PROPERTY_ID, + CostAnomalyResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CostAnomalyResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private CostAnomaly attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CostAnomaliesResponseDataType type = CostAnomaliesResponseDataType.ANOMALIES; + + public CostAnomalyResponseData() {} + + @JsonCreator + public CostAnomalyResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) CostAnomaly attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + CostAnomaliesResponseDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CostAnomalyResponseData attributes(CostAnomaly attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * A single detected Cloud Cost Management anomaly. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CostAnomaly getAttributes() { + return attributes; + } + + public void setAttributes(CostAnomaly attributes) { + this.attributes = attributes; + } + + public CostAnomalyResponseData id(String id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the anomaly. + * + * @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 CostAnomalyResponseData type(CostAnomaliesResponseDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of the cost anomalies collection resource. Must be anomalies. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CostAnomaliesResponseDataType getType() { + return type; + } + + public void setType(CostAnomaliesResponseDataType 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 CostAnomalyResponseData + */ + @JsonAnySetter + public CostAnomalyResponseData 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 CostAnomalyResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CostAnomalyResponseData costAnomalyResponseData = (CostAnomalyResponseData) o; + return Objects.equals(this.attributes, costAnomalyResponseData.attributes) + && Objects.equals(this.id, costAnomalyResponseData.id) + && Objects.equals(this.type, costAnomalyResponseData.type) + && Objects.equals(this.additionalProperties, costAnomalyResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CostAnomalyResponseData {\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/test/resources/com/datadog/api/client/v2/api/cloud_cost_management.feature b/src/test/resources/com/datadog/api/client/v2/api/cloud_cost_management.feature index bf9f695d40e..9bab51741ef 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/cloud_cost_management.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/cloud_cost_management.feature @@ -292,6 +292,30 @@ Feature: Cloud Cost Management And the response "data.attributes.configs[0].dataset_type" is equal to "amortized" And the response "data.attributes.configs[1].dataset_type" is equal to "actual" + @generated @skip @team:DataDog/cloud-cost-management + Scenario: Get cost anomaly returns "Bad Request" response + Given operation "GetCostAnomaly" enabled + And new "GetCostAnomaly" request + And request contains "anomaly_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/cloud-cost-management + Scenario: Get cost anomaly returns "Not Found" response + Given operation "GetCostAnomaly" enabled + And new "GetCostAnomaly" request + And request contains "anomaly_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/cloud-cost-management + Scenario: Get cost anomaly returns "OK" response + Given operation "GetCostAnomaly" enabled + And new "GetCostAnomaly" request + And request contains "anomaly_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @replay-only @team:DataDog/cloud-cost-management Scenario: Get custom allocation rule returns "OK" response Given new "GetCustomAllocationRule" request @@ -357,6 +381,20 @@ Feature: Cloud Cost Management When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/cloud-cost-management + Scenario: List cost anomalies returns "Bad Request" response + Given operation "ListCostAnomalies" enabled + And new "ListCostAnomalies" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/cloud-cost-management + Scenario: List cost anomalies returns "OK" response + Given operation "ListCostAnomalies" enabled + And new "ListCostAnomalies" request + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/cloud-cost-management Scenario: List custom allocation rule statuses returns "OK" response Given new "ListCustomAllocationRulesStatus" request 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 1ca1c2309ae..b9805518e9d 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 @@ -1265,6 +1265,18 @@ "type": "safe" } }, + "ListCostAnomalies": { + "tag": "Cloud Cost Management", + "undo": { + "type": "safe" + } + }, + "GetCostAnomaly": { + "tag": "Cloud Cost Management", + "undo": { + "type": "safe" + } + }, "ListCustomAllocationRules": { "tag": "Cloud Cost Management", "undo": {