From b0b19b8297cd9d836566110572c7b57f03507c3b Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 12 Nov 2026 19:28:21 +0000 Subject: [PATCH] Regenerate client from commit e676f0f of spec repo --- .generator/schemas/v2/openapi.yaml | 109 +++++++++++++++++ .../UpdateCustomCostsFile.py | 32 +++++ .../v2/api/cloud_cost_management_api.py | 48 ++++++++ .../custom_costs_file_update_attributes.py | 33 ++++++ .../v2/model/custom_costs_file_update_data.py | 56 +++++++++ .../model/custom_costs_file_update_request.py | 40 +++++++ .../v2/model/custom_costs_file_update_type.py | 35 ++++++ src/datadog_api_client/v2/models/__init__.py | 8 ++ .../test-runner-data/manifest.json | 14 +++ ...costs-file-returns-not-found-response.json | 51 ++++++++ ...custom-costs-file-returns-ok-response.json | 51 ++++++++ .../v2/cloud-cost-management.json | 110 ++++++++++++++++++ .../v2/features/cloud_cost_management.feature | 18 +++ tests/v2/features/given.json | 12 ++ tests/v2/features/undo.json | 6 + 15 files changed, 623 insertions(+) create mode 100644 examples/v2/cloud-cost-management/UpdateCustomCostsFile.py create mode 100644 src/datadog_api_client/v2/model/custom_costs_file_update_attributes.py create mode 100644 src/datadog_api_client/v2/model/custom_costs_file_update_data.py create mode 100644 src/datadog_api_client/v2/model/custom_costs_file_update_request.py create mode 100644 src/datadog_api_client/v2/model/custom_costs_file_update_type.py create mode 100644 tests/generated-test/test-runner-data/v2/cloud-cost-management/update-custom-costs-file-returns-not-found-response.json create mode 100644 tests/generated-test/test-runner-data/v2/cloud-cost-management/update-custom-costs-file-returns-ok-response.json diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 89b899e5cc..5a48195f55 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -34932,6 +34932,49 @@ components: description: Type of the Custom Costs file metadata. type: string type: object + CustomCostsFileUpdateAttributes: + description: Attributes of a Custom Costs file that can be updated. + properties: + ai_provider: + description: Whether the Custom Costs file contains the costs of an AI provider. + example: true + type: boolean + required: + - ai_provider + type: object + CustomCostsFileUpdateData: + description: Custom Costs file to update. + properties: + attributes: + $ref: "#/components/schemas/CustomCostsFileUpdateAttributes" + id: + description: ID of the Custom Costs file. + example: "00000000-0000-0000-0000-000000000007" + type: string + type: + $ref: "#/components/schemas/CustomCostsFileUpdateType" + required: + - id + - type + - attributes + type: object + CustomCostsFileUpdateRequest: + description: Request for updating a Custom Costs file. + properties: + data: + $ref: "#/components/schemas/CustomCostsFileUpdateData" + required: + - data + type: object + CustomCostsFileUpdateType: + default: cost_metadata + description: Type of the Custom Costs file resource. + enum: + - cost_metadata + example: cost_metadata + type: string + x-enum-varnames: + - COST_METADATA CustomCostsFileUploadRequest: description: Request for uploading a Custom Costs file. items: @@ -172651,6 +172694,72 @@ paths: summary: Get Custom Costs file tags: - Cloud Cost Management + patch: + description: >- + Mark whether a Custom Costs file holds AI provider costs. Datadog then recomputes the costs for the months that the file covers. + operationId: UpdateCustomCostsFile + parameters: + - $ref: "#/components/parameters/FileID" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + ai_provider: true + id: 00000000-0000-0000-0000-000000000007 + type: cost_metadata + schema: + $ref: "#/components/schemas/CustomCostsFileUpdateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + billed_cost: 100.5 + billing_currency: USD + charge_period: + end: 1706745600000 + start: 1704067200000 + name: my_file.json + provider_names: + - my_provider + status: ACTIVE + uploaded_at: 1704067200000 + id: 00000000-0000-0000-0000-000000000007 + type: cost_metadata + meta: + version: "1.0" + schema: + $ref: "#/components/schemas/CustomCostsFileUploadResponse" + description: OK + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_write + summary: Update Custom Costs file + tags: + - Cloud Cost Management + "x-permission": + operator: OR + permissions: + - cloud_cost_management_write /api/v2/cost/gcp_uc_config: get: description: List the Google Cloud Usage Cost configs. diff --git a/examples/v2/cloud-cost-management/UpdateCustomCostsFile.py b/examples/v2/cloud-cost-management/UpdateCustomCostsFile.py new file mode 100644 index 0000000000..eec496a1ec --- /dev/null +++ b/examples/v2/cloud-cost-management/UpdateCustomCostsFile.py @@ -0,0 +1,32 @@ +""" +Update Custom Costs file returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi +from datadog_api_client.v2.model.custom_costs_file_update_attributes import CustomCostsFileUpdateAttributes +from datadog_api_client.v2.model.custom_costs_file_update_data import CustomCostsFileUpdateData +from datadog_api_client.v2.model.custom_costs_file_update_request import CustomCostsFileUpdateRequest +from datadog_api_client.v2.model.custom_costs_file_update_type import CustomCostsFileUpdateType + +# there is a valid "custom_costs_file" in the system +CUSTOM_COSTS_FILE_DATA_ID = environ["CUSTOM_COSTS_FILE_DATA_ID"] + +body = CustomCostsFileUpdateRequest( + data=CustomCostsFileUpdateData( + attributes=CustomCostsFileUpdateAttributes( + ai_provider=True, + ), + id=CUSTOM_COSTS_FILE_DATA_ID, + type=CustomCostsFileUpdateType.COST_METADATA, + ), +) + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +with ApiClient(configuration) as api_client: + api_instance = CloudCostManagementApi(api_client) + response = api_instance.update_custom_costs_file(file_id=CUSTOM_COSTS_FILE_DATA_ID, body=body) + + print(response) diff --git a/src/datadog_api_client/v2/api/cloud_cost_management_api.py b/src/datadog_api_client/v2/api/cloud_cost_management_api.py index 3bbdbb436a..a1f510b64b 100644 --- a/src/datadog_api_client/v2/api/cloud_cost_management_api.py +++ b/src/datadog_api_client/v2/api/cloud_cost_management_api.py @@ -57,6 +57,7 @@ from datadog_api_client.v2.model.custom_costs_file_upload_response import CustomCostsFileUploadResponse from datadog_api_client.v2.model.custom_costs_file_line_item import CustomCostsFileLineItem from datadog_api_client.v2.model.custom_costs_file_get_response import CustomCostsFileGetResponse +from datadog_api_client.v2.model.custom_costs_file_update_request import CustomCostsFileUpdateRequest from datadog_api_client.v2.model.gcp_usage_cost_configs_response import GCPUsageCostConfigsResponse from datadog_api_client.v2.model.gcp_usage_cost_config_response import GCPUsageCostConfigResponse from datadog_api_client.v2.model.gcp_usage_cost_config_post_request import GCPUsageCostConfigPostRequest @@ -1989,6 +1990,32 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._update_custom_costs_file_endpoint = _Endpoint( + settings={ + "response_type": (CustomCostsFileUploadResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/cost/custom_costs/{file_id}", + "operation_id": "update_custom_costs_file", + "http_method": "PATCH", + "version": "v2", + }, + params_map={ + "file_id": { + "required": True, + "openapi_types": (str,), + "attribute": "file_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (CustomCostsFileUpdateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._update_tag_pipelines_ruleset_endpoint = _Endpoint( settings={ "response_type": (RulesetResp,), @@ -3807,6 +3834,27 @@ def update_custom_allocation_rule( return self._update_custom_allocation_rule_endpoint.call_with_http_info(**kwargs) + def update_custom_costs_file( + self, + file_id: str, + body: CustomCostsFileUpdateRequest, + ) -> CustomCostsFileUploadResponse: + """Update Custom Costs file. + + Mark whether a Custom Costs file holds AI provider costs. Datadog then recomputes the costs for the months that the file covers. + + :param file_id: File ID. + :type file_id: str + :type body: CustomCostsFileUpdateRequest + :rtype: CustomCostsFileUploadResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["file_id"] = file_id + + kwargs["body"] = body + + return self._update_custom_costs_file_endpoint.call_with_http_info(**kwargs) + def update_tag_pipelines_ruleset( self, ruleset_id: str, diff --git a/src/datadog_api_client/v2/model/custom_costs_file_update_attributes.py b/src/datadog_api_client/v2/model/custom_costs_file_update_attributes.py new file mode 100644 index 0000000000..d37856dcd8 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_costs_file_update_attributes.py @@ -0,0 +1,33 @@ +# 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. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +class CustomCostsFileUpdateAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "ai_provider": (bool,), + } + + attribute_map = { + "ai_provider": "ai_provider", + } + + def __init__(self_, ai_provider: bool, **kwargs): + """ + Attributes of a Custom Costs file that can be updated. + + :param ai_provider: Whether the Custom Costs file contains the costs of an AI provider. + :type ai_provider: bool + """ + super().__init__(kwargs) + + self_.ai_provider = ai_provider diff --git a/src/datadog_api_client/v2/model/custom_costs_file_update_data.py b/src/datadog_api_client/v2/model/custom_costs_file_update_data.py new file mode 100644 index 0000000000..238ac252f9 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_costs_file_update_data.py @@ -0,0 +1,56 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_costs_file_update_attributes import CustomCostsFileUpdateAttributes + from datadog_api_client.v2.model.custom_costs_file_update_type import CustomCostsFileUpdateType + + +class CustomCostsFileUpdateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_costs_file_update_attributes import CustomCostsFileUpdateAttributes + from datadog_api_client.v2.model.custom_costs_file_update_type import CustomCostsFileUpdateType + + return { + "attributes": (CustomCostsFileUpdateAttributes,), + "id": (str,), + "type": (CustomCostsFileUpdateType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, attributes: CustomCostsFileUpdateAttributes, id: str, type: CustomCostsFileUpdateType, **kwargs + ): + """ + Custom Costs file to update. + + :param attributes: Attributes of a Custom Costs file that can be updated. + :type attributes: CustomCostsFileUpdateAttributes + + :param id: ID of the Custom Costs file. + :type id: str + + :param type: Type of the Custom Costs file resource. + :type type: CustomCostsFileUpdateType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/custom_costs_file_update_request.py b/src/datadog_api_client/v2/model/custom_costs_file_update_request.py new file mode 100644 index 0000000000..06dd33f2a2 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_costs_file_update_request.py @@ -0,0 +1,40 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_costs_file_update_data import CustomCostsFileUpdateData + + +class CustomCostsFileUpdateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_costs_file_update_data import CustomCostsFileUpdateData + + return { + "data": (CustomCostsFileUpdateData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: CustomCostsFileUpdateData, **kwargs): + """ + Request for updating a Custom Costs file. + + :param data: Custom Costs file to update. + :type data: CustomCostsFileUpdateData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/custom_costs_file_update_type.py b/src/datadog_api_client/v2/model/custom_costs_file_update_type.py new file mode 100644 index 0000000000..20e6cc6a16 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_costs_file_update_type.py @@ -0,0 +1,35 @@ +# 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. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class CustomCostsFileUpdateType(ModelSimple): + """ + Type of the Custom Costs file resource. + + :param value: If omitted defaults to "cost_metadata". Must be one of ["cost_metadata"]. + :type value: str + """ + + allowed_values = { + "cost_metadata", + } + COST_METADATA: ClassVar["CustomCostsFileUpdateType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CustomCostsFileUpdateType.COST_METADATA = CustomCostsFileUpdateType("cost_metadata") diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 023c204e6e..a4d66bf955 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -2536,6 +2536,10 @@ from datadog_api_client.v2.model.custom_costs_file_metadata_with_content_high_level import ( CustomCostsFileMetadataWithContentHighLevel, ) +from datadog_api_client.v2.model.custom_costs_file_update_attributes import CustomCostsFileUpdateAttributes +from datadog_api_client.v2.model.custom_costs_file_update_data import CustomCostsFileUpdateData +from datadog_api_client.v2.model.custom_costs_file_update_request import CustomCostsFileUpdateRequest +from datadog_api_client.v2.model.custom_costs_file_update_type import CustomCostsFileUpdateType from datadog_api_client.v2.model.custom_costs_file_upload_response import CustomCostsFileUploadResponse from datadog_api_client.v2.model.custom_costs_file_usage_charge_period import CustomCostsFileUsageChargePeriod from datadog_api_client.v2.model.custom_costs_user import CustomCostsUser @@ -15858,6 +15862,10 @@ "CustomCostsFileMetadataHighLevel", "CustomCostsFileMetadataWithContent", "CustomCostsFileMetadataWithContentHighLevel", + "CustomCostsFileUpdateAttributes", + "CustomCostsFileUpdateData", + "CustomCostsFileUpdateRequest", + "CustomCostsFileUpdateType", "CustomCostsFileUploadResponse", "CustomCostsFileUsageChargePeriod", "CustomCostsUser", diff --git a/tests/generated-test/test-runner-data/manifest.json b/tests/generated-test/test-runner-data/manifest.json index ec62496d58..4f0bdf135b 100644 --- a/tests/generated-test/test-runner-data/manifest.json +++ b/tests/generated-test/test-runner-data/manifest.json @@ -4641,6 +4641,20 @@ "scenario": "Update Cloud Cost Management Azure config returns \"OK\" response", "version": "v2" }, + { + "feature": "Cloud Cost Management", + "feature_file": "../../v2/features/cloud_cost_management.feature", + "file": "v2/cloud-cost-management/update-custom-costs-file-returns-not-found-response.json", + "scenario": "Update Custom Costs file returns \"Not Found\" response", + "version": "v2" + }, + { + "feature": "Cloud Cost Management", + "feature_file": "../../v2/features/cloud_cost_management.feature", + "file": "v2/cloud-cost-management/update-custom-costs-file-returns-ok-response.json", + "scenario": "Update Custom Costs file returns \"OK\" response", + "version": "v2" + }, { "feature": "Cloud Cost Management", "feature_file": "../../v2/features/cloud_cost_management.feature", diff --git a/tests/generated-test/test-runner-data/v2/cloud-cost-management/update-custom-costs-file-returns-not-found-response.json b/tests/generated-test/test-runner-data/v2/cloud-cost-management/update-custom-costs-file-returns-not-found-response.json new file mode 100644 index 0000000000..b8e437a4c2 --- /dev/null +++ b/tests/generated-test/test-runner-data/v2/cloud-cost-management/update-custom-costs-file-returns-not-found-response.json @@ -0,0 +1,51 @@ +{ + "api": "CloudCostManagement", + "expected_status": 404, + "feature": "Cloud Cost Management", + "id": "v2/Cloud Cost Management/Update Custom Costs file returns \"Not Found\" response", + "operation_id": "UpdateCustomCostsFile", + "request": { + "body": { + "schema": { + "format": null, + "ref": "CustomCostsFileUpdateRequest", + "type": "object" + }, + "source": "inline", + "value": { + "data": { + "attributes": { + "ai_provider": true + }, + "id": "00000000-0000-0000-0000-000000000000", + "type": "cost_metadata" + } + } + }, + "content_type": "application/json", + "method": "PATCH", + "pagination": false, + "parameters": [ + { + "explode": null, + "in": "path", + "name": "file_id", + "required": true, + "schema": { + "format": null, + "ref": null, + "type": "string" + }, + "source": { + "type": "literal", + "value": "00000000-0000-0000-0000-000000000000" + }, + "style": null + } + ], + "path": "/api/v2/cost/custom_costs/{file_id}" + }, + "scenario": "Update Custom Costs file returns \"Not Found\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/tests/generated-test/test-runner-data/v2/cloud-cost-management/update-custom-costs-file-returns-ok-response.json b/tests/generated-test/test-runner-data/v2/cloud-cost-management/update-custom-costs-file-returns-ok-response.json new file mode 100644 index 0000000000..73fe6178bd --- /dev/null +++ b/tests/generated-test/test-runner-data/v2/cloud-cost-management/update-custom-costs-file-returns-ok-response.json @@ -0,0 +1,51 @@ +{ + "api": "CloudCostManagement", + "expected_status": 200, + "feature": "Cloud Cost Management", + "id": "v2/Cloud Cost Management/Update Custom Costs file returns \"OK\" response", + "operation_id": "UpdateCustomCostsFile", + "request": { + "body": { + "schema": { + "format": null, + "ref": "CustomCostsFileUpdateRequest", + "type": "object" + }, + "source": "inline", + "value": { + "data": { + "attributes": { + "ai_provider": true + }, + "id": "{{ custom_costs_file.data.id }}", + "type": "cost_metadata" + } + } + }, + "content_type": "application/json", + "method": "PATCH", + "pagination": false, + "parameters": [ + { + "explode": null, + "in": "path", + "name": "file_id", + "required": true, + "schema": { + "format": null, + "ref": null, + "type": "string" + }, + "source": { + "path": "custom_costs_file.data.id", + "type": "fixture" + }, + "style": null + } + ], + "path": "/api/v2/cost/custom_costs/{file_id}" + }, + "scenario": "Update Custom Costs file returns \"OK\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/tests/generated-test/test-server-data/v2/cloud-cost-management.json b/tests/generated-test/test-server-data/v2/cloud-cost-management.json index 13b50e6149..29d24465e8 100644 --- a/tests/generated-test/test-server-data/v2/cloud-cost-management.json +++ b/tests/generated-test/test-server-data/v2/cloud-cost-management.json @@ -1836,6 +1836,116 @@ "scenario": "Update Cloud Cost Management GCP Usage Cost config returns \"Bad Request\" response", "version": "v2" }, + { + "feature": "Cloud Cost Management", + "frozen_at": "2026-11-09T15:50:58.386Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "ai_provider": true + }, + "id": "00000000-0000-0000-0000-000000000000", + "type": "cost_metadata" + } + } + }, + "content_type": "application/json", + "method": "PATCH", + "path": "/api/v2/cost/custom_costs/00000000-0000-0000-0000-000000000000", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"errors\":[{\"status\":\"404\",\"title\":\"Not Found\",\"detail\":\"file not found: 00000000-0000-0000-0000-000000000000\"}]}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "Not Found", + "status": 404 + } + } + ], + "scenario": "Update Custom Costs file returns \"Not Found\" response", + "version": "v2" + }, + { + "feature": "Cloud Cost Management", + "frozen_at": "2026-11-09T15:50:59.765Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": [ + { + "BilledCost": 250, + "BillingCurrency": "USD", + "ChargeDescription": "my_description", + "ChargePeriodEnd": "2026-10-31", + "ChargePeriodStart": "2026-10-01", + "ProviderName": "my_provider" + } + ] + }, + "content_type": "application/json", + "method": "PUT", + "path": "/api/v2/cost/custom_costs", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"id\":\"565b55e5-0fe7-4c65-93b0-0eb9046150ea\",\"type\":\"cost_metadata\",\"attributes\":{\"ai_provider\":false,\"billed_cost\":250,\"billing_currency\":\"USD\",\"charge_period\":{\"start\":1790812800000,\"end\":1793404800000},\"name\":\"data.json\",\"provider_names\":[\"my_provider\"],\"status\":\"UPLOADING\",\"uploaded_at\":1794239459982,\"uploaded_by\":{\"name\":\"C\u00e9dric Van Rompay\",\"icon\":\"https://secure.gravatar.com/avatar/fb5991514ab909a799dd362ad990f4f8?d=retro\\u0026s=48\",\"email\":\"cedric.vanrompay@datadoghq.com\"}}},\"meta\":{\"version\":\"1.0\"}}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "Accepted", + "status": 202 + } + }, + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "ai_provider": true + }, + "id": "565b55e5-0fe7-4c65-93b0-0eb9046150ea", + "type": "cost_metadata" + } + } + }, + "content_type": "application/json", + "method": "PATCH", + "path": "/api/v2/cost/custom_costs/565b55e5-0fe7-4c65-93b0-0eb9046150ea", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"id\":\"565b55e5-0fe7-4c65-93b0-0eb9046150ea\",\"type\":\"cost_metadata\",\"attributes\":{\"ai_provider\":true,\"billed_cost\":250,\"billing_currency\":\"USD\",\"charge_period\":{\"start\":1790812800000,\"end\":1793404800000},\"name\":\"data.json\",\"provider_names\":[\"my_provider\"],\"status\":\"PROCESSING\",\"uploaded_at\":1794239459982,\"uploaded_by\":{\"name\":\"C\u00e9dric Van Rompay\",\"icon\":\"https://secure.gravatar.com/avatar/fb5991514ab909a799dd362ad990f4f8?d=retro\\u0026s=48\",\"email\":\"cedric.vanrompay@datadoghq.com\"}}},\"meta\":{\"version\":\"1.0\"}}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "OK", + "status": 200 + } + } + ], + "scenario": "Update Custom Costs file returns \"OK\" response", + "version": "v2" + }, { "feature": "Cloud Cost Management", "frozen_at": "2025-06-23T12:09:42.232Z", diff --git a/tests/v2/features/cloud_cost_management.feature b/tests/v2/features/cloud_cost_management.feature index fbcb675f81..5f4cbc46c0 100644 --- a/tests/v2/features/cloud_cost_management.feature +++ b/tests/v2/features/cloud_cost_management.feature @@ -1082,6 +1082,24 @@ Feature: Cloud Cost Management Then the response status is 200 OK And the response "data.type" is equal to "azure_uc_configs" + @team:ddoghq/cloud-cost-management + Scenario: Update Custom Costs file returns "Not Found" response + Given new "UpdateCustomCostsFile" request + And request contains "file_id" parameter with value "00000000-0000-0000-0000-000000000000" + And body with value {"data": {"attributes": {"ai_provider": true}, "id": "00000000-0000-0000-0000-000000000000", "type": "cost_metadata"}} + When the request is sent + Then the response status is 404 Not Found + + @team:ddoghq/cloud-cost-management + Scenario: Update Custom Costs file returns "OK" response + Given there is a valid "custom_costs_file" in the system + And new "UpdateCustomCostsFile" request + And request contains "file_id" parameter from "custom_costs_file.data.id" + And body with value {"data": {"attributes": {"ai_provider": true}, "id": "{{ custom_costs_file.data.id }}", "type": "cost_metadata"}} + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.ai_provider" is equal to true + @generated @skip @team:ddoghq/cloud-cost-management Scenario: Update Google Cloud Usage Cost config returns "Bad Request" response Given new "UpdateCostGCPUsageCostConfig" request diff --git a/tests/v2/features/given.json b/tests/v2/features/given.json index 2d3ed35caf..573d99e0fd 100644 --- a/tests/v2/features/given.json +++ b/tests/v2/features/given.json @@ -337,6 +337,18 @@ "tag": "Security Monitoring", "operationId": "CreateCustomFramework" }, + { + "parameters": [ + { + "name": "body", + "value": "[{\"ProviderName\": \"my_provider\", \"ChargePeriodStart\": \"2026-10-01\", \"ChargePeriodEnd\": \"2026-10-31\", \"ChargeDescription\": \"my_description\", \"BilledCost\": 250, \"BillingCurrency\": \"USD\"}]" + } + ], + "step": "there is a valid \"custom_costs_file\" in the system", + "key": "custom_costs_file", + "tag": "Cloud Cost Management", + "operationId": "UploadCustomCostsFile" + }, { "parameters": [ { diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 993492a315..e32161a472 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -1939,6 +1939,12 @@ "type": "safe" } }, + "UpdateCustomCostsFile": { + "tag": "Cloud Cost Management", + "undo": { + "type": "idempotent" + } + }, "ListCostGCPUsageCostConfigs": { "tag": "Cloud Cost Management", "undo": {