diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 3bd4dc4902..c5944e1249 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -18525,6 +18525,45 @@ components: x-enum-varnames: - "TRUE" - "FALSE" + CostTagMetadataMonth: + description: A month that has Cloud Cost Management tag metadata available for a given provider. + properties: + id: + description: The month, in `YYYY-MM` format. + example: "2026-04" + type: string + type: + $ref: "#/components/schemas/CostTagMetadataMonthType" + required: + - id + - type + type: object + CostTagMetadataMonthType: + default: cost_tag_metadata_month + description: Type of the Cloud Cost Management tag metadata month resource. + enum: + - cost_tag_metadata_month + example: cost_tag_metadata_month + type: string + x-enum-varnames: + - COST_TAG_METADATA_MONTH + CostTagMetadataMonthsResponse: + description: List of months that have Cloud Cost Management tag metadata for the requested provider, ordered most-recent first and capped at 36 months. + example: + data: + - id: "2026-04" + type: cost_tag_metadata_month + - id: "2026-03" + type: cost_tag_metadata_month + properties: + data: + description: List of months that have tag metadata available. + items: + $ref: "#/components/schemas/CostTagMetadataMonth" + type: array + required: + - data + type: object CostTagType: default: cost_tag description: Type of the Cloud Cost Management tag resource. @@ -109019,6 +109058,68 @@ paths: 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/tag_metadata/months: + get: + description: |- + List months that have Cloud Cost Management tag metadata for a given provider, + ordered most-recent first. The response is capped at 36 months. + operationId: ListCostTagMetadataMonths + parameters: + - description: |- + Provider to scope the query to. Use the value of the `providername` tag in CCM + (for example, `aws`, `azure`, `gcp`, `Oracle`, `Confluent Cloud`, `Snowflake`). + For costs uploaded through the Custom Costs API, use `custom`. + Values are case-sensitive. + example: aws + in: query + name: filter[provider] + required: true + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - id: "2026-04" + type: cost_tag_metadata_month + - id: "2026-03" + type: cost_tag_metadata_month + schema: + $ref: "#/components/schemas/CostTagMetadataMonthsResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_read + summary: List Cloud Cost Management tag metadata months + 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/tag_metadata/orchestrators: get: description: List container orchestrators (for example, `kubernetes`, `ecs`) detected in Cloud Cost Management data for the requested period. diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 8ebe6f4853..1da1a45806 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -7389,6 +7389,27 @@ datadog\_api\_client.v2.model.cost\_tag\_metadata\_daily\_filter module :members: :show-inheritance: +datadog\_api\_client.v2.model.cost\_tag\_metadata\_month module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.cost_tag_metadata_month + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.cost\_tag\_metadata\_month\_type module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.cost_tag_metadata_month_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.cost\_tag\_metadata\_months\_response module +-------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.cost_tag_metadata_months_response + :members: + :show-inheritance: + datadog\_api\_client.v2.model.cost\_tag\_type module ---------------------------------------------------- diff --git a/examples/v2/cloud-cost-management/ListCostTagMetadataMonths.py b/examples/v2/cloud-cost-management/ListCostTagMetadataMonths.py new file mode 100644 index 0000000000..1937d1692f --- /dev/null +++ b/examples/v2/cloud-cost-management/ListCostTagMetadataMonths.py @@ -0,0 +1,16 @@ +""" +List Cloud Cost Management tag metadata months returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi + +configuration = Configuration() +configuration.unstable_operations["list_cost_tag_metadata_months"] = True +with ApiClient(configuration) as api_client: + api_instance = CloudCostManagementApi(api_client) + response = api_instance.list_cost_tag_metadata_months( + filter_provider="filter[provider]", + ) + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index 87ed78f81a..cbddc4a653 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -430,6 +430,7 @@ def __init__( "v2.list_cost_tag_key_sources": False, "v2.list_cost_tag_metadata": False, "v2.list_cost_tag_metadata_metrics": False, + "v2.list_cost_tag_metadata_months": False, "v2.list_cost_tag_metadata_orchestrators": False, "v2.search_cost_recommendations": False, "v2.create_dashboard_secure_embed": False, 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 654644f9dd..87248097b9 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 @@ -65,6 +65,7 @@ from datadog_api_client.v2.model.cost_tag_metadata_daily_filter import CostTagMetadataDailyFilter from datadog_api_client.v2.model.cost_currency_response import CostCurrencyResponse from datadog_api_client.v2.model.cost_metrics_response import CostMetricsResponse +from datadog_api_client.v2.model.cost_tag_metadata_months_response import CostTagMetadataMonthsResponse from datadog_api_client.v2.model.cost_orchestrators_response import CostOrchestratorsResponse from datadog_api_client.v2.model.cost_tag_key_sources_response import CostTagKeySourcesResponse from datadog_api_client.v2.model.cost_tags_response import CostTagsResponse @@ -1282,6 +1283,29 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._list_cost_tag_metadata_months_endpoint = _Endpoint( + settings={ + "response_type": (CostTagMetadataMonthsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/cost/tag_metadata/months", + "operation_id": "list_cost_tag_metadata_months", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "filter_provider": { + "required": True, + "openapi_types": (str,), + "attribute": "filter[provider]", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._list_cost_tag_metadata_orchestrators_endpoint = _Endpoint( settings={ "response_type": (CostOrchestratorsResponse,), @@ -2772,6 +2796,27 @@ def list_cost_tag_metadata_metrics( return self._list_cost_tag_metadata_metrics_endpoint.call_with_http_info(**kwargs) + def list_cost_tag_metadata_months( + self, + filter_provider: str, + ) -> CostTagMetadataMonthsResponse: + """List Cloud Cost Management tag metadata months. + + List months that have Cloud Cost Management tag metadata for a given provider, + ordered most-recent first. The response is capped at 36 months. + + :param filter_provider: Provider to scope the query to. Use the value of the ``providername`` tag in CCM + (for example, ``aws`` , ``azure`` , ``gcp`` , ``Oracle`` , ``Confluent Cloud`` , ``Snowflake`` ). + For costs uploaded through the Custom Costs API, use ``custom``. + Values are case-sensitive. + :type filter_provider: str + :rtype: CostTagMetadataMonthsResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["filter_provider"] = filter_provider + + return self._list_cost_tag_metadata_months_endpoint.call_with_http_info(**kwargs) + def list_cost_tag_metadata_orchestrators( self, filter_month: str, diff --git a/src/datadog_api_client/v2/model/cost_tag_metadata_month.py b/src/datadog_api_client/v2/model/cost_tag_metadata_month.py new file mode 100644 index 0000000000..4289c4ec43 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_tag_metadata_month.py @@ -0,0 +1,46 @@ +# 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.cost_tag_metadata_month_type import CostTagMetadataMonthType + + +class CostTagMetadataMonth(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_tag_metadata_month_type import CostTagMetadataMonthType + + return { + "id": (str,), + "type": (CostTagMetadataMonthType,), + } + + attribute_map = { + "id": "id", + "type": "type", + } + + def __init__(self_, id: str, type: CostTagMetadataMonthType, **kwargs): + """ + A month that has Cloud Cost Management tag metadata available for a given provider. + + :param id: The month, in ``YYYY-MM`` format. + :type id: str + + :param type: Type of the Cloud Cost Management tag metadata month resource. + :type type: CostTagMetadataMonthType + """ + super().__init__(kwargs) + + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/cost_tag_metadata_month_type.py b/src/datadog_api_client/v2/model/cost_tag_metadata_month_type.py new file mode 100644 index 0000000000..3389c4d686 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_tag_metadata_month_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 CostTagMetadataMonthType(ModelSimple): + """ + Type of the Cloud Cost Management tag metadata month resource. + + :param value: If omitted defaults to "cost_tag_metadata_month". Must be one of ["cost_tag_metadata_month"]. + :type value: str + """ + + allowed_values = { + "cost_tag_metadata_month", + } + COST_TAG_METADATA_MONTH: ClassVar["CostTagMetadataMonthType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CostTagMetadataMonthType.COST_TAG_METADATA_MONTH = CostTagMetadataMonthType("cost_tag_metadata_month") diff --git a/src/datadog_api_client/v2/model/cost_tag_metadata_months_response.py b/src/datadog_api_client/v2/model/cost_tag_metadata_months_response.py new file mode 100644 index 0000000000..a1a70c72ce --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_tag_metadata_months_response.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 List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.cost_tag_metadata_month import CostTagMetadataMonth + + +class CostTagMetadataMonthsResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_tag_metadata_month import CostTagMetadataMonth + + return { + "data": ([CostTagMetadataMonth],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: List[CostTagMetadataMonth], **kwargs): + """ + List of months that have Cloud Cost Management tag metadata for the requested provider, ordered most-recent first and capped at 36 months. + + :param data: List of months that have tag metadata available. + :type data: [CostTagMetadataMonth] + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 304ac498cc..074fdd6826 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -1349,6 +1349,9 @@ from datadog_api_client.v2.model.cost_tag_key_type import CostTagKeyType from datadog_api_client.v2.model.cost_tag_keys_response import CostTagKeysResponse from datadog_api_client.v2.model.cost_tag_metadata_daily_filter import CostTagMetadataDailyFilter +from datadog_api_client.v2.model.cost_tag_metadata_month import CostTagMetadataMonth +from datadog_api_client.v2.model.cost_tag_metadata_month_type import CostTagMetadataMonthType +from datadog_api_client.v2.model.cost_tag_metadata_months_response import CostTagMetadataMonthsResponse from datadog_api_client.v2.model.cost_tag_type import CostTagType from datadog_api_client.v2.model.cost_tags_response import CostTagsResponse from datadog_api_client.v2.model.coverage_summary_attributes import CoverageSummaryAttributes @@ -9288,6 +9291,9 @@ "CostTagKeyType", "CostTagKeysResponse", "CostTagMetadataDailyFilter", + "CostTagMetadataMonth", + "CostTagMetadataMonthType", + "CostTagMetadataMonthsResponse", "CostTagType", "CostTagsResponse", "CoverageSummaryAttributes", diff --git a/tests/v2/features/cloud_cost_management.feature b/tests/v2/features/cloud_cost_management.feature index 17779e4599..b41928f4cb 100644 --- a/tests/v2/features/cloud_cost_management.feature +++ b/tests/v2/features/cloud_cost_management.feature @@ -606,6 +606,22 @@ Feature: Cloud Cost Management When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/cloud-cost-management + Scenario: List Cloud Cost Management tag metadata months returns "Bad Request" response + Given operation "ListCostTagMetadataMonths" enabled + And new "ListCostTagMetadataMonths" request + And request contains "filter[provider]" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/cloud-cost-management + Scenario: List Cloud Cost Management tag metadata months returns "OK" response + Given operation "ListCostTagMetadataMonths" enabled + And new "ListCostTagMetadataMonths" request + And request contains "filter[provider]" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/cloud-cost-management Scenario: List Cloud Cost Management tag sources returns "Bad Request" response Given operation "ListCostTagKeySources" enabled diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index c22b147298..7e0e3ceeb3 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -1898,6 +1898,12 @@ "type": "safe" } }, + "ListCostTagMetadataMonths": { + "tag": "Cloud Cost Management", + "undo": { + "type": "safe" + } + }, "ListCostTagMetadataOrchestrators": { "tag": "Cloud Cost Management", "undo": {