diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 682c9d1e9b3d..631f1503fb67 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -2122,6 +2122,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 @@ -120429,6 +120438,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: @@ -143018,6 +143257,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/features/v2/cloud_cost_management.feature b/features/v2/cloud_cost_management.feature index 57849f54f3c7..5ee6a17dce0d 100644 --- a/features/v2/cloud_cost_management.feature +++ b/features/v2/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/features/v2/undo.json b/features/v2/undo.json index 960023eb2f2d..8f5702224e2e 100644 --- a/features/v2/undo.json +++ b/features/v2/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": { diff --git a/private/bdd_runner/src/support/scenarios_model_mapping.ts b/private/bdd_runner/src/support/scenarios_model_mapping.ts index c8309858376d..a4e57c2427f4 100644 --- a/private/bdd_runner/src/support/scenarios_model_mapping.ts +++ b/private/bdd_runner/src/support/scenarios_model_mapping.ts @@ -8499,6 +8499,41 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = { }, operationResponseType: "CostTagsResponse", }, + "CloudCostManagementApi.V2.ListUnitCosts": { + operationResponseType: "UnitCostsResponse", + }, + "CloudCostManagementApi.V2.CreateUnitCost": { + body: { + type: "UnitCostCreateRequest", + format: "", + }, + operationResponseType: "UnitCostResponse", + }, + "CloudCostManagementApi.V2.GetUnitCost": { + unitCostId: { + type: "string", + format: "uuid", + }, + operationResponseType: "UnitCostResponse", + }, + "CloudCostManagementApi.V2.UpdateUnitCost": { + unitCostId: { + type: "string", + format: "uuid", + }, + body: { + type: "UnitCostUpdateRequest", + format: "", + }, + operationResponseType: "UnitCostResponse", + }, + "CloudCostManagementApi.V2.DeleteUnitCost": { + unitCostId: { + type: "string", + format: "uuid", + }, + operationResponseType: "{}", + }, "CloudCostManagementApi.V2.ListTagPipelinesRulesets": { operationResponseType: "RulesetRespArray", }, diff --git a/services/cloud_cost_management/src/v2/CloudCostManagementApi.ts b/services/cloud_cost_management/src/v2/CloudCostManagementApi.ts index 291ad0705c61..f8c7c67985b2 100644 --- a/services/cloud_cost_management/src/v2/CloudCostManagementApi.ts +++ b/services/cloud_cost_management/src/v2/CloudCostManagementApi.ts @@ -91,6 +91,10 @@ import { RulesetStatusRespArray } from "./models/RulesetStatusRespArray"; import { RulesValidateQueryRequest } from "./models/RulesValidateQueryRequest"; import { RulesValidateQueryResponse } from "./models/RulesValidateQueryResponse"; import { UCConfigPair } from "./models/UCConfigPair"; +import { UnitCostCreateRequest } from "./models/UnitCostCreateRequest"; +import { UnitCostResponse } from "./models/UnitCostResponse"; +import { UnitCostsResponse } from "./models/UnitCostsResponse"; +import { UnitCostUpdateRequest } from "./models/UnitCostUpdateRequest"; import { UpdateRulesetRequest } from "./models/UpdateRulesetRequest"; import { ValidationResponse } from "./models/ValidationResponse"; import { version } from "../version"; @@ -384,6 +388,69 @@ export class CloudCostManagementApiRequestFactory extends BaseAPIRequestFactory return requestContext; } + public async createUnitCost( + body: UnitCostCreateRequest, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if ( + !_config.unstableOperations["CloudCostManagementApi.v2.createUnitCost"] + ) { + throw new Error( + "Unstable operation 'createUnitCost' is disabled. Enable it by setting `configuration.unstableOperations['CloudCostManagementApi.v2.createUnitCost'] = true`", + ); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "createUnitCost"); + } + + // Path Params + const localVarPath = "/api/v2/cost/unit_costs"; + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "CloudCostManagementApi.v2.createUnitCost", + CloudCostManagementApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.POST, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Set IaC header + if (_config.isIaC) { + requestContext.setHeaderParam("X-Datadog-Managed-By", "iac"); + } + + // Body Params + const contentType = getPreferredMediaType(["application/json"]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = stringify( + serialize(body, TypingInfo, "UnitCostCreateRequest", ""), + contentType, + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + public async deleteBudget( budgetId: string, _options?: Configuration, @@ -846,6 +913,63 @@ export class CloudCostManagementApiRequestFactory extends BaseAPIRequestFactory return requestContext; } + public async deleteUnitCost( + unitCostId: string, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if ( + !_config.unstableOperations["CloudCostManagementApi.v2.deleteUnitCost"] + ) { + throw new Error( + "Unstable operation 'deleteUnitCost' is disabled. Enable it by setting `configuration.unstableOperations['CloudCostManagementApi.v2.deleteUnitCost'] = true`", + ); + } + + // verify required parameter 'unitCostId' is not null or undefined + if (unitCostId === null || unitCostId === undefined) { + throw new RequiredError("unitCostId", "deleteUnitCost"); + } + + // Path Params + const localVarPath = "/api/v2/cost/unit_costs/{unit_cost_id}".replace( + "{unit_cost_id}", + encodeURIComponent(String(unitCostId)), + ); + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "CloudCostManagementApi.v2.deleteUnitCost", + CloudCostManagementApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.DELETE, + overrides, + ); + requestContext.setHeaderParam("Accept", "*/*"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Set IaC header + if (_config.isIaC) { + requestContext.setHeaderParam("X-Datadog-Managed-By", "iac"); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + public async generateCostTagDescriptionByKey( tagKey: string, _options?: Configuration, @@ -2581,6 +2705,61 @@ export class CloudCostManagementApiRequestFactory extends BaseAPIRequestFactory return requestContext; } + public async getUnitCost( + unitCostId: string, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if (!_config.unstableOperations["CloudCostManagementApi.v2.getUnitCost"]) { + throw new Error( + "Unstable operation 'getUnitCost' is disabled. Enable it by setting `configuration.unstableOperations['CloudCostManagementApi.v2.getUnitCost'] = true`", + ); + } + + // verify required parameter 'unitCostId' is not null or undefined + if (unitCostId === null || unitCostId === undefined) { + throw new RequiredError("unitCostId", "getUnitCost"); + } + + // Path Params + const localVarPath = "/api/v2/cost/unit_costs/{unit_cost_id}".replace( + "{unit_cost_id}", + encodeURIComponent(String(unitCostId)), + ); + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "CloudCostManagementApi.v2.getUnitCost", + CloudCostManagementApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.GET, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Set IaC header + if (_config.isIaC) { + requestContext.setHeaderParam("X-Datadog-Managed-By", "iac"); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + public async listBudgets(_options?: Configuration): Promise { const _config = _options || this.configuration; @@ -3767,6 +3946,54 @@ export class CloudCostManagementApiRequestFactory extends BaseAPIRequestFactory return requestContext; } + public async listUnitCosts( + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if ( + !_config.unstableOperations["CloudCostManagementApi.v2.listUnitCosts"] + ) { + throw new Error( + "Unstable operation 'listUnitCosts' is disabled. Enable it by setting `configuration.unstableOperations['CloudCostManagementApi.v2.listUnitCosts'] = true`", + ); + } + + // Path Params + const localVarPath = "/api/v2/cost/unit_costs"; + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "CloudCostManagementApi.v2.listUnitCosts", + CloudCostManagementApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.GET, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Set IaC header + if (_config.isIaC) { + requestContext.setHeaderParam("X-Datadog-Managed-By", "iac"); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + public async reorderCustomAllocationRules( body: ReorderRuleResourceArray, _options?: Configuration, @@ -4357,6 +4584,78 @@ export class CloudCostManagementApiRequestFactory extends BaseAPIRequestFactory return requestContext; } + public async updateUnitCost( + unitCostId: string, + body: UnitCostUpdateRequest, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if ( + !_config.unstableOperations["CloudCostManagementApi.v2.updateUnitCost"] + ) { + throw new Error( + "Unstable operation 'updateUnitCost' is disabled. Enable it by setting `configuration.unstableOperations['CloudCostManagementApi.v2.updateUnitCost'] = true`", + ); + } + + // verify required parameter 'unitCostId' is not null or undefined + if (unitCostId === null || unitCostId === undefined) { + throw new RequiredError("unitCostId", "updateUnitCost"); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "updateUnitCost"); + } + + // Path Params + const localVarPath = "/api/v2/cost/unit_costs/{unit_cost_id}".replace( + "{unit_cost_id}", + encodeURIComponent(String(unitCostId)), + ); + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "CloudCostManagementApi.v2.updateUnitCost", + CloudCostManagementApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.PUT, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Set IaC header + if (_config.isIaC) { + requestContext.setHeaderParam("X-Datadog-Managed-By", "iac"); + } + + // Body Params + const contentType = getPreferredMediaType(["application/json"]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = stringify( + serialize(body, TypingInfo, "UnitCostUpdateRequest", ""), + contentType, + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + public async uploadCustomCostsFile( body: Array, _options?: Configuration, @@ -5031,17 +5330,94 @@ export class CloudCostManagementApiResponseProcessor { * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * - * @params response Response returned by the server for a request to deleteBudget + * @params response Response returned by the server for a request to createUnitCost * @throws ApiException if the response code was not in [200, 299] */ - public async deleteBudget(response: ResponseContext): Promise { + public async createUnitCost( + response: ResponseContext, + ): Promise { const contentType = normalizeMediaType(response.headers["content-type"]); - if (response.httpStatusCode === 204) { - return; + if (response.httpStatusCode === 201) { + const body: UnitCostResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "UnitCostResponse", + ) as UnitCostResponse; + return body; } - if (response.httpStatusCode === 429) { + if (response.httpStatusCode === 400 || response.httpStatusCode === 403) { const bodyText = parse(await response.body.text(), contentType); - let body: APIErrorResponse; + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: UnitCostResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "UnitCostResponse", + "", + ) as UnitCostResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to deleteBudget + * @throws ApiException if the response code was not in [200, 299] + */ + public async deleteBudget(response: ResponseContext): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 204) { + return; + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; try { body = deserialize( bodyText, @@ -5450,6 +5826,74 @@ export class CloudCostManagementApiResponseProcessor { ); } + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to deleteUnitCost + * @throws ApiException if the response code was not in [200, 299] + */ + public async deleteUnitCost(response: ResponseContext): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 204) { + return; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects @@ -6890,6 +7334,87 @@ export class CloudCostManagementApiResponseProcessor { ); } + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getUnitCost + * @throws ApiException if the response code was not in [200, 299] + */ + public async getUnitCost( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: UnitCostResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "UnitCostResponse", + ) as UnitCostResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: UnitCostResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "UnitCostResponse", + "", + ) as UnitCostResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects @@ -7988,6 +8513,83 @@ export class CloudCostManagementApiResponseProcessor { ); } + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to listUnitCosts + * @throws ApiException if the response code was not in [200, 299] + */ + public async listUnitCosts( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: UnitCostsResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "UnitCostsResponse", + ) as UnitCostsResponse; + return body; + } + if (response.httpStatusCode === 403) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: UnitCostsResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "UnitCostsResponse", + "", + ) as UnitCostsResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects @@ -8489,6 +9091,87 @@ export class CloudCostManagementApiResponseProcessor { ); } + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to updateUnitCost + * @throws ApiException if the response code was not in [200, 299] + */ + public async updateUnitCost( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: UnitCostResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "UnitCostResponse", + ) as UnitCostResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: UnitCostResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "UnitCostResponse", + "", + ) as UnitCostResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects @@ -8922,6 +9605,13 @@ export interface CloudCostManagementApiCreateTagPipelinesRulesetRequest { body: CreateRulesetRequest; } +export interface CloudCostManagementApiCreateUnitCostRequest { + /** + * @type UnitCostCreateRequest + */ + body: UnitCostCreateRequest; +} + export interface CloudCostManagementApiDeleteBudgetRequest { /** * Budget id. @@ -8999,6 +9689,14 @@ export interface CloudCostManagementApiDeleteTagPipelinesRulesetRequest { rulesetId: string; } +export interface CloudCostManagementApiDeleteUnitCostRequest { + /** + * The UUID of the unit cost. + * @type string + */ + unitCostId: string; +} + export interface CloudCostManagementApiGenerateCostTagDescriptionByKeyRequest { /** * The tag key to generate an AI description for. @@ -9390,6 +10088,14 @@ export interface CloudCostManagementApiGetTagPipelinesRulesetRequest { rulesetId: string; } +export interface CloudCostManagementApiGetUnitCostRequest { + /** + * The UUID of the unit cost. + * @type string + */ + unitCostId: string; +} + export interface CloudCostManagementApiListCostAnomaliesRequest { /** * Start time as Unix milliseconds. Defaults to the start of the latest stable seven-day window. @@ -9716,6 +10422,18 @@ export interface CloudCostManagementApiUpdateTagPipelinesRulesetRequest { body: UpdateRulesetRequest; } +export interface CloudCostManagementApiUpdateUnitCostRequest { + /** + * The UUID of the unit cost. + * @type string + */ + unitCostId: string; + /** + * @type UnitCostUpdateRequest + */ + body: UnitCostUpdateRequest; +} + export interface CloudCostManagementApiUploadCustomCostsFileRequest { /** * @type Array @@ -9904,6 +10622,27 @@ export class CloudCostManagementApi { }); } + /** + * Create an ROI metric (unit cost) using the given numerator and denominator queries. + * @param param The request object + */ + public createUnitCost( + param: CloudCostManagementApiCreateUnitCostRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.createUnitCost( + param.body, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.createUnitCost(responseContext); + }); + }); + } + /** * Delete a budget * @param param The request object @@ -10104,6 +10843,27 @@ export class CloudCostManagementApi { }); } + /** + * Delete an ROI metric (unit cost). + * @param param The request object + */ + public deleteUnitCost( + param: CloudCostManagementApiDeleteUnitCostRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.deleteUnitCost( + param.unitCostId, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.deleteUnitCost(responseContext); + }); + }); + } + /** * Use AI to draft a Cloud Cost Management tag key description based on associated cost data. The generated description is returned in the response and is not persisted by this endpoint; follow up with `UpsertCostTagDescriptionByKey` to save it. * @param param The request object @@ -10646,6 +11406,27 @@ export class CloudCostManagementApi { }); } + /** + * Retrieve an ROI metric (unit cost) by UUID. + * @param param The request object + */ + public getUnitCost( + param: CloudCostManagementApiGetUnitCostRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.getUnitCost( + param.unitCostId, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.getUnitCost(responseContext); + }); + }); + } + /** * List budgets. * @param param The request object @@ -11064,6 +11845,21 @@ export class CloudCostManagementApi { }); } + /** + * List the ROI metrics (unit costs) for the authenticated organization. + * @param param The request object + */ + public listUnitCosts(options?: Configuration): Promise { + const requestContextPromise = this.requestFactory.listUnitCosts(options); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.listUnitCosts(responseContext); + }); + }); + } + /** * Reorder custom allocation rules - Change the execution order of custom allocation rules. * @@ -11294,6 +12090,28 @@ export class CloudCostManagementApi { }); } + /** + * Replace an ROI metric (unit cost) with a new set of attributes. + * @param param The request object + */ + public updateUnitCost( + param: CloudCostManagementApiUpdateUnitCostRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.updateUnitCost( + param.unitCostId, + param.body, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.updateUnitCost(responseContext); + }); + }); + } + /** * Upload a Custom Costs file. * @param param The request object diff --git a/services/cloud_cost_management/src/v2/index.ts b/services/cloud_cost_management/src/v2/index.ts index 07ce19819b15..5328aeb2876e 100644 --- a/services/cloud_cost_management/src/v2/index.ts +++ b/services/cloud_cost_management/src/v2/index.ts @@ -4,6 +4,7 @@ export { CloudCostManagementApiCreateCostGCPUsageCostConfigRequest, CloudCostManagementApiCreateCustomAllocationRuleRequest, CloudCostManagementApiCreateTagPipelinesRulesetRequest, + CloudCostManagementApiCreateUnitCostRequest, CloudCostManagementApiDeleteBudgetRequest, CloudCostManagementApiDeleteCostAWSCURConfigRequest, CloudCostManagementApiDeleteCostAzureUCConfigRequest, @@ -13,6 +14,7 @@ export { CloudCostManagementApiDeleteCustomCostsFileRequest, CloudCostManagementApiDeleteCustomForecastRequest, CloudCostManagementApiDeleteTagPipelinesRulesetRequest, + CloudCostManagementApiDeleteUnitCostRequest, CloudCostManagementApiGenerateCostTagDescriptionByKeyRequest, CloudCostManagementApiGetBudgetRequest, CloudCostManagementApiGetCommitmentsCommitmentListRequest, @@ -35,6 +37,7 @@ export { CloudCostManagementApiGetCustomCostsFileRequest, CloudCostManagementApiGetCustomForecastRequest, CloudCostManagementApiGetTagPipelinesRulesetRequest, + CloudCostManagementApiGetUnitCostRequest, CloudCostManagementApiListCostAnomaliesRequest, CloudCostManagementApiListCostTagDescriptionsRequest, CloudCostManagementApiListCostTagKeySourcesRequest, @@ -54,6 +57,7 @@ export { CloudCostManagementApiUpdateCostGCPUsageCostConfigRequest, CloudCostManagementApiUpdateCustomAllocationRuleRequest, CloudCostManagementApiUpdateTagPipelinesRulesetRequest, + CloudCostManagementApiUpdateUnitCostRequest, CloudCostManagementApiUploadCustomCostsFileRequest, CloudCostManagementApiUpsertBudgetRequest, CloudCostManagementApiUpsertCostTagDescriptionByKeyRequest, @@ -330,6 +334,17 @@ export { UCConfigPairData } from "./models/UCConfigPairData"; export { UCConfigPairDataAttributes } from "./models/UCConfigPairDataAttributes"; export { UCConfigPairDataAttributesConfigsItems } from "./models/UCConfigPairDataAttributesConfigsItems"; export { UCConfigPairDataType } from "./models/UCConfigPairDataType"; +export { UnitCostCreateRequest } from "./models/UnitCostCreateRequest"; +export { UnitCostCreateRequestData } from "./models/UnitCostCreateRequestData"; +export { UnitCostDataAttributesResponse } from "./models/UnitCostDataAttributesResponse"; +export { UnitCostDataResponse } from "./models/UnitCostDataResponse"; +export { UnitCostQueryDefinition } from "./models/UnitCostQueryDefinition"; +export { UnitCostRequestAttributes } from "./models/UnitCostRequestAttributes"; +export { UnitCostResponse } from "./models/UnitCostResponse"; +export { UnitCostsResponse } from "./models/UnitCostsResponse"; +export { UnitCostType } from "./models/UnitCostType"; +export { UnitCostUpdateRequest } from "./models/UnitCostUpdateRequest"; +export { UnitCostUpdateRequestData } from "./models/UnitCostUpdateRequestData"; export { UpdateRulesetRequest } from "./models/UpdateRulesetRequest"; export { UpdateRulesetRequestData } from "./models/UpdateRulesetRequestData"; export { UpdateRulesetRequestDataAttributes } from "./models/UpdateRulesetRequestDataAttributes"; diff --git a/services/cloud_cost_management/src/v2/models/TypingInfo.ts b/services/cloud_cost_management/src/v2/models/TypingInfo.ts index cbdfdc3bbc2e..ff822a4a6da6 100644 --- a/services/cloud_cost_management/src/v2/models/TypingInfo.ts +++ b/services/cloud_cost_management/src/v2/models/TypingInfo.ts @@ -219,6 +219,16 @@ import { UCConfigPair } from "./UCConfigPair"; import { UCConfigPairData } from "./UCConfigPairData"; import { UCConfigPairDataAttributes } from "./UCConfigPairDataAttributes"; import { UCConfigPairDataAttributesConfigsItems } from "./UCConfigPairDataAttributesConfigsItems"; +import { UnitCostCreateRequest } from "./UnitCostCreateRequest"; +import { UnitCostCreateRequestData } from "./UnitCostCreateRequestData"; +import { UnitCostDataAttributesResponse } from "./UnitCostDataAttributesResponse"; +import { UnitCostDataResponse } from "./UnitCostDataResponse"; +import { UnitCostQueryDefinition } from "./UnitCostQueryDefinition"; +import { UnitCostRequestAttributes } from "./UnitCostRequestAttributes"; +import { UnitCostResponse } from "./UnitCostResponse"; +import { UnitCostUpdateRequest } from "./UnitCostUpdateRequest"; +import { UnitCostUpdateRequestData } from "./UnitCostUpdateRequestData"; +import { UnitCostsResponse } from "./UnitCostsResponse"; import { UpdateRulesetRequest } from "./UpdateRulesetRequest"; import { UpdateRulesetRequestData } from "./UpdateRulesetRequestData"; import { UpdateRulesetRequestDataAttributes } from "./UpdateRulesetRequestDataAttributes"; @@ -280,6 +290,7 @@ export const TypingInfo: ModelTypingInfo = { RulesetRespDataType: ["ruleset"], RulesetStatusRespDataType: ["ruleset_status"], UCConfigPairDataType: ["azure_uc_configs"], + UnitCostType: ["unit_cost"], UpdateRulesetRequestDataType: ["update_ruleset"], }, oneOfMap: { @@ -559,6 +570,16 @@ export const TypingInfo: ModelTypingInfo = { UCConfigPairDataAttributes: UCConfigPairDataAttributes, UCConfigPairDataAttributesConfigsItems: UCConfigPairDataAttributesConfigsItems, + UnitCostCreateRequest: UnitCostCreateRequest, + UnitCostCreateRequestData: UnitCostCreateRequestData, + UnitCostDataAttributesResponse: UnitCostDataAttributesResponse, + UnitCostDataResponse: UnitCostDataResponse, + UnitCostQueryDefinition: UnitCostQueryDefinition, + UnitCostRequestAttributes: UnitCostRequestAttributes, + UnitCostResponse: UnitCostResponse, + UnitCostUpdateRequest: UnitCostUpdateRequest, + UnitCostUpdateRequestData: UnitCostUpdateRequestData, + UnitCostsResponse: UnitCostsResponse, UpdateRulesetRequest: UpdateRulesetRequest, UpdateRulesetRequestData: UpdateRulesetRequestData, UpdateRulesetRequestDataAttributes: UpdateRulesetRequestDataAttributes, diff --git a/services/cloud_cost_management/src/v2/models/UnitCostCreateRequest.ts b/services/cloud_cost_management/src/v2/models/UnitCostCreateRequest.ts new file mode 100644 index 000000000000..3675d0d35d6a --- /dev/null +++ b/services/cloud_cost_management/src/v2/models/UnitCostCreateRequest.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { UnitCostCreateRequestData } from "./UnitCostCreateRequestData"; + +/** + * A request to create a unit cost. + */ +export class UnitCostCreateRequest { + /** + * The data object of a unit cost create request. + */ + "data": UnitCostCreateRequestData; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "UnitCostCreateRequestData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return UnitCostCreateRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/cloud_cost_management/src/v2/models/UnitCostCreateRequestData.ts b/services/cloud_cost_management/src/v2/models/UnitCostCreateRequestData.ts new file mode 100644 index 000000000000..91ea2eb038be --- /dev/null +++ b/services/cloud_cost_management/src/v2/models/UnitCostCreateRequestData.ts @@ -0,0 +1,57 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { UnitCostRequestAttributes } from "./UnitCostRequestAttributes"; +import { UnitCostType } from "./UnitCostType"; + +/** + * The data object of a unit cost create request. + */ +export class UnitCostCreateRequestData { + /** + * The attributes of a unit cost create or replace request. + */ + "attributes": UnitCostRequestAttributes; + /** + * The JSON:API resource type for a unit cost. + */ + "type": UnitCostType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "UnitCostRequestAttributes", + required: true, + }, + type: { + baseName: "type", + type: "UnitCostType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return UnitCostCreateRequestData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/cloud_cost_management/src/v2/models/UnitCostDataAttributesResponse.ts b/services/cloud_cost_management/src/v2/models/UnitCostDataAttributesResponse.ts new file mode 100644 index 000000000000..11828a9b74e9 --- /dev/null +++ b/services/cloud_cost_management/src/v2/models/UnitCostDataAttributesResponse.ts @@ -0,0 +1,142 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { UnitCostQueryDefinition } from "./UnitCostQueryDefinition"; + +/** + * The attributes of a unit cost. + */ +export class UnitCostDataAttributesResponse { + /** + * The time the unit cost was created. + */ + "createdAt": Date; + /** + * The UUID of the user who created the unit cost. + */ + "createdBy": string; + /** + * A timeseries object containing `queries` and `formulas` arrays. + */ + "denominatorQuery": UnitCostQueryDefinition; + /** + * The data source of the denominator queries, or `multisource` when the denominator + * queries span more than one data source. + */ + "denominatorType": string; + /** + * The description of the unit cost. Omitted when the unit cost has no description. + */ + "description"?: string; + /** + * The name of the unit cost. + */ + "name": string; + /** + * A timeseries object containing `queries` and `formulas` arrays. + */ + "numeratorQuery": UnitCostQueryDefinition; + /** + * The ID of the organization the unit cost belongs to. + */ + "orgId": number; + /** + * The label describing the denominator unit. + */ + "unitLabel": string; + /** + * The time the unit cost was last updated. + */ + "updatedAt": Date; + /** + * The UUID of the user who last updated the unit cost. + */ + "updatedBy": string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + createdAt: { + baseName: "created_at", + type: "Date", + required: true, + format: "date-time", + }, + createdBy: { + baseName: "created_by", + type: "string", + required: true, + format: "uuid", + }, + denominatorQuery: { + baseName: "denominator_query", + type: "UnitCostQueryDefinition", + required: true, + }, + denominatorType: { + baseName: "denominator_type", + type: "string", + required: true, + }, + description: { + baseName: "description", + type: "string", + }, + name: { + baseName: "name", + type: "string", + required: true, + }, + numeratorQuery: { + baseName: "numerator_query", + type: "UnitCostQueryDefinition", + required: true, + }, + orgId: { + baseName: "org_id", + type: "number", + required: true, + format: "int64", + }, + unitLabel: { + baseName: "unit_label", + type: "string", + required: true, + }, + updatedAt: { + baseName: "updated_at", + type: "Date", + required: true, + format: "date-time", + }, + updatedBy: { + baseName: "updated_by", + type: "string", + required: true, + format: "uuid", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return UnitCostDataAttributesResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/cloud_cost_management/src/v2/models/UnitCostDataResponse.ts b/services/cloud_cost_management/src/v2/models/UnitCostDataResponse.ts new file mode 100644 index 000000000000..2459381a1cd4 --- /dev/null +++ b/services/cloud_cost_management/src/v2/models/UnitCostDataResponse.ts @@ -0,0 +1,67 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { UnitCostDataAttributesResponse } from "./UnitCostDataAttributesResponse"; +import { UnitCostType } from "./UnitCostType"; + +/** + * The data object of a unit cost response. + */ +export class UnitCostDataResponse { + /** + * The attributes of a unit cost. + */ + "attributes": UnitCostDataAttributesResponse; + /** + * The UUID of the unit cost. + */ + "id": string; + /** + * The JSON:API resource type for a unit cost. + */ + "type": UnitCostType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "UnitCostDataAttributesResponse", + required: true, + }, + id: { + baseName: "id", + type: "string", + required: true, + format: "uuid", + }, + type: { + baseName: "type", + type: "UnitCostType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return UnitCostDataResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/cloud_cost_management/src/v2/models/UnitCostQueryDefinition.ts b/services/cloud_cost_management/src/v2/models/UnitCostQueryDefinition.ts new file mode 100644 index 000000000000..8b4c337c42e4 --- /dev/null +++ b/services/cloud_cost_management/src/v2/models/UnitCostQueryDefinition.ts @@ -0,0 +1,54 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * A timeseries object containing `queries` and `formulas` arrays. + */ +export class UnitCostQueryDefinition { + /** + * The list of formulas applied to the queries for this side of the ratio. + */ + "formulas": Array<{ [key: string]: any }>; + /** + * The list of queries evaluated for this side of the ratio. + */ + "queries": Array<{ [key: string]: any }>; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + formulas: { + baseName: "formulas", + type: "Array<{ [key: string]: any; }>", + required: true, + }, + queries: { + baseName: "queries", + type: "Array<{ [key: string]: any; }>", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return UnitCostQueryDefinition.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/cloud_cost_management/src/v2/models/UnitCostRequestAttributes.ts b/services/cloud_cost_management/src/v2/models/UnitCostRequestAttributes.ts new file mode 100644 index 000000000000..0a3a1687bda7 --- /dev/null +++ b/services/cloud_cost_management/src/v2/models/UnitCostRequestAttributes.ts @@ -0,0 +1,82 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { UnitCostQueryDefinition } from "./UnitCostQueryDefinition"; + +/** + * The attributes of a unit cost create or replace request. + */ +export class UnitCostRequestAttributes { + /** + * A timeseries object containing `queries` and `formulas` arrays. + */ + "denominatorQuery": UnitCostQueryDefinition; + /** + * An optional description of the unit cost. At most 2000 characters. + */ + "description"?: string; + /** + * The name of the unit cost. At most 200 characters. + */ + "name": string; + /** + * A timeseries object containing `queries` and `formulas` arrays. + */ + "numeratorQuery": UnitCostQueryDefinition; + /** + * The label describing the denominator unit, for example `user`. At most 100 characters. + */ + "unitLabel": string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + denominatorQuery: { + baseName: "denominator_query", + type: "UnitCostQueryDefinition", + required: true, + }, + description: { + baseName: "description", + type: "string", + }, + name: { + baseName: "name", + type: "string", + required: true, + }, + numeratorQuery: { + baseName: "numerator_query", + type: "UnitCostQueryDefinition", + required: true, + }, + unitLabel: { + baseName: "unit_label", + type: "string", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return UnitCostRequestAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/cloud_cost_management/src/v2/models/UnitCostResponse.ts b/services/cloud_cost_management/src/v2/models/UnitCostResponse.ts new file mode 100644 index 000000000000..0e3e28066dc8 --- /dev/null +++ b/services/cloud_cost_management/src/v2/models/UnitCostResponse.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { UnitCostDataResponse } from "./UnitCostDataResponse"; + +/** + * A response containing a single unit cost. + */ +export class UnitCostResponse { + /** + * The data object of a unit cost response. + */ + "data": UnitCostDataResponse; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "UnitCostDataResponse", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return UnitCostResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/cloud_cost_management/src/v2/models/UnitCostType.ts b/services/cloud_cost_management/src/v2/models/UnitCostType.ts new file mode 100644 index 000000000000..a78819c317a5 --- /dev/null +++ b/services/cloud_cost_management/src/v2/models/UnitCostType.ts @@ -0,0 +1,7 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * The JSON:API resource type for a unit cost. + */ +export type UnitCostType = typeof UNIT_COST | UnparsedObject; +export const UNIT_COST = "unit_cost"; diff --git a/services/cloud_cost_management/src/v2/models/UnitCostUpdateRequest.ts b/services/cloud_cost_management/src/v2/models/UnitCostUpdateRequest.ts new file mode 100644 index 000000000000..eb0e90b01210 --- /dev/null +++ b/services/cloud_cost_management/src/v2/models/UnitCostUpdateRequest.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { UnitCostUpdateRequestData } from "./UnitCostUpdateRequestData"; + +/** + * A request to replace a unit cost. + */ +export class UnitCostUpdateRequest { + /** + * The data object of a unit cost replace request. + */ + "data": UnitCostUpdateRequestData; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "UnitCostUpdateRequestData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return UnitCostUpdateRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/cloud_cost_management/src/v2/models/UnitCostUpdateRequestData.ts b/services/cloud_cost_management/src/v2/models/UnitCostUpdateRequestData.ts new file mode 100644 index 000000000000..eabbc0a10837 --- /dev/null +++ b/services/cloud_cost_management/src/v2/models/UnitCostUpdateRequestData.ts @@ -0,0 +1,67 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { UnitCostRequestAttributes } from "./UnitCostRequestAttributes"; +import { UnitCostType } from "./UnitCostType"; + +/** + * The data object of a unit cost replace request. + */ +export class UnitCostUpdateRequestData { + /** + * The attributes of a unit cost create or replace request. + */ + "attributes": UnitCostRequestAttributes; + /** + * The UUID of the unit cost being replaced. Must match the `unit_cost_id` path parameter. + */ + "id": string; + /** + * The JSON:API resource type for a unit cost. + */ + "type": UnitCostType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "UnitCostRequestAttributes", + required: true, + }, + id: { + baseName: "id", + type: "string", + required: true, + format: "uuid", + }, + type: { + baseName: "type", + type: "UnitCostType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return UnitCostUpdateRequestData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/cloud_cost_management/src/v2/models/UnitCostsResponse.ts b/services/cloud_cost_management/src/v2/models/UnitCostsResponse.ts new file mode 100644 index 000000000000..334adf35331f --- /dev/null +++ b/services/cloud_cost_management/src/v2/models/UnitCostsResponse.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { UnitCostDataResponse } from "./UnitCostDataResponse"; + +/** + * A response containing a list of unit costs. + */ +export class UnitCostsResponse { + /** + * The list of unit costs. + */ + "data": Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return UnitCostsResponse.attributeTypeMap; + } + + public constructor() {} +}