From bf7a889967343c1ae5512729c14af8af06d00d3c Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 2 Sep 2026 20:28:04 +0000 Subject: [PATCH] Regenerate client from commit 3513039 of spec repo --- .generator/schemas/v2/openapi.yaml | 649 ++++++++++++++ .../cloud-cost-management/CreateUnitCost.java | 72 ++ .../cloud-cost-management/DeleteUnitCost.java | 24 + .../v2/cloud-cost-management/GetUnitCost.java | 27 + .../cloud-cost-management/ListUnitCosts.java | 25 + .../cloud-cost-management/UpdateUnitCost.java | 75 ++ .../com/datadog/api/client/ApiClient.java | 5 + .../client/v2/api/CloudCostManagementApi.java | 794 +++++++++++++++++- .../v2/model/UnitCostCreateRequest.java | 148 ++++ .../v2/model/UnitCostCreateRequestData.java | 185 ++++ .../model/UnitCostDataAttributesResponse.java | 464 ++++++++++ .../client/v2/model/UnitCostDataResponse.java | 213 +++++ .../v2/model/UnitCostQueryDefinition.java | 187 +++++ .../v2/model/UnitCostRequestAttributes.java | 282 +++++++ .../api/client/v2/model/UnitCostResponse.java | 148 ++++ .../api/client/v2/model/UnitCostType.java | 53 ++ .../v2/model/UnitCostUpdateRequest.java | 148 ++++ .../v2/model/UnitCostUpdateRequestData.java | 215 +++++ .../client/v2/model/UnitCostsResponse.java | 162 ++++ .../v2/api/cloud_cost_management.feature | 98 +++ .../com/datadog/api/client/v2/api/undo.json | 37 + 21 files changed, 3995 insertions(+), 16 deletions(-) create mode 100644 examples/v2/cloud-cost-management/CreateUnitCost.java create mode 100644 examples/v2/cloud-cost-management/DeleteUnitCost.java create mode 100644 examples/v2/cloud-cost-management/GetUnitCost.java create mode 100644 examples/v2/cloud-cost-management/ListUnitCosts.java create mode 100644 examples/v2/cloud-cost-management/UpdateUnitCost.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UnitCostCreateRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UnitCostCreateRequestData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UnitCostDataAttributesResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UnitCostDataResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UnitCostQueryDefinition.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UnitCostRequestAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UnitCostResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UnitCostType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UnitCostUpdateRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UnitCostUpdateRequestData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UnitCostsResponse.java diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index c78659f543e..cc0ad4db852 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -2114,6 +2114,15 @@ components: required: true schema: type: string + UnitCostID: + description: The UUID of the unit cost. + example: 64aecd58-e355-4f07-9c3a-56ff6bda6cd8 + in: path + name: unit_cost_id + required: true + schema: + format: uuid + type: string UserAuthorizedClientId: description: The ID of the user authorized client. in: path @@ -120270,6 +120279,236 @@ components: example: min type: string type: object + UnitCostCreateRequest: + description: A request to create a unit cost. + properties: + data: + $ref: "#/components/schemas/UnitCostCreateRequestData" + required: + - data + type: object + UnitCostCreateRequestData: + description: The data object of a unit cost create request. + properties: + attributes: + $ref: "#/components/schemas/UnitCostRequestAttributes" + type: + $ref: "#/components/schemas/UnitCostType" + required: + - type + - attributes + type: object + UnitCostDataAttributesResponse: + description: The attributes of a unit cost. + properties: + created_at: + description: The time the unit cost was created. + example: "2026-09-01T18:46:15.933716Z" + format: date-time + type: string + created_by: + description: The UUID of the user who created the unit cost. + example: 36ea1610-8866-4bd3-bb6d-9bb9fc87cad2 + format: uuid + type: string + denominator_query: + $ref: "#/components/schemas/UnitCostQueryDefinition" + denominator_type: + description: |- + The data source of the denominator queries, or `multisource` when the denominator + queries span more than one data source. + example: metrics + type: string + description: + description: The description of the unit cost. Omitted when the unit cost has no description. + example: Amortized cloud spend divided by the number of active users. + nullable: true + type: string + name: + description: The name of the unit cost. + example: Cloud cost per active user + type: string + numerator_query: + $ref: "#/components/schemas/UnitCostQueryDefinition" + org_id: + description: The ID of the organization the unit cost belongs to. + example: 321813 + format: int64 + type: integer + unit_label: + description: The label describing the denominator unit. + example: user + type: string + updated_at: + description: The time the unit cost was last updated. + example: "2026-09-01T19:52:08.820536Z" + format: date-time + type: string + updated_by: + description: The UUID of the user who last updated the unit cost. + example: 13cc0adf-2595-479e-b448-5051c180dddb + format: uuid + type: string + required: + - org_id + - name + - numerator_query + - denominator_query + - denominator_type + - unit_label + - created_by + - updated_by + - created_at + - updated_at + type: object + UnitCostDataResponse: + description: The data object of a unit cost response. + properties: + attributes: + $ref: "#/components/schemas/UnitCostDataAttributesResponse" + id: + description: The UUID of the unit cost. + example: 64aecd58-e355-4f07-9c3a-56ff6bda6cd8 + format: uuid + type: string + type: + $ref: "#/components/schemas/UnitCostType" + required: + - id + - type + - attributes + type: object + UnitCostDataResponseArray: + description: The list of unit costs. + items: + $ref: "#/components/schemas/UnitCostDataResponse" + type: array + UnitCostFormula: + additionalProperties: {} + description: |- + A formula combining the named queries into a single result, passed through to the + query engine unchanged. + example: + formula: numerator + type: object + UnitCostFormulaArray: + description: The list of formulas applied to the queries for this side of the ratio. + example: + - formula: numerator + items: + $ref: "#/components/schemas/UnitCostFormula" + type: array + UnitCostQuery: + additionalProperties: {} + description: |- + A single query contributing to a unit cost numerator or denominator. The accepted fields + depend on the data source the query targets, for example `cloud_cost`, `metrics`, `dora`, + or `ci_pipelines`, and are passed through to the query engine unchanged. + example: + data_source: cloud_cost + name: numerator + query: "sum:aws.cost.net.amortized.shared.resources.allocated{*}.rollup(sum, daily)" + type: object + UnitCostQueryArray: + description: The list of queries evaluated for this side of the ratio. + example: + - data_source: cloud_cost + name: numerator + query: "sum:aws.cost.net.amortized.shared.resources.allocated{*}.rollup(sum, daily)" + items: + $ref: "#/components/schemas/UnitCostQuery" + type: array + UnitCostQueryDefinition: + additionalProperties: {} + description: A timeseries object containing `queries` and `formulas` arrays. + properties: + formulas: + $ref: "#/components/schemas/UnitCostFormulaArray" + queries: + $ref: "#/components/schemas/UnitCostQueryArray" + required: + - queries + - formulas + type: object + UnitCostRequestAttributes: + description: The attributes of a unit cost create or replace request. + properties: + denominator_query: + $ref: "#/components/schemas/UnitCostQueryDefinition" + description: + description: An optional description of the unit cost. At most 2000 characters. + example: Amortized cloud spend divided by the number of active users. + maxLength: 2000 + nullable: true + type: string + name: + description: The name of the unit cost. At most 200 characters. + example: Cloud cost per active user + maxLength: 200 + type: string + numerator_query: + $ref: "#/components/schemas/UnitCostQueryDefinition" + unit_label: + description: The label describing the denominator unit, for example `user`. At most 100 characters. + example: user + maxLength: 100 + type: string + required: + - name + - numerator_query + - denominator_query + - unit_label + type: object + UnitCostResponse: + description: A response containing a single unit cost. + properties: + data: + $ref: "#/components/schemas/UnitCostDataResponse" + required: + - data + type: object + UnitCostType: + default: unit_cost + description: The JSON:API resource type for a unit cost. + enum: + - unit_cost + example: unit_cost + type: string + x-enum-varnames: + - UNIT_COST + UnitCostUpdateRequest: + description: A request to replace a unit cost. + properties: + data: + $ref: "#/components/schemas/UnitCostUpdateRequestData" + required: + - data + type: object + UnitCostUpdateRequestData: + description: The data object of a unit cost replace request. + properties: + attributes: + $ref: "#/components/schemas/UnitCostRequestAttributes" + id: + description: The UUID of the unit cost being replaced. Must match the `unit_cost_id` path parameter. + example: 64aecd58-e355-4f07-9c3a-56ff6bda6cd8 + format: uuid + type: string + type: + $ref: "#/components/schemas/UnitCostType" + required: + - id + - type + - attributes + type: object + UnitCostsResponse: + description: A response containing a list of unit costs. + properties: + data: + $ref: "#/components/schemas/UnitCostDataResponseArray" + required: + - data + type: object UnpublishAppResponse: description: The response object after an app is successfully unpublished. properties: @@ -142859,6 +143098,416 @@ paths: operator: OR permissions: - cloud_cost_management_read + /api/v2/cost/unit_costs: + get: + description: List the ROI metrics (unit costs) for the authenticated organization. + operationId: ListUnitCosts + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + created_at: "2026-09-01T18:46:15.933716Z" + created_by: 36ea1610-8866-4bd3-bb6d-9bb9fc87cad2 + denominator_query: + formulas: + - formula: denominator + queries: + - data_source: metrics + name: denominator + query: "avg:system.cpu.user{*}" + response_format: timeseries + denominator_type: metrics + name: Cloud cost per active user + numerator_query: + formulas: + - formula: numerator + queries: + - data_source: cloud_cost + name: numerator + query: "sum:aws.cost.net.amortized.shared.resources.allocated{*}.rollup(sum, daily)" + response_format: timeseries + org_id: 321813 + unit_label: user + updated_at: "2026-09-01T19:52:08.820536Z" + updated_by: 13cc0adf-2595-479e-b448-5051c180dddb + id: 64aecd58-e355-4f07-9c3a-56ff6bda6cd8 + type: unit_cost + - attributes: + created_at: "2026-09-02T00:59:12.708413Z" + created_by: 36ea1610-8866-4bd3-bb6d-9bb9fc87cad2 + denominator_query: + formulas: + - formula: denominator + queries: + - compute: + aggregation: count + data_source: ci_pipelines + group_by: [] + indexes: + - "*" + name: denominator + search: + query: "ci_level:pipeline @ci.status:success" + storage: hot + response_format: timeseries + denominator_type: ci_pipelines + name: Cloud cost per successful pipeline + numerator_query: + formulas: + - formula: numerator + queries: + - data_source: cloud_cost + name: numerator + query: "sum:custom.cost.amortized{*}.rollup(sum, daily)" + response_format: timeseries + org_id: 321813 + unit_label: pipeline + updated_at: "2026-09-02T01:00:05.709773Z" + updated_by: 36ea1610-8866-4bd3-bb6d-9bb9fc87cad2 + id: ab11677e-396e-4dce-8018-bbeb398315ae + type: unit_cost + schema: + $ref: "#/components/schemas/UnitCostsResponse" + description: OK + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: List unit costs + tags: + - Cloud Cost Management + "x-permission": + operator: OR + permissions: + - cloud_cost_management_read + 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/). + post: + description: Create an ROI metric (unit cost) using the given numerator and denominator queries. + operationId: CreateUnitCost + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + denominator_query: + formulas: + - formula: denominator + queries: + - data_source: metrics + name: denominator + query: "avg:system.cpu.user{*}" + response_format: timeseries + name: Cloud cost per active user + numerator_query: + formulas: + - formula: numerator + queries: + - data_source: cloud_cost + name: numerator + query: "sum:aws.cost.net.amortized.shared.resources.allocated{*}.rollup(sum, daily)" + response_format: timeseries + unit_label: user + type: unit_cost + schema: + $ref: "#/components/schemas/UnitCostCreateRequest" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2026-09-01T18:46:15.933716Z" + created_by: 36ea1610-8866-4bd3-bb6d-9bb9fc87cad2 + denominator_query: + formulas: + - formula: denominator + queries: + - data_source: metrics + name: denominator + query: "avg:system.cpu.user{*}" + response_format: timeseries + denominator_type: metrics + name: Cloud cost per active user + numerator_query: + formulas: + - formula: numerator + queries: + - data_source: cloud_cost + name: numerator + query: "sum:aws.cost.net.amortized.shared.resources.allocated{*}.rollup(sum, daily)" + response_format: timeseries + org_id: 321813 + unit_label: user + updated_at: "2026-09-01T18:46:15.933716Z" + updated_by: 36ea1610-8866-4bd3-bb6d-9bb9fc87cad2 + id: 64aecd58-e355-4f07-9c3a-56ff6bda6cd8 + type: unit_cost + schema: + $ref: "#/components/schemas/UnitCostResponse" + description: Created + headers: + Location: + description: The path of the newly created unit cost. + schema: + type: string + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Create a unit cost + tags: + - Cloud Cost Management + "x-permission": + operator: OR + permissions: + - cloud_cost_management_read + 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/unit_costs/{unit_cost_id}: + delete: + description: Delete an ROI metric (unit cost). + operationId: DeleteUnitCost + parameters: + - $ref: "#/components/parameters/UnitCostID" + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Delete a unit cost + tags: + - Cloud Cost Management + "x-permission": + operator: OR + permissions: + - cloud_cost_management_read + 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/). + get: + description: Retrieve an ROI metric (unit cost) by UUID. + operationId: GetUnitCost + parameters: + - $ref: "#/components/parameters/UnitCostID" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2026-09-01T18:46:15.933716Z" + created_by: 36ea1610-8866-4bd3-bb6d-9bb9fc87cad2 + denominator_query: + formulas: + - formula: denominator + queries: + - data_source: metrics + name: denominator + query: "avg:system.cpu.user{*}" + response_format: timeseries + denominator_type: metrics + name: Cloud cost per active user + numerator_query: + formulas: + - formula: numerator + queries: + - data_source: cloud_cost + name: numerator + query: "sum:aws.cost.net.amortized.shared.resources.allocated{*}.rollup(sum, daily)" + response_format: timeseries + org_id: 321813 + unit_label: user + updated_at: "2026-09-01T19:52:08.820536Z" + updated_by: 13cc0adf-2595-479e-b448-5051c180dddb + id: 64aecd58-e355-4f07-9c3a-56ff6bda6cd8 + type: unit_cost + schema: + $ref: "#/components/schemas/UnitCostResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get a unit cost + tags: + - Cloud Cost Management + "x-permission": + operator: OR + permissions: + - cloud_cost_management_read + 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/). + put: + description: Replace an ROI metric (unit cost) with a new set of attributes. + operationId: UpdateUnitCost + parameters: + - $ref: "#/components/parameters/UnitCostID" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + denominator_query: + formulas: + - formula: denominator + queries: + - data_source: metrics + name: denominator + query: "avg:system.cpu.user{*}" + response_format: timeseries + name: Cloud cost per active user + numerator_query: + formulas: + - formula: numerator + queries: + - data_source: cloud_cost + name: numerator + query: "sum:aws.cost.net.amortized.shared.resources.allocated{*}.rollup(sum, daily)" + response_format: timeseries + unit_label: user + id: 64aecd58-e355-4f07-9c3a-56ff6bda6cd8 + type: unit_cost + schema: + $ref: "#/components/schemas/UnitCostUpdateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2026-09-01T18:46:15.933716Z" + created_by: 36ea1610-8866-4bd3-bb6d-9bb9fc87cad2 + denominator_query: + formulas: + - formula: denominator + queries: + - data_source: metrics + name: denominator + query: "avg:system.cpu.user{*}" + response_format: timeseries + denominator_type: metrics + name: Cloud cost per active user + numerator_query: + formulas: + - formula: numerator + queries: + - data_source: cloud_cost + name: numerator + query: "sum:aws.cost.net.amortized.shared.resources.allocated{*}.rollup(sum, daily)" + response_format: timeseries + org_id: 321813 + unit_label: user + updated_at: "2026-09-01T19:52:08.820536Z" + updated_by: 13cc0adf-2595-479e-b448-5051c180dddb + id: 64aecd58-e355-4f07-9c3a-56ff6bda6cd8 + type: unit_cost + schema: + $ref: "#/components/schemas/UnitCostResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Update a unit cost + tags: + - Cloud Cost Management + "x-permission": + operator: OR + permissions: + - cloud_cost_management_read + 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_by_tag/active_billing_dimensions: get: description: |- diff --git a/examples/v2/cloud-cost-management/CreateUnitCost.java b/examples/v2/cloud-cost-management/CreateUnitCost.java new file mode 100644 index 00000000000..79258173377 --- /dev/null +++ b/examples/v2/cloud-cost-management/CreateUnitCost.java @@ -0,0 +1,72 @@ +// Create a unit cost returns "Created" 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.UnitCostCreateRequest; +import com.datadog.api.client.v2.model.UnitCostCreateRequestData; +import com.datadog.api.client.v2.model.UnitCostQueryDefinition; +import com.datadog.api.client.v2.model.UnitCostRequestAttributes; +import com.datadog.api.client.v2.model.UnitCostResponse; +import com.datadog.api.client.v2.model.UnitCostType; +import java.util.Collections; +import java.util.Map; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createUnitCost", true); + CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient); + + UnitCostCreateRequest body = + new UnitCostCreateRequest() + .data( + new UnitCostCreateRequestData() + .attributes( + new UnitCostRequestAttributes() + .denominatorQuery( + new UnitCostQueryDefinition() + .formulas( + Collections.singletonList( + Map.ofEntries(Map.entry("formula", "numerator")))) + .queries( + Collections.singletonList( + Map.ofEntries( + Map.entry("data_source", "cloud_cost"), + Map.entry("name", "numerator"), + Map.entry( + "query", + "sum:aws.cost.net.amortized.shared.resources.allocated{*}.rollup(sum," + + " daily)"))))) + .description( + "Amortized cloud spend divided by the number of active users.") + .name("Cloud cost per active user") + .numeratorQuery( + new UnitCostQueryDefinition() + .formulas( + Collections.singletonList( + Map.ofEntries(Map.entry("formula", "numerator")))) + .queries( + Collections.singletonList( + Map.ofEntries( + Map.entry("data_source", "cloud_cost"), + Map.entry("name", "numerator"), + Map.entry( + "query", + "sum:aws.cost.net.amortized.shared.resources.allocated{*}.rollup(sum," + + " daily)"))))) + .unitLabel("user")) + .type(UnitCostType.UNIT_COST)); + + try { + UnitCostResponse result = apiInstance.createUnitCost(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CloudCostManagementApi#createUnitCost"); + 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/DeleteUnitCost.java b/examples/v2/cloud-cost-management/DeleteUnitCost.java new file mode 100644 index 00000000000..375747b7736 --- /dev/null +++ b/examples/v2/cloud-cost-management/DeleteUnitCost.java @@ -0,0 +1,24 @@ +// Delete a unit cost returns "No Content" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CloudCostManagementApi; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.deleteUnitCost", true); + CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient); + + try { + apiInstance.deleteUnitCost(UUID.fromString("64aecd58-e355-4f07-9c3a-56ff6bda6cd8")); + } catch (ApiException e) { + System.err.println("Exception when calling CloudCostManagementApi#deleteUnitCost"); + 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/GetUnitCost.java b/examples/v2/cloud-cost-management/GetUnitCost.java new file mode 100644 index 00000000000..cb9cf6157ab --- /dev/null +++ b/examples/v2/cloud-cost-management/GetUnitCost.java @@ -0,0 +1,27 @@ +// Get a unit cost 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.UnitCostResponse; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getUnitCost", true); + CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient); + + try { + UnitCostResponse result = + apiInstance.getUnitCost(UUID.fromString("64aecd58-e355-4f07-9c3a-56ff6bda6cd8")); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CloudCostManagementApi#getUnitCost"); + 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/ListUnitCosts.java b/examples/v2/cloud-cost-management/ListUnitCosts.java new file mode 100644 index 00000000000..be2afd5e2f1 --- /dev/null +++ b/examples/v2/cloud-cost-management/ListUnitCosts.java @@ -0,0 +1,25 @@ +// List unit costs 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.UnitCostsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listUnitCosts", true); + CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient); + + try { + UnitCostsResponse result = apiInstance.listUnitCosts(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CloudCostManagementApi#listUnitCosts"); + 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/UpdateUnitCost.java b/examples/v2/cloud-cost-management/UpdateUnitCost.java new file mode 100644 index 00000000000..031801065c1 --- /dev/null +++ b/examples/v2/cloud-cost-management/UpdateUnitCost.java @@ -0,0 +1,75 @@ +// Update a unit cost 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.UnitCostQueryDefinition; +import com.datadog.api.client.v2.model.UnitCostRequestAttributes; +import com.datadog.api.client.v2.model.UnitCostResponse; +import com.datadog.api.client.v2.model.UnitCostType; +import com.datadog.api.client.v2.model.UnitCostUpdateRequest; +import com.datadog.api.client.v2.model.UnitCostUpdateRequestData; +import java.util.Collections; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.updateUnitCost", true); + CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient); + + UnitCostUpdateRequest body = + new UnitCostUpdateRequest() + .data( + new UnitCostUpdateRequestData() + .attributes( + new UnitCostRequestAttributes() + .denominatorQuery( + new UnitCostQueryDefinition() + .formulas( + Collections.singletonList( + Map.ofEntries(Map.entry("formula", "numerator")))) + .queries( + Collections.singletonList( + Map.ofEntries( + Map.entry("data_source", "cloud_cost"), + Map.entry("name", "numerator"), + Map.entry( + "query", + "sum:aws.cost.net.amortized.shared.resources.allocated{*}.rollup(sum," + + " daily)"))))) + .description( + "Amortized cloud spend divided by the number of active users.") + .name("Cloud cost per active user") + .numeratorQuery( + new UnitCostQueryDefinition() + .formulas( + Collections.singletonList( + Map.ofEntries(Map.entry("formula", "numerator")))) + .queries( + Collections.singletonList( + Map.ofEntries( + Map.entry("data_source", "cloud_cost"), + Map.entry("name", "numerator"), + Map.entry( + "query", + "sum:aws.cost.net.amortized.shared.resources.allocated{*}.rollup(sum," + + " daily)"))))) + .unitLabel("user")) + .id(UUID.fromString("64aecd58-e355-4f07-9c3a-56ff6bda6cd8")) + .type(UnitCostType.UNIT_COST)); + + try { + UnitCostResponse result = + apiInstance.updateUnitCost(UUID.fromString("64aecd58-e355-4f07-9c3a-56ff6bda6cd8"), body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CloudCostManagementApi#updateUnitCost"); + 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 9635aa7aab5..e3c0225db98 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -1035,6 +1035,8 @@ public class ApiClient { put("v2.getCodeCoverageBranchSummary", false); put("v2.getCodeCoverageCommitSummary", false); put("v2.getRuleBasedView", false); + put("v2.createUnitCost", false); + put("v2.deleteUnitCost", false); put("v2.getCommitmentsCommitmentList", false); put("v2.getCommitmentsCoverageScalar", false); put("v2.getCommitmentsCoverageTimeseries", false); @@ -1045,13 +1047,16 @@ public class ApiClient { put("v2.getCommitmentsUtilizationTimeseries", false); put("v2.getCostAnomaly", false); put("v2.getCostTagMetadataCurrency", false); + put("v2.getUnitCost", false); put("v2.listCostAnomalies", false); put("v2.listCostTagKeySources", false); put("v2.listCostTagMetadata", false); put("v2.listCostTagMetadataMetrics", false); put("v2.listCostTagMetadataMonths", false); put("v2.listCostTagMetadataOrchestrators", false); + put("v2.listUnitCosts", false); put("v2.searchCostRecommendations", false); + put("v2.updateUnitCost", false); put("v2.createQuotas", false); put("v2.deleteQuota", false); put("v2.listQuotas", 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 de1aa6c3bfd..9e3c32a44d3 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 @@ -71,6 +71,10 @@ import com.datadog.api.client.v2.model.RulesetRespArray; import com.datadog.api.client.v2.model.RulesetStatusRespArray; import com.datadog.api.client.v2.model.UCConfigPair; +import com.datadog.api.client.v2.model.UnitCostCreateRequest; +import com.datadog.api.client.v2.model.UnitCostResponse; +import com.datadog.api.client.v2.model.UnitCostUpdateRequest; +import com.datadog.api.client.v2.model.UnitCostsResponse; import com.datadog.api.client.v2.model.UpdateRulesetRequest; import com.datadog.api.client.v2.model.ValidationResponse; import jakarta.ws.rs.client.Invocation; @@ -79,6 +83,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.UUID; import java.util.concurrent.CompletableFuture; @jakarta.annotation.Generated( @@ -789,6 +794,154 @@ public CompletableFuture> createTagPipelinesRulesetWith new GenericType() {}); } + /** + * Create a unit cost. + * + *

See {@link #createUnitCostWithHttpInfo}. + * + * @param body (required) + * @return UnitCostResponse + * @throws ApiException if fails to make API call + */ + public UnitCostResponse createUnitCost(UnitCostCreateRequest body) throws ApiException { + return createUnitCostWithHttpInfo(body).getData(); + } + + /** + * Create a unit cost. + * + *

See {@link #createUnitCostWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<UnitCostResponse> + */ + public CompletableFuture createUnitCostAsync(UnitCostCreateRequest body) { + return createUnitCostWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create an ROI metric (unit cost) using the given numerator and denominator queries. + * + * @param body (required) + * @return ApiResponse<UnitCostResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
201 Created -
400 Bad Request -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse createUnitCostWithHttpInfo(UnitCostCreateRequest body) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "createUnitCost"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createUnitCost"); + } + // create path and map variables + String localVarPath = "/api/v2/cost/unit_costs"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.createUnitCost", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create a unit cost. + * + *

See {@link #createUnitCostWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<UnitCostResponse>> + */ + public CompletableFuture> createUnitCostWithHttpInfoAsync( + UnitCostCreateRequest body) { + // Check if unstable operation is enabled + String operationId = "createUnitCost"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling createUnitCost")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/cost/unit_costs"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.createUnitCost", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Delete budget. * @@ -2077,6 +2230,158 @@ public CompletableFuture> deleteTagPipelinesRulesetWithHttpInf null); } + /** + * Delete a unit cost. + * + *

See {@link #deleteUnitCostWithHttpInfo}. + * + * @param unitCostId The UUID of the unit cost. (required) + * @throws ApiException if fails to make API call + */ + public void deleteUnitCost(UUID unitCostId) throws ApiException { + deleteUnitCostWithHttpInfo(unitCostId); + } + + /** + * Delete a unit cost. + * + *

See {@link #deleteUnitCostWithHttpInfoAsync}. + * + * @param unitCostId The UUID of the unit cost. (required) + * @return CompletableFuture + */ + public CompletableFuture deleteUnitCostAsync(UUID unitCostId) { + return deleteUnitCostWithHttpInfoAsync(unitCostId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Delete an ROI metric (unit cost). + * + * @param unitCostId The UUID of the unit cost. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse deleteUnitCostWithHttpInfo(UUID unitCostId) throws ApiException { + // Check if unstable operation is enabled + String operationId = "deleteUnitCost"; + 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 'unitCostId' is set + if (unitCostId == null) { + throw new ApiException( + 400, "Missing the required parameter 'unitCostId' when calling deleteUnitCost"); + } + // create path and map variables + String localVarPath = + "/api/v2/cost/unit_costs/{unit_cost_id}" + .replaceAll( + "\\{" + "unit_cost_id" + "\\}", apiClient.escapeString(unitCostId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.deleteUnitCost", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete a unit cost. + * + *

See {@link #deleteUnitCostWithHttpInfo}. + * + * @param unitCostId The UUID of the unit cost. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteUnitCostWithHttpInfoAsync(UUID unitCostId) { + // Check if unstable operation is enabled + String operationId = "deleteUnitCost"; + 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 'unitCostId' is set + if (unitCostId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'unitCostId' when calling deleteUnitCost")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/cost/unit_costs/{unit_cost_id}" + .replaceAll( + "\\{" + "unit_cost_id" + "\\}", apiClient.escapeString(unitCostId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.deleteUnitCost", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + /** * Generate a Cloud Cost Management tag description. * @@ -7017,26 +7322,28 @@ public CompletableFuture> getTagPipelinesRulesetWithHtt } /** - * List budgets. + * Get a unit cost. * - *

See {@link #listBudgetsWithHttpInfo}. + *

See {@link #getUnitCostWithHttpInfo}. * - * @return BudgetArray + * @param unitCostId The UUID of the unit cost. (required) + * @return UnitCostResponse * @throws ApiException if fails to make API call */ - public BudgetArray listBudgets() throws ApiException { - return listBudgetsWithHttpInfo().getData(); + public UnitCostResponse getUnitCost(UUID unitCostId) throws ApiException { + return getUnitCostWithHttpInfo(unitCostId).getData(); } /** - * List budgets. + * Get a unit cost. * - *

See {@link #listBudgetsWithHttpInfoAsync}. + *

See {@link #getUnitCostWithHttpInfoAsync}. * - * @return CompletableFuture<BudgetArray> + * @param unitCostId The UUID of the unit cost. (required) + * @return CompletableFuture<UnitCostResponse> */ - public CompletableFuture listBudgetsAsync() { - return listBudgetsWithHttpInfoAsync() + public CompletableFuture getUnitCostAsync(UUID unitCostId) { + return getUnitCostWithHttpInfoAsync(unitCostId) .thenApply( response -> { return response.getData(); @@ -7044,22 +7351,175 @@ public CompletableFuture listBudgetsAsync() { } /** - * List budgets. + * Retrieve an ROI metric (unit cost) by UUID. * - * @return ApiResponse<BudgetArray> + * @param unitCostId The UUID of the unit cost. (required) + * @return ApiResponse<UnitCostResponse> * @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 listBudgetsWithHttpInfo() throws ApiException { - Object localVarPostBody = null; - // create path and map variables - String localVarPath = "/api/v2/cost/budgets"; + public ApiResponse getUnitCostWithHttpInfo(UUID unitCostId) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "getUnitCost"; + 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 'unitCostId' is set + if (unitCostId == null) { + throw new ApiException( + 400, "Missing the required parameter 'unitCostId' when calling getUnitCost"); + } + // create path and map variables + String localVarPath = + "/api/v2/cost/unit_costs/{unit_cost_id}" + .replaceAll( + "\\{" + "unit_cost_id" + "\\}", apiClient.escapeString(unitCostId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.getUnitCost", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a unit cost. + * + *

See {@link #getUnitCostWithHttpInfo}. + * + * @param unitCostId The UUID of the unit cost. (required) + * @return CompletableFuture<ApiResponse<UnitCostResponse>> + */ + public CompletableFuture> getUnitCostWithHttpInfoAsync( + UUID unitCostId) { + // Check if unstable operation is enabled + String operationId = "getUnitCost"; + 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 'unitCostId' is set + if (unitCostId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'unitCostId' when calling getUnitCost")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/cost/unit_costs/{unit_cost_id}" + .replaceAll( + "\\{" + "unit_cost_id" + "\\}", apiClient.escapeString(unitCostId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.getUnitCost", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List budgets. + * + *

See {@link #listBudgetsWithHttpInfo}. + * + * @return BudgetArray + * @throws ApiException if fails to make API call + */ + public BudgetArray listBudgets() throws ApiException { + return listBudgetsWithHttpInfo().getData(); + } + + /** + * List budgets. + * + *

See {@link #listBudgetsWithHttpInfoAsync}. + * + * @return CompletableFuture<BudgetArray> + */ + public CompletableFuture listBudgetsAsync() { + return listBudgetsWithHttpInfoAsync() + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List budgets. + * + * @return ApiResponse<BudgetArray> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
429 Too many requests -
+ */ + public ApiResponse listBudgetsWithHttpInfo() throws ApiException { + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/cost/budgets"; Map localVarHeaderParams = new HashMap(); @@ -10371,6 +10831,132 @@ public ApiResponse listTagPipelinesRulesetsStatusWithHtt new GenericType() {}); } + /** + * List unit costs. + * + *

See {@link #listUnitCostsWithHttpInfo}. + * + * @return UnitCostsResponse + * @throws ApiException if fails to make API call + */ + public UnitCostsResponse listUnitCosts() throws ApiException { + return listUnitCostsWithHttpInfo().getData(); + } + + /** + * List unit costs. + * + *

See {@link #listUnitCostsWithHttpInfoAsync}. + * + * @return CompletableFuture<UnitCostsResponse> + */ + public CompletableFuture listUnitCostsAsync() { + return listUnitCostsWithHttpInfoAsync() + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List the ROI metrics (unit costs) for the authenticated organization. + * + * @return ApiResponse<UnitCostsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse listUnitCostsWithHttpInfo() throws ApiException { + // Check if unstable operation is enabled + String operationId = "listUnitCosts"; + 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; + // create path and map variables + String localVarPath = "/api/v2/cost/unit_costs"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.listUnitCosts", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List unit costs. + * + *

See {@link #listUnitCostsWithHttpInfo}. + * + * @return CompletableFuture<ApiResponse<UnitCostsResponse>> + */ + public CompletableFuture> listUnitCostsWithHttpInfoAsync() { + // Check if unstable operation is enabled + String operationId = "listUnitCosts"; + 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; + // create path and map variables + String localVarPath = "/api/v2/cost/unit_costs"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.listUnitCosts", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Reorder custom allocation rules. * @@ -11860,6 +12446,182 @@ public CompletableFuture> updateTagPipelinesRulesetWith new GenericType() {}); } + /** + * Update a unit cost. + * + *

See {@link #updateUnitCostWithHttpInfo}. + * + * @param unitCostId The UUID of the unit cost. (required) + * @param body (required) + * @return UnitCostResponse + * @throws ApiException if fails to make API call + */ + public UnitCostResponse updateUnitCost(UUID unitCostId, UnitCostUpdateRequest body) + throws ApiException { + return updateUnitCostWithHttpInfo(unitCostId, body).getData(); + } + + /** + * Update a unit cost. + * + *

See {@link #updateUnitCostWithHttpInfoAsync}. + * + * @param unitCostId The UUID of the unit cost. (required) + * @param body (required) + * @return CompletableFuture<UnitCostResponse> + */ + public CompletableFuture updateUnitCostAsync( + UUID unitCostId, UnitCostUpdateRequest body) { + return updateUnitCostWithHttpInfoAsync(unitCostId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Replace an ROI metric (unit cost) with a new set of attributes. + * + * @param unitCostId The UUID of the unit cost. (required) + * @param body (required) + * @return ApiResponse<UnitCostResponse> + * @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 updateUnitCostWithHttpInfo( + UUID unitCostId, UnitCostUpdateRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "updateUnitCost"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'unitCostId' is set + if (unitCostId == null) { + throw new ApiException( + 400, "Missing the required parameter 'unitCostId' when calling updateUnitCost"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling updateUnitCost"); + } + // create path and map variables + String localVarPath = + "/api/v2/cost/unit_costs/{unit_cost_id}" + .replaceAll( + "\\{" + "unit_cost_id" + "\\}", apiClient.escapeString(unitCostId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.updateUnitCost", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PUT", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update a unit cost. + * + *

See {@link #updateUnitCostWithHttpInfo}. + * + * @param unitCostId The UUID of the unit cost. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<UnitCostResponse>> + */ + public CompletableFuture> updateUnitCostWithHttpInfoAsync( + UUID unitCostId, UnitCostUpdateRequest body) { + // Check if unstable operation is enabled + String operationId = "updateUnitCost"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'unitCostId' is set + if (unitCostId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'unitCostId' when calling updateUnitCost")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling updateUnitCost")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/cost/unit_costs/{unit_cost_id}" + .replaceAll( + "\\{" + "unit_cost_id" + "\\}", apiClient.escapeString(unitCostId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.updateUnitCost", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PUT", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Upload Custom Costs file. * diff --git a/src/main/java/com/datadog/api/client/v2/model/UnitCostCreateRequest.java b/src/main/java/com/datadog/api/client/v2/model/UnitCostCreateRequest.java new file mode 100644 index 00000000000..82e18a35dfe --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UnitCostCreateRequest.java @@ -0,0 +1,148 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A request to create a unit cost. */ +@JsonPropertyOrder({UnitCostCreateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UnitCostCreateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private UnitCostCreateRequestData data; + + public UnitCostCreateRequest() {} + + @JsonCreator + public UnitCostCreateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) UnitCostCreateRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public UnitCostCreateRequest data(UnitCostCreateRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The data object of a unit cost create request. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UnitCostCreateRequestData getData() { + return data; + } + + public void setData(UnitCostCreateRequestData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * 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 UnitCostCreateRequest + */ + @JsonAnySetter + public UnitCostCreateRequest 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 UnitCostCreateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitCostCreateRequest unitCostCreateRequest = (UnitCostCreateRequest) o; + return Objects.equals(this.data, unitCostCreateRequest.data) + && Objects.equals(this.additionalProperties, unitCostCreateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitCostCreateRequest {\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/UnitCostCreateRequestData.java b/src/main/java/com/datadog/api/client/v2/model/UnitCostCreateRequestData.java new file mode 100644 index 00000000000..90e25bc3a19 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UnitCostCreateRequestData.java @@ -0,0 +1,185 @@ +/* + * 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; + +/** The data object of a unit cost create request. */ +@JsonPropertyOrder({ + UnitCostCreateRequestData.JSON_PROPERTY_ATTRIBUTES, + UnitCostCreateRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UnitCostCreateRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private UnitCostRequestAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private UnitCostType type = UnitCostType.UNIT_COST; + + public UnitCostCreateRequestData() {} + + @JsonCreator + public UnitCostCreateRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + UnitCostRequestAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) UnitCostType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public UnitCostCreateRequestData attributes(UnitCostRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of a unit cost create or replace request. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UnitCostRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(UnitCostRequestAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public UnitCostCreateRequestData type(UnitCostType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The JSON:API resource type for a unit cost. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UnitCostType getType() { + return type; + } + + public void setType(UnitCostType 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 UnitCostCreateRequestData + */ + @JsonAnySetter + public UnitCostCreateRequestData 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 UnitCostCreateRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitCostCreateRequestData unitCostCreateRequestData = (UnitCostCreateRequestData) o; + return Objects.equals(this.attributes, unitCostCreateRequestData.attributes) + && Objects.equals(this.type, unitCostCreateRequestData.type) + && Objects.equals( + this.additionalProperties, unitCostCreateRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitCostCreateRequestData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/UnitCostDataAttributesResponse.java b/src/main/java/com/datadog/api/client/v2/model/UnitCostDataAttributesResponse.java new file mode 100644 index 00000000000..91c2ffd44c6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UnitCostDataAttributesResponse.java @@ -0,0 +1,464 @@ +/* + * 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.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +/** The attributes of a unit cost. */ +@JsonPropertyOrder({ + UnitCostDataAttributesResponse.JSON_PROPERTY_CREATED_AT, + UnitCostDataAttributesResponse.JSON_PROPERTY_CREATED_BY, + UnitCostDataAttributesResponse.JSON_PROPERTY_DENOMINATOR_QUERY, + UnitCostDataAttributesResponse.JSON_PROPERTY_DENOMINATOR_TYPE, + UnitCostDataAttributesResponse.JSON_PROPERTY_DESCRIPTION, + UnitCostDataAttributesResponse.JSON_PROPERTY_NAME, + UnitCostDataAttributesResponse.JSON_PROPERTY_NUMERATOR_QUERY, + UnitCostDataAttributesResponse.JSON_PROPERTY_ORG_ID, + UnitCostDataAttributesResponse.JSON_PROPERTY_UNIT_LABEL, + UnitCostDataAttributesResponse.JSON_PROPERTY_UPDATED_AT, + UnitCostDataAttributesResponse.JSON_PROPERTY_UPDATED_BY +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UnitCostDataAttributesResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_CREATED_BY = "created_by"; + private UUID createdBy; + + public static final String JSON_PROPERTY_DENOMINATOR_QUERY = "denominator_query"; + private UnitCostQueryDefinition denominatorQuery; + + public static final String JSON_PROPERTY_DENOMINATOR_TYPE = "denominator_type"; + private String denominatorType; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private JsonNullable description = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_NUMERATOR_QUERY = "numerator_query"; + private UnitCostQueryDefinition numeratorQuery; + + public static final String JSON_PROPERTY_ORG_ID = "org_id"; + private Long orgId; + + public static final String JSON_PROPERTY_UNIT_LABEL = "unit_label"; + private String unitLabel; + + public static final String JSON_PROPERTY_UPDATED_AT = "updated_at"; + private OffsetDateTime updatedAt; + + public static final String JSON_PROPERTY_UPDATED_BY = "updated_by"; + private UUID updatedBy; + + public UnitCostDataAttributesResponse() {} + + @JsonCreator + public UnitCostDataAttributesResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_BY) UUID createdBy, + @JsonProperty(required = true, value = JSON_PROPERTY_DENOMINATOR_QUERY) + UnitCostQueryDefinition denominatorQuery, + @JsonProperty(required = true, value = JSON_PROPERTY_DENOMINATOR_TYPE) String denominatorType, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_NUMERATOR_QUERY) + UnitCostQueryDefinition numeratorQuery, + @JsonProperty(required = true, value = JSON_PROPERTY_ORG_ID) Long orgId, + @JsonProperty(required = true, value = JSON_PROPERTY_UNIT_LABEL) String unitLabel, + @JsonProperty(required = true, value = JSON_PROPERTY_UPDATED_AT) OffsetDateTime updatedAt, + @JsonProperty(required = true, value = JSON_PROPERTY_UPDATED_BY) UUID updatedBy) { + this.createdAt = createdAt; + this.createdBy = createdBy; + this.denominatorQuery = denominatorQuery; + this.unparsed |= denominatorQuery.unparsed; + this.denominatorType = denominatorType; + this.name = name; + this.numeratorQuery = numeratorQuery; + this.unparsed |= numeratorQuery.unparsed; + this.orgId = orgId; + this.unitLabel = unitLabel; + this.updatedAt = updatedAt; + this.updatedBy = updatedBy; + } + + public UnitCostDataAttributesResponse createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The time the unit cost was created. + * + * @return createdAt + */ + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public UnitCostDataAttributesResponse createdBy(UUID createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * The UUID of the user who created the unit cost. + * + * @return createdBy + */ + @JsonProperty(JSON_PROPERTY_CREATED_BY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(UUID createdBy) { + this.createdBy = createdBy; + } + + public UnitCostDataAttributesResponse denominatorQuery(UnitCostQueryDefinition denominatorQuery) { + this.denominatorQuery = denominatorQuery; + this.unparsed |= denominatorQuery.unparsed; + return this; + } + + /** + * A timeseries object containing queries and formulas arrays. + * + * @return denominatorQuery + */ + @JsonProperty(JSON_PROPERTY_DENOMINATOR_QUERY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UnitCostQueryDefinition getDenominatorQuery() { + return denominatorQuery; + } + + public void setDenominatorQuery(UnitCostQueryDefinition denominatorQuery) { + this.denominatorQuery = denominatorQuery; + if (denominatorQuery != null) { + this.unparsed |= denominatorQuery.unparsed; + } + } + + public UnitCostDataAttributesResponse denominatorType(String denominatorType) { + this.denominatorType = denominatorType; + return this; + } + + /** + * The data source of the denominator queries, or multisource when the denominator + * queries span more than one data source. + * + * @return denominatorType + */ + @JsonProperty(JSON_PROPERTY_DENOMINATOR_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDenominatorType() { + return denominatorType; + } + + public void setDenominatorType(String denominatorType) { + this.denominatorType = denominatorType; + } + + public UnitCostDataAttributesResponse description(String description) { + this.description = JsonNullable.of(description); + return this; + } + + /** + * The description of the unit cost. Omitted when the unit cost has no description. + * + * @return description + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getDescription() { + return description.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getDescription_JsonNullable() { + return description; + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + public void setDescription_JsonNullable(JsonNullable description) { + this.description = description; + } + + public void setDescription(String description) { + this.description = JsonNullable.of(description); + } + + public UnitCostDataAttributesResponse name(String name) { + this.name = name; + return this; + } + + /** + * The name of the unit cost. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public UnitCostDataAttributesResponse numeratorQuery(UnitCostQueryDefinition numeratorQuery) { + this.numeratorQuery = numeratorQuery; + this.unparsed |= numeratorQuery.unparsed; + return this; + } + + /** + * A timeseries object containing queries and formulas arrays. + * + * @return numeratorQuery + */ + @JsonProperty(JSON_PROPERTY_NUMERATOR_QUERY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UnitCostQueryDefinition getNumeratorQuery() { + return numeratorQuery; + } + + public void setNumeratorQuery(UnitCostQueryDefinition numeratorQuery) { + this.numeratorQuery = numeratorQuery; + if (numeratorQuery != null) { + this.unparsed |= numeratorQuery.unparsed; + } + } + + public UnitCostDataAttributesResponse orgId(Long orgId) { + this.orgId = orgId; + return this; + } + + /** + * The ID of the organization the unit cost belongs to. + * + * @return orgId + */ + @JsonProperty(JSON_PROPERTY_ORG_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getOrgId() { + return orgId; + } + + public void setOrgId(Long orgId) { + this.orgId = orgId; + } + + public UnitCostDataAttributesResponse unitLabel(String unitLabel) { + this.unitLabel = unitLabel; + return this; + } + + /** + * The label describing the denominator unit. + * + * @return unitLabel + */ + @JsonProperty(JSON_PROPERTY_UNIT_LABEL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getUnitLabel() { + return unitLabel; + } + + public void setUnitLabel(String unitLabel) { + this.unitLabel = unitLabel; + } + + public UnitCostDataAttributesResponse updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * The time the unit cost was last updated. + * + * @return updatedAt + */ + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + public UnitCostDataAttributesResponse updatedBy(UUID updatedBy) { + this.updatedBy = updatedBy; + return this; + } + + /** + * The UUID of the user who last updated the unit cost. + * + * @return updatedBy + */ + @JsonProperty(JSON_PROPERTY_UPDATED_BY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(UUID 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 UnitCostDataAttributesResponse + */ + @JsonAnySetter + public UnitCostDataAttributesResponse 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 UnitCostDataAttributesResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitCostDataAttributesResponse unitCostDataAttributesResponse = + (UnitCostDataAttributesResponse) o; + return Objects.equals(this.createdAt, unitCostDataAttributesResponse.createdAt) + && Objects.equals(this.createdBy, unitCostDataAttributesResponse.createdBy) + && Objects.equals(this.denominatorQuery, unitCostDataAttributesResponse.denominatorQuery) + && Objects.equals(this.denominatorType, unitCostDataAttributesResponse.denominatorType) + && Objects.equals(this.description, unitCostDataAttributesResponse.description) + && Objects.equals(this.name, unitCostDataAttributesResponse.name) + && Objects.equals(this.numeratorQuery, unitCostDataAttributesResponse.numeratorQuery) + && Objects.equals(this.orgId, unitCostDataAttributesResponse.orgId) + && Objects.equals(this.unitLabel, unitCostDataAttributesResponse.unitLabel) + && Objects.equals(this.updatedAt, unitCostDataAttributesResponse.updatedAt) + && Objects.equals(this.updatedBy, unitCostDataAttributesResponse.updatedBy) + && Objects.equals( + this.additionalProperties, unitCostDataAttributesResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + createdBy, + denominatorQuery, + denominatorType, + description, + name, + numeratorQuery, + orgId, + unitLabel, + updatedAt, + updatedBy, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitCostDataAttributesResponse {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); + sb.append(" denominatorQuery: ").append(toIndentedString(denominatorQuery)).append("\n"); + sb.append(" denominatorType: ").append(toIndentedString(denominatorType)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" numeratorQuery: ").append(toIndentedString(numeratorQuery)).append("\n"); + sb.append(" orgId: ").append(toIndentedString(orgId)).append("\n"); + sb.append(" unitLabel: ").append(toIndentedString(unitLabel)).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/UnitCostDataResponse.java b/src/main/java/com/datadog/api/client/v2/model/UnitCostDataResponse.java new file mode 100644 index 00000000000..0566d5f8b6a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UnitCostDataResponse.java @@ -0,0 +1,213 @@ +/* + * 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; +import java.util.UUID; + +/** The data object of a unit cost response. */ +@JsonPropertyOrder({ + UnitCostDataResponse.JSON_PROPERTY_ATTRIBUTES, + UnitCostDataResponse.JSON_PROPERTY_ID, + UnitCostDataResponse.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UnitCostDataResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private UnitCostDataAttributesResponse attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private UnitCostType type = UnitCostType.UNIT_COST; + + public UnitCostDataResponse() {} + + @JsonCreator + public UnitCostDataResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + UnitCostDataAttributesResponse attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) UnitCostType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public UnitCostDataResponse attributes(UnitCostDataAttributesResponse attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of a unit cost. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UnitCostDataAttributesResponse getAttributes() { + return attributes; + } + + public void setAttributes(UnitCostDataAttributesResponse attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public UnitCostDataResponse id(UUID id) { + this.id = id; + return this; + } + + /** + * The UUID of the unit cost. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public UnitCostDataResponse type(UnitCostType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The JSON:API resource type for a unit cost. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UnitCostType getType() { + return type; + } + + public void setType(UnitCostType 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 UnitCostDataResponse + */ + @JsonAnySetter + public UnitCostDataResponse 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 UnitCostDataResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitCostDataResponse unitCostDataResponse = (UnitCostDataResponse) o; + return Objects.equals(this.attributes, unitCostDataResponse.attributes) + && Objects.equals(this.id, unitCostDataResponse.id) + && Objects.equals(this.type, unitCostDataResponse.type) + && Objects.equals(this.additionalProperties, unitCostDataResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitCostDataResponse {\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/UnitCostQueryDefinition.java b/src/main/java/com/datadog/api/client/v2/model/UnitCostQueryDefinition.java new file mode 100644 index 00000000000..929d7ce559c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UnitCostQueryDefinition.java @@ -0,0 +1,187 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** A timeseries object containing queries and formulas arrays. */ +@JsonPropertyOrder({ + UnitCostQueryDefinition.JSON_PROPERTY_FORMULAS, + UnitCostQueryDefinition.JSON_PROPERTY_QUERIES +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UnitCostQueryDefinition { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_FORMULAS = "formulas"; + private List> formulas = new ArrayList<>(); + + public static final String JSON_PROPERTY_QUERIES = "queries"; + private List> queries = new ArrayList<>(); + + public UnitCostQueryDefinition() {} + + @JsonCreator + public UnitCostQueryDefinition( + @JsonProperty(required = true, value = JSON_PROPERTY_FORMULAS) + List> formulas, + @JsonProperty(required = true, value = JSON_PROPERTY_QUERIES) + List> queries) { + this.formulas = formulas; + this.queries = queries; + } + + public UnitCostQueryDefinition formulas(List> formulas) { + this.formulas = formulas; + return this; + } + + public UnitCostQueryDefinition addFormulasItem(Map formulasItem) { + this.formulas.add(formulasItem); + return this; + } + + /** + * The list of formulas applied to the queries for this side of the ratio. + * + * @return formulas + */ + @JsonProperty(JSON_PROPERTY_FORMULAS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List> getFormulas() { + return formulas; + } + + public void setFormulas(List> formulas) { + this.formulas = formulas; + } + + public UnitCostQueryDefinition queries(List> queries) { + this.queries = queries; + return this; + } + + public UnitCostQueryDefinition addQueriesItem(Map queriesItem) { + this.queries.add(queriesItem); + return this; + } + + /** + * The list of queries evaluated for this side of the ratio. + * + * @return queries + */ + @JsonProperty(JSON_PROPERTY_QUERIES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List> getQueries() { + return queries; + } + + public void setQueries(List> queries) { + this.queries = queries; + } + + /** + * 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 UnitCostQueryDefinition + */ + @JsonAnySetter + public UnitCostQueryDefinition 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 UnitCostQueryDefinition object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitCostQueryDefinition unitCostQueryDefinition = (UnitCostQueryDefinition) o; + return Objects.equals(this.formulas, unitCostQueryDefinition.formulas) + && Objects.equals(this.queries, unitCostQueryDefinition.queries) + && Objects.equals(this.additionalProperties, unitCostQueryDefinition.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(formulas, queries, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitCostQueryDefinition {\n"); + sb.append(" formulas: ").append(toIndentedString(formulas)).append("\n"); + sb.append(" queries: ").append(toIndentedString(queries)).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/UnitCostRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/UnitCostRequestAttributes.java new file mode 100644 index 00000000000..6dd52cb6e68 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UnitCostRequestAttributes.java @@ -0,0 +1,282 @@ +/* + * 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; +import org.openapitools.jackson.nullable.JsonNullable; + +/** The attributes of a unit cost create or replace request. */ +@JsonPropertyOrder({ + UnitCostRequestAttributes.JSON_PROPERTY_DENOMINATOR_QUERY, + UnitCostRequestAttributes.JSON_PROPERTY_DESCRIPTION, + UnitCostRequestAttributes.JSON_PROPERTY_NAME, + UnitCostRequestAttributes.JSON_PROPERTY_NUMERATOR_QUERY, + UnitCostRequestAttributes.JSON_PROPERTY_UNIT_LABEL +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UnitCostRequestAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DENOMINATOR_QUERY = "denominator_query"; + private UnitCostQueryDefinition denominatorQuery; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private JsonNullable description = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_NUMERATOR_QUERY = "numerator_query"; + private UnitCostQueryDefinition numeratorQuery; + + public static final String JSON_PROPERTY_UNIT_LABEL = "unit_label"; + private String unitLabel; + + public UnitCostRequestAttributes() {} + + @JsonCreator + public UnitCostRequestAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_DENOMINATOR_QUERY) + UnitCostQueryDefinition denominatorQuery, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_NUMERATOR_QUERY) + UnitCostQueryDefinition numeratorQuery, + @JsonProperty(required = true, value = JSON_PROPERTY_UNIT_LABEL) String unitLabel) { + this.denominatorQuery = denominatorQuery; + this.unparsed |= denominatorQuery.unparsed; + this.name = name; + this.numeratorQuery = numeratorQuery; + this.unparsed |= numeratorQuery.unparsed; + this.unitLabel = unitLabel; + } + + public UnitCostRequestAttributes denominatorQuery(UnitCostQueryDefinition denominatorQuery) { + this.denominatorQuery = denominatorQuery; + this.unparsed |= denominatorQuery.unparsed; + return this; + } + + /** + * A timeseries object containing queries and formulas arrays. + * + * @return denominatorQuery + */ + @JsonProperty(JSON_PROPERTY_DENOMINATOR_QUERY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UnitCostQueryDefinition getDenominatorQuery() { + return denominatorQuery; + } + + public void setDenominatorQuery(UnitCostQueryDefinition denominatorQuery) { + this.denominatorQuery = denominatorQuery; + if (denominatorQuery != null) { + this.unparsed |= denominatorQuery.unparsed; + } + } + + public UnitCostRequestAttributes description(String description) { + this.description = JsonNullable.of(description); + return this; + } + + /** + * An optional description of the unit cost. At most 2000 characters. + * + * @return description + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getDescription() { + return description.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getDescription_JsonNullable() { + return description; + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + public void setDescription_JsonNullable(JsonNullable description) { + this.description = description; + } + + public void setDescription(String description) { + this.description = JsonNullable.of(description); + } + + public UnitCostRequestAttributes name(String name) { + this.name = name; + return this; + } + + /** + * The name of the unit cost. At most 200 characters. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public UnitCostRequestAttributes numeratorQuery(UnitCostQueryDefinition numeratorQuery) { + this.numeratorQuery = numeratorQuery; + this.unparsed |= numeratorQuery.unparsed; + return this; + } + + /** + * A timeseries object containing queries and formulas arrays. + * + * @return numeratorQuery + */ + @JsonProperty(JSON_PROPERTY_NUMERATOR_QUERY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UnitCostQueryDefinition getNumeratorQuery() { + return numeratorQuery; + } + + public void setNumeratorQuery(UnitCostQueryDefinition numeratorQuery) { + this.numeratorQuery = numeratorQuery; + if (numeratorQuery != null) { + this.unparsed |= numeratorQuery.unparsed; + } + } + + public UnitCostRequestAttributes unitLabel(String unitLabel) { + this.unitLabel = unitLabel; + return this; + } + + /** + * The label describing the denominator unit, for example user. At most 100 + * characters. + * + * @return unitLabel + */ + @JsonProperty(JSON_PROPERTY_UNIT_LABEL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getUnitLabel() { + return unitLabel; + } + + public void setUnitLabel(String unitLabel) { + this.unitLabel = unitLabel; + } + + /** + * 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 UnitCostRequestAttributes + */ + @JsonAnySetter + public UnitCostRequestAttributes 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 UnitCostRequestAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitCostRequestAttributes unitCostRequestAttributes = (UnitCostRequestAttributes) o; + return Objects.equals(this.denominatorQuery, unitCostRequestAttributes.denominatorQuery) + && Objects.equals(this.description, unitCostRequestAttributes.description) + && Objects.equals(this.name, unitCostRequestAttributes.name) + && Objects.equals(this.numeratorQuery, unitCostRequestAttributes.numeratorQuery) + && Objects.equals(this.unitLabel, unitCostRequestAttributes.unitLabel) + && Objects.equals( + this.additionalProperties, unitCostRequestAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + denominatorQuery, description, name, numeratorQuery, unitLabel, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitCostRequestAttributes {\n"); + sb.append(" denominatorQuery: ").append(toIndentedString(denominatorQuery)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" numeratorQuery: ").append(toIndentedString(numeratorQuery)).append("\n"); + sb.append(" unitLabel: ").append(toIndentedString(unitLabel)).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/UnitCostResponse.java b/src/main/java/com/datadog/api/client/v2/model/UnitCostResponse.java new file mode 100644 index 00000000000..30848b4705e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UnitCostResponse.java @@ -0,0 +1,148 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A response containing a single unit cost. */ +@JsonPropertyOrder({UnitCostResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UnitCostResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private UnitCostDataResponse data; + + public UnitCostResponse() {} + + @JsonCreator + public UnitCostResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) UnitCostDataResponse data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public UnitCostResponse data(UnitCostDataResponse data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The data object of a unit cost response. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UnitCostDataResponse getData() { + return data; + } + + public void setData(UnitCostDataResponse data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * 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 UnitCostResponse + */ + @JsonAnySetter + public UnitCostResponse 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 UnitCostResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitCostResponse unitCostResponse = (UnitCostResponse) o; + return Objects.equals(this.data, unitCostResponse.data) + && Objects.equals(this.additionalProperties, unitCostResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitCostResponse {\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/UnitCostType.java b/src/main/java/com/datadog/api/client/v2/model/UnitCostType.java new file mode 100644 index 00000000000..8f989f7f402 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UnitCostType.java @@ -0,0 +1,53 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The JSON:API resource type for a unit cost. */ +@JsonSerialize(using = UnitCostType.UnitCostTypeSerializer.class) +public class UnitCostType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("unit_cost")); + + public static final UnitCostType UNIT_COST = new UnitCostType("unit_cost"); + + UnitCostType(String value) { + super(value, allowedValues); + } + + public static class UnitCostTypeSerializer extends StdSerializer { + public UnitCostTypeSerializer(Class t) { + super(t); + } + + public UnitCostTypeSerializer() { + this(null); + } + + @Override + public void serialize(UnitCostType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static UnitCostType fromValue(String value) { + return new UnitCostType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/UnitCostUpdateRequest.java b/src/main/java/com/datadog/api/client/v2/model/UnitCostUpdateRequest.java new file mode 100644 index 00000000000..242ae2fa0f8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UnitCostUpdateRequest.java @@ -0,0 +1,148 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A request to replace a unit cost. */ +@JsonPropertyOrder({UnitCostUpdateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UnitCostUpdateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private UnitCostUpdateRequestData data; + + public UnitCostUpdateRequest() {} + + @JsonCreator + public UnitCostUpdateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) UnitCostUpdateRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public UnitCostUpdateRequest data(UnitCostUpdateRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The data object of a unit cost replace request. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UnitCostUpdateRequestData getData() { + return data; + } + + public void setData(UnitCostUpdateRequestData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * 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 UnitCostUpdateRequest + */ + @JsonAnySetter + public UnitCostUpdateRequest 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 UnitCostUpdateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitCostUpdateRequest unitCostUpdateRequest = (UnitCostUpdateRequest) o; + return Objects.equals(this.data, unitCostUpdateRequest.data) + && Objects.equals(this.additionalProperties, unitCostUpdateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitCostUpdateRequest {\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/UnitCostUpdateRequestData.java b/src/main/java/com/datadog/api/client/v2/model/UnitCostUpdateRequestData.java new file mode 100644 index 00000000000..6acf61132e8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UnitCostUpdateRequestData.java @@ -0,0 +1,215 @@ +/* + * 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; +import java.util.UUID; + +/** The data object of a unit cost replace request. */ +@JsonPropertyOrder({ + UnitCostUpdateRequestData.JSON_PROPERTY_ATTRIBUTES, + UnitCostUpdateRequestData.JSON_PROPERTY_ID, + UnitCostUpdateRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UnitCostUpdateRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private UnitCostRequestAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private UnitCostType type = UnitCostType.UNIT_COST; + + public UnitCostUpdateRequestData() {} + + @JsonCreator + public UnitCostUpdateRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + UnitCostRequestAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) UnitCostType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public UnitCostUpdateRequestData attributes(UnitCostRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of a unit cost create or replace request. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UnitCostRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(UnitCostRequestAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public UnitCostUpdateRequestData id(UUID id) { + this.id = id; + return this; + } + + /** + * The UUID of the unit cost being replaced. Must match the unit_cost_id path + * parameter. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public UnitCostUpdateRequestData type(UnitCostType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The JSON:API resource type for a unit cost. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UnitCostType getType() { + return type; + } + + public void setType(UnitCostType 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 UnitCostUpdateRequestData + */ + @JsonAnySetter + public UnitCostUpdateRequestData 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 UnitCostUpdateRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitCostUpdateRequestData unitCostUpdateRequestData = (UnitCostUpdateRequestData) o; + return Objects.equals(this.attributes, unitCostUpdateRequestData.attributes) + && Objects.equals(this.id, unitCostUpdateRequestData.id) + && Objects.equals(this.type, unitCostUpdateRequestData.type) + && Objects.equals( + this.additionalProperties, unitCostUpdateRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitCostUpdateRequestData {\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/UnitCostsResponse.java b/src/main/java/com/datadog/api/client/v2/model/UnitCostsResponse.java new file mode 100644 index 00000000000..1bcc6ee58ba --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UnitCostsResponse.java @@ -0,0 +1,162 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** A response containing a list of unit costs. */ +@JsonPropertyOrder({UnitCostsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UnitCostsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public UnitCostsResponse() {} + + @JsonCreator + public UnitCostsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) List data) { + this.data = data; + for (UnitCostDataResponse item : data) { + this.unparsed |= item.unparsed; + } + } + + public UnitCostsResponse data(List data) { + this.data = data; + for (UnitCostDataResponse item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public UnitCostsResponse addDataItem(UnitCostDataResponse dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * The list of unit costs. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + if (data != null) { + for (UnitCostDataResponse item : data) { + this.unparsed |= item.unparsed; + } + } + } + + /** + * 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 UnitCostsResponse + */ + @JsonAnySetter + public UnitCostsResponse 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 UnitCostsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitCostsResponse unitCostsResponse = (UnitCostsResponse) o; + return Objects.equals(this.data, unitCostsResponse.data) + && Objects.equals(this.additionalProperties, unitCostsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitCostsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/cloud_cost_management.feature b/src/test/resources/com/datadog/api/client/v2/api/cloud_cost_management.feature index 57849f54f3c..5ee6a17dce0 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 @@ -58,6 +58,22 @@ Feature: Cloud Cost Management Then the response status is 200 OK And the response "data.attributes.account_id" is equal to "123456_A123BC_12AB34" + @generated @skip @team:DataDog/ccm-roi + Scenario: Create a unit cost returns "Bad Request" response + Given operation "CreateUnitCost" enabled + And new "CreateUnitCost" request + And body with value {"data": {"attributes": {"denominator_query": {"formulas": [{"formula": "numerator"}], "queries": [{"data_source": "cloud_cost", "name": "numerator", "query": "sum:aws.cost.net.amortized.shared.resources.allocated{*}.rollup(sum, daily)"}]}, "description": "Amortized cloud spend divided by the number of active users.", "name": "Cloud cost per active user", "numerator_query": {"formulas": [{"formula": "numerator"}], "queries": [{"data_source": "cloud_cost", "name": "numerator", "query": "sum:aws.cost.net.amortized.shared.resources.allocated{*}.rollup(sum, daily)"}]}, "unit_label": "user"}, "type": "unit_cost"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/ccm-roi + Scenario: Create a unit cost returns "Created" response + Given operation "CreateUnitCost" enabled + And new "CreateUnitCost" request + And body with value {"data": {"attributes": {"denominator_query": {"formulas": [{"formula": "numerator"}], "queries": [{"data_source": "cloud_cost", "name": "numerator", "query": "sum:aws.cost.net.amortized.shared.resources.allocated{*}.rollup(sum, daily)"}]}, "description": "Amortized cloud spend divided by the number of active users.", "name": "Cloud cost per active user", "numerator_query": {"formulas": [{"formula": "numerator"}], "queries": [{"data_source": "cloud_cost", "name": "numerator", "query": "sum:aws.cost.net.amortized.shared.resources.allocated{*}.rollup(sum, daily)"}]}, "unit_label": "user"}, "type": "unit_cost"}} + When the request is sent + Then the response status is 201 Created + @replay-only @team:DataDog/cloud-cost-management Scenario: Create custom allocation rule returns "OK" response Given new "CreateCustomAllocationRule" request @@ -253,6 +269,30 @@ Feature: Cloud Cost Management When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/ccm-roi + Scenario: Delete a unit cost returns "Bad Request" response + Given operation "DeleteUnitCost" enabled + And new "DeleteUnitCost" request + And request contains "unit_cost_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/ccm-roi + Scenario: Delete a unit cost returns "No Content" response + Given operation "DeleteUnitCost" enabled + And new "DeleteUnitCost" request + And request contains "unit_cost_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/ccm-roi + Scenario: Delete a unit cost returns "Not Found" response + Given operation "DeleteUnitCost" enabled + And new "DeleteUnitCost" request + And request contains "unit_cost_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: Delete budget returns "No Content" response Given new "DeleteBudget" request @@ -399,6 +439,30 @@ Feature: Cloud Cost Management And the response "data.type" is equal to "ruleset" And the response "data.attributes.name" is equal to "EVP Cost Tags" + @generated @skip @team:DataDog/ccm-roi + Scenario: Get a unit cost returns "Bad Request" response + Given operation "GetUnitCost" enabled + And new "GetUnitCost" request + And request contains "unit_cost_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/ccm-roi + Scenario: Get a unit cost returns "Not Found" response + Given operation "GetUnitCost" enabled + And new "GetUnitCost" request + And request contains "unit_cost_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/ccm-roi + Scenario: Get a unit cost returns "OK" response + Given operation "GetUnitCost" enabled + And new "GetUnitCost" request + And request contains "unit_cost_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/cloud-cost-management Scenario: Get account filters returns "Bad Request" response Given new "GetCostAccountFilters" request @@ -885,6 +949,13 @@ Feature: Cloud Cost Management Then the response status is 200 OK And the response "data[0].attributes.name" is equal to "New Ruleset" + @generated @skip @team:DataDog/ccm-roi + Scenario: List unit costs returns "OK" response + Given operation "ListUnitCosts" enabled + And new "ListUnitCosts" request + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/cloud-cost-management Scenario: Reorder custom allocation rules returns "Successfully reordered rules" response Given new "ReorderCustomAllocationRules" request @@ -974,6 +1045,33 @@ Feature: Cloud Cost Management Then the response status is 200 OK And the response "data.attributes.account_id" is equal to "123456_A123BC_12AB34" + @generated @skip @team:DataDog/ccm-roi + Scenario: Update a unit cost returns "Bad Request" response + Given operation "UpdateUnitCost" enabled + And new "UpdateUnitCost" request + And request contains "unit_cost_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"denominator_query": {"formulas": [{"formula": "numerator"}], "queries": [{"data_source": "cloud_cost", "name": "numerator", "query": "sum:aws.cost.net.amortized.shared.resources.allocated{*}.rollup(sum, daily)"}]}, "description": "Amortized cloud spend divided by the number of active users.", "name": "Cloud cost per active user", "numerator_query": {"formulas": [{"formula": "numerator"}], "queries": [{"data_source": "cloud_cost", "name": "numerator", "query": "sum:aws.cost.net.amortized.shared.resources.allocated{*}.rollup(sum, daily)"}]}, "unit_label": "user"}, "id": "64aecd58-e355-4f07-9c3a-56ff6bda6cd8", "type": "unit_cost"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/ccm-roi + Scenario: Update a unit cost returns "Not Found" response + Given operation "UpdateUnitCost" enabled + And new "UpdateUnitCost" request + And request contains "unit_cost_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"denominator_query": {"formulas": [{"formula": "numerator"}], "queries": [{"data_source": "cloud_cost", "name": "numerator", "query": "sum:aws.cost.net.amortized.shared.resources.allocated{*}.rollup(sum, daily)"}]}, "description": "Amortized cloud spend divided by the number of active users.", "name": "Cloud cost per active user", "numerator_query": {"formulas": [{"formula": "numerator"}], "queries": [{"data_source": "cloud_cost", "name": "numerator", "query": "sum:aws.cost.net.amortized.shared.resources.allocated{*}.rollup(sum, daily)"}]}, "unit_label": "user"}, "id": "64aecd58-e355-4f07-9c3a-56ff6bda6cd8", "type": "unit_cost"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/ccm-roi + Scenario: Update a unit cost returns "OK" response + Given operation "UpdateUnitCost" enabled + And new "UpdateUnitCost" request + And request contains "unit_cost_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"denominator_query": {"formulas": [{"formula": "numerator"}], "queries": [{"data_source": "cloud_cost", "name": "numerator", "query": "sum:aws.cost.net.amortized.shared.resources.allocated{*}.rollup(sum, daily)"}]}, "description": "Amortized cloud spend divided by the number of active users.", "name": "Cloud cost per active user", "numerator_query": {"formulas": [{"formula": "numerator"}], "queries": [{"data_source": "cloud_cost", "name": "numerator", "query": "sum:aws.cost.net.amortized.shared.resources.allocated{*}.rollup(sum, daily)"}]}, "unit_label": "user"}, "id": "64aecd58-e355-4f07-9c3a-56ff6bda6cd8", "type": "unit_cost"}} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/cloud-cost-management Scenario: Update account filters returns "Bad Request" response Given new "UpdateCostAccountFilters" 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 383d0fec6e5..8de1ce2b9fe 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 @@ -1988,6 +1988,43 @@ "type": "safe" } }, + "ListUnitCosts": { + "tag": "Cloud Cost Management", + "undo": { + "type": "safe" + } + }, + "CreateUnitCost": { + "tag": "Cloud Cost Management", + "undo": { + "operationId": "DeleteUnitCost", + "parameters": [ + { + "name": "unit_cost_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteUnitCost": { + "tag": "Cloud Cost Management", + "undo": { + "type": "idempotent" + } + }, + "GetUnitCost": { + "tag": "Cloud Cost Management", + "undo": { + "type": "safe" + } + }, + "UpdateUnitCost": { + "tag": "Cloud Cost Management", + "undo": { + "type": "idempotent" + } + }, "GetActiveBillingDimensions": { "tag": "Usage Metering", "undo": {