From f8210ce2c4a1ac64385f5ece6dc0fd19d81faa58 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 29 Jul 2026 17:41:49 +0000 Subject: [PATCH] Regenerate client from commit da9d282 of spec repo --- .generator/schemas/v2/openapi.yaml | 232 ++++++++++++++++++ docs/datadog_api_client.v2.model.rst | 42 ++++ .../CreateHistoricalMetricsConfiguration.py | 28 +++ .../DeleteHistoricalMetricsConfiguration.py | 14 ++ .../GetHistoricalMetricsConfiguration.py | 16 ++ src/datadog_api_client/configuration.py | 3 + src/datadog_api_client/v2/api/metrics_api.py | 127 ++++++++++ ...orical_metrics_configuration_attributes.py | 40 +++ ...rical_metrics_configuration_create_data.py | 46 ++++ ...al_metrics_configuration_create_request.py | 44 ++++ .../historical_metrics_configuration_data.py | 68 +++++ ...storical_metrics_configuration_response.py | 42 ++++ .../historical_metrics_configuration_type.py | 37 +++ src/datadog_api_client/v2/models/__init__.py | 18 ++ tests/v2/features/metrics.feature | 90 +++++++ tests/v2/features/undo.json | 25 ++ 16 files changed, 872 insertions(+) create mode 100644 examples/v2/metrics/CreateHistoricalMetricsConfiguration.py create mode 100644 examples/v2/metrics/DeleteHistoricalMetricsConfiguration.py create mode 100644 examples/v2/metrics/GetHistoricalMetricsConfiguration.py create mode 100644 src/datadog_api_client/v2/model/historical_metrics_configuration_attributes.py create mode 100644 src/datadog_api_client/v2/model/historical_metrics_configuration_create_data.py create mode 100644 src/datadog_api_client/v2/model/historical_metrics_configuration_create_request.py create mode 100644 src/datadog_api_client/v2/model/historical_metrics_configuration_data.py create mode 100644 src/datadog_api_client/v2/model/historical_metrics_configuration_response.py create mode 100644 src/datadog_api_client/v2/model/historical_metrics_configuration_type.py diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 528e531d42..5a96a02158 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -44866,6 +44866,66 @@ components: type: $ref: "#/components/schemas/HistoricalJobDataType" type: object + HistoricalMetricsConfigurationAttributes: + description: Attributes of a historical metrics configuration. + properties: + created_at: + description: Timestamp when historical metrics ingestion was enabled for the metric. + example: "2024-01-15T12:00:00.000Z" + format: date-time + readOnly: true + type: string + type: object + HistoricalMetricsConfigurationCreateData: + description: Data object for enabling historical metrics ingestion for a metric. + properties: + id: + description: The metric name, used as the resource ID. + example: dd.test.metric + type: string + type: + $ref: "#/components/schemas/HistoricalMetricsConfigurationType" + required: + - id + - type + type: object + HistoricalMetricsConfigurationCreateRequest: + description: Request body for enabling historical metrics ingestion for a metric. + properties: + data: + $ref: "#/components/schemas/HistoricalMetricsConfigurationCreateData" + required: + - data + type: object + HistoricalMetricsConfigurationData: + description: >- + A historical metrics configuration resource object. Existence of this resource means historical metrics ingestion is enabled for the metric; there is no separate enabled attribute. + properties: + attributes: + $ref: "#/components/schemas/HistoricalMetricsConfigurationAttributes" + id: + description: The metric name, used as the resource ID. + example: dd.test.metric + type: string + type: + $ref: "#/components/schemas/HistoricalMetricsConfigurationType" + type: object + HistoricalMetricsConfigurationResponse: + description: Response containing a historical metrics configuration. + properties: + data: + $ref: "#/components/schemas/HistoricalMetricsConfigurationData" + readOnly: true + type: object + HistoricalMetricsConfigurationType: + default: historical_metrics_configurations + description: The historical metrics configuration resource type. + enum: + - historical_metrics_configurations + example: historical_metrics_configurations + type: string + x-enum-varnames: + - HISTORICAL_METRICS_CONFIGURATIONS HourlyUsage: description: Hourly usage for a product family for an org. properties: @@ -159552,6 +159612,178 @@ paths: permissions: - metric_tags_write x-sunset: "2027-01-01" + /api/v2/metrics/historical-metrics-configurations: + post: + description: |- + Enable historical metrics ingestion (late data ingestion) for a metric. Idempotent: + enabling an already-enabled metric returns 200 instead of 201. Not supported for + distribution metrics, metrics with an existing tag configuration, or most standard + (non-custom) metrics. + operationId: CreateHistoricalMetricsConfiguration + requestBody: + content: + application/json: + examples: + default: + value: + data: + id: dd.test.metric + type: historical_metrics_configurations + schema: + $ref: "#/components/schemas/HistoricalMetricsConfigurationCreateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-15T12:00:00.000Z" + id: dd.test.metric + type: historical_metrics_configurations + schema: + $ref: "#/components/schemas/HistoricalMetricsConfigurationResponse" + description: OK + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-15T12:00:00.000Z" + id: dd.test.metric + type: historical_metrics_configurations + schema: + $ref: "#/components/schemas/HistoricalMetricsConfigurationResponse" + description: Created + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "422": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unprocessable Entity + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - late_metrics_config_write + summary: Enable historical metrics ingestion + tags: + - Metrics + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - late_metrics_config_write + 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/metrics/historical-metrics-configurations/{metric_name}: + delete: + description: |- + Disable historical metrics ingestion for a metric. Idempotent: always returns 204, + whether or not the configuration existed or the metric itself still exists, so that + Terraform destroy succeeds for a metric removed out-of-band. + operationId: DeleteHistoricalMetricsConfiguration + parameters: + - $ref: "#/components/parameters/MetricName" + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - late_metrics_config_write + summary: Delete a historical metrics configuration + tags: + - Metrics + "x-permission": + operator: OR + permissions: + - late_metrics_config_write + 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: |- + Get the historical metrics ingestion configuration for a metric. Existence of the + resource means historical metrics ingestion is enabled; returns 404 when it is not + enabled for the metric. + operationId: GetHistoricalMetricsConfiguration + parameters: + - $ref: "#/components/parameters/MetricName" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-15T12:00:00.000Z" + id: dd.test.metric + type: historical_metrics_configurations + schema: + $ref: "#/components/schemas/HistoricalMetricsConfigurationResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - metrics_read + summary: Get a historical metrics configuration + tags: + - Metrics + "x-permission": + operator: OR + permissions: + - metrics_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/metrics/tag-indexing-rules: get: description: List tag indexing rules for an org, sorted by `rule_order`, with offset/limit pagination. diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 23d3cc34b8..ed01cba9e9 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -17952,6 +17952,48 @@ datadog\_api\_client.v2.model.historical\_job\_response\_data module :members: :show-inheritance: +datadog\_api\_client.v2.model.historical\_metrics\_configuration\_attributes module +----------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.historical_metrics_configuration_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.historical\_metrics\_configuration\_create\_data module +------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.historical_metrics_configuration_create_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.historical\_metrics\_configuration\_create\_request module +---------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.historical_metrics_configuration_create_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.historical\_metrics\_configuration\_data module +----------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.historical_metrics_configuration_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.historical\_metrics\_configuration\_response module +--------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.historical_metrics_configuration_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.historical\_metrics\_configuration\_type module +----------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.historical_metrics_configuration_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.hourly\_usage module -------------------------------------------------- diff --git a/examples/v2/metrics/CreateHistoricalMetricsConfiguration.py b/examples/v2/metrics/CreateHistoricalMetricsConfiguration.py new file mode 100644 index 0000000000..ff02779ef8 --- /dev/null +++ b/examples/v2/metrics/CreateHistoricalMetricsConfiguration.py @@ -0,0 +1,28 @@ +""" +Enable historical metrics ingestion returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.metrics_api import MetricsApi +from datadog_api_client.v2.model.historical_metrics_configuration_create_data import ( + HistoricalMetricsConfigurationCreateData, +) +from datadog_api_client.v2.model.historical_metrics_configuration_create_request import ( + HistoricalMetricsConfigurationCreateRequest, +) +from datadog_api_client.v2.model.historical_metrics_configuration_type import HistoricalMetricsConfigurationType + +body = HistoricalMetricsConfigurationCreateRequest( + data=HistoricalMetricsConfigurationCreateData( + id="dd.test.metric", + type=HistoricalMetricsConfigurationType.HISTORICAL_METRICS_CONFIGURATIONS, + ), +) + +configuration = Configuration() +configuration.unstable_operations["create_historical_metrics_configuration"] = True +with ApiClient(configuration) as api_client: + api_instance = MetricsApi(api_client) + response = api_instance.create_historical_metrics_configuration(body=body) + + print(response) diff --git a/examples/v2/metrics/DeleteHistoricalMetricsConfiguration.py b/examples/v2/metrics/DeleteHistoricalMetricsConfiguration.py new file mode 100644 index 0000000000..984a544616 --- /dev/null +++ b/examples/v2/metrics/DeleteHistoricalMetricsConfiguration.py @@ -0,0 +1,14 @@ +""" +Delete a historical metrics configuration returns "No Content" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.metrics_api import MetricsApi + +configuration = Configuration() +configuration.unstable_operations["delete_historical_metrics_configuration"] = True +with ApiClient(configuration) as api_client: + api_instance = MetricsApi(api_client) + api_instance.delete_historical_metrics_configuration( + metric_name="metric_name", + ) diff --git a/examples/v2/metrics/GetHistoricalMetricsConfiguration.py b/examples/v2/metrics/GetHistoricalMetricsConfiguration.py new file mode 100644 index 0000000000..51e6aaf723 --- /dev/null +++ b/examples/v2/metrics/GetHistoricalMetricsConfiguration.py @@ -0,0 +1,16 @@ +""" +Get a historical metrics configuration returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.metrics_api import MetricsApi + +configuration = Configuration() +configuration.unstable_operations["get_historical_metrics_configuration"] = True +with ApiClient(configuration) as api_client: + api_instance = MetricsApi(api_client) + response = api_instance.get_historical_metrics_configuration( + metric_name="metric_name", + ) + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index 2845db8c13..dda7661cf2 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -610,10 +610,13 @@ def __init__( "v2.remove_role_from_restriction_query": False, "v2.replace_restriction_query": False, "v2.update_restriction_query": False, + "v2.create_historical_metrics_configuration": False, "v2.create_tag_indexing_rule": False, "v2.create_tag_indexing_rule_exemption": False, + "v2.delete_historical_metrics_configuration": False, "v2.delete_tag_indexing_rule": False, "v2.delete_tag_indexing_rule_exemption": False, + "v2.get_historical_metrics_configuration": False, "v2.get_tag_indexing_rule": False, "v2.get_tag_indexing_rule_exemption": False, "v2.list_tag_indexing_rules": False, diff --git a/src/datadog_api_client/v2/api/metrics_api.py b/src/datadog_api_client/v2/api/metrics_api.py index 1433acb490..4f59123f0d 100644 --- a/src/datadog_api_client/v2/api/metrics_api.py +++ b/src/datadog_api_client/v2/api/metrics_api.py @@ -25,6 +25,10 @@ from datadog_api_client.v2.model.metric_bulk_tag_config_response import MetricBulkTagConfigResponse from datadog_api_client.v2.model.metric_bulk_tag_config_delete_request import MetricBulkTagConfigDeleteRequest from datadog_api_client.v2.model.metric_bulk_tag_config_create_request import MetricBulkTagConfigCreateRequest +from datadog_api_client.v2.model.historical_metrics_configuration_response import HistoricalMetricsConfigurationResponse +from datadog_api_client.v2.model.historical_metrics_configuration_create_request import ( + HistoricalMetricsConfigurationCreateRequest, +) from datadog_api_client.v2.model.tag_indexing_rules_response import TagIndexingRulesResponse from datadog_api_client.v2.model.tag_indexing_rule_response import TagIndexingRuleResponse from datadog_api_client.v2.model.tag_indexing_rule_create_request import TagIndexingRuleCreateRequest @@ -96,6 +100,26 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._create_historical_metrics_configuration_endpoint = _Endpoint( + settings={ + "response_type": (HistoricalMetricsConfigurationResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/metrics/historical-metrics-configurations", + "operation_id": "create_historical_metrics_configuration", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (HistoricalMetricsConfigurationCreateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._create_tag_configuration_endpoint = _Endpoint( settings={ "response_type": (MetricTagConfigurationResponse,), @@ -188,6 +212,29 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._delete_historical_metrics_configuration_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/metrics/historical-metrics-configurations/{metric_name}", + "operation_id": "delete_historical_metrics_configuration", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "metric_name": { + "required": True, + "openapi_types": (str,), + "attribute": "metric_name", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + self._delete_tag_configuration_endpoint = _Endpoint( settings={ "response_type": None, @@ -315,6 +362,29 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._get_historical_metrics_configuration_endpoint = _Endpoint( + settings={ + "response_type": (HistoricalMetricsConfigurationResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/metrics/historical-metrics-configurations/{metric_name}", + "operation_id": "get_historical_metrics_configuration", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "metric_name": { + "required": True, + "openapi_types": (str,), + "attribute": "metric_name", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._get_metric_tag_cardinality_details_endpoint = _Endpoint( settings={ "response_type": (MetricTagCardinalitiesResponse,), @@ -859,6 +929,25 @@ def create_bulk_tags_metrics_configuration( warnings.warn("create_bulk_tags_metrics_configuration is deprecated", DeprecationWarning, stacklevel=2) return self._create_bulk_tags_metrics_configuration_endpoint.call_with_http_info(**kwargs) + def create_historical_metrics_configuration( + self, + body: HistoricalMetricsConfigurationCreateRequest, + ) -> HistoricalMetricsConfigurationResponse: + """Enable historical metrics ingestion. + + Enable historical metrics ingestion (late data ingestion) for a metric. Idempotent: + enabling an already-enabled metric returns 200 instead of 201. Not supported for + distribution metrics, metrics with an existing tag configuration, or most standard + (non-custom) metrics. + + :type body: HistoricalMetricsConfigurationCreateRequest + :rtype: HistoricalMetricsConfigurationResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._create_historical_metrics_configuration_endpoint.call_with_http_info(**kwargs) + def create_tag_configuration( self, metric_name: str, @@ -946,6 +1035,25 @@ def delete_bulk_tags_metrics_configuration( warnings.warn("delete_bulk_tags_metrics_configuration is deprecated", DeprecationWarning, stacklevel=2) return self._delete_bulk_tags_metrics_configuration_endpoint.call_with_http_info(**kwargs) + def delete_historical_metrics_configuration( + self, + metric_name: str, + ) -> None: + """Delete a historical metrics configuration. + + Disable historical metrics ingestion for a metric. Idempotent: always returns 204, + whether or not the configuration existed or the metric itself still exists, so that + Terraform destroy succeeds for a metric removed out-of-band. + + :param metric_name: The name of the metric. + :type metric_name: str + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["metric_name"] = metric_name + + return self._delete_historical_metrics_configuration_endpoint.call_with_http_info(**kwargs) + def delete_tag_configuration( self, metric_name: str, @@ -1051,6 +1159,25 @@ def estimate_metrics_output_series( return self._estimate_metrics_output_series_endpoint.call_with_http_info(**kwargs) + def get_historical_metrics_configuration( + self, + metric_name: str, + ) -> HistoricalMetricsConfigurationResponse: + """Get a historical metrics configuration. + + Get the historical metrics ingestion configuration for a metric. Existence of the + resource means historical metrics ingestion is enabled; returns 404 when it is not + enabled for the metric. + + :param metric_name: The name of the metric. + :type metric_name: str + :rtype: HistoricalMetricsConfigurationResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["metric_name"] = metric_name + + return self._get_historical_metrics_configuration_endpoint.call_with_http_info(**kwargs) + def get_metric_tag_cardinality_details( self, metric_name: str, diff --git a/src/datadog_api_client/v2/model/historical_metrics_configuration_attributes.py b/src/datadog_api_client/v2/model/historical_metrics_configuration_attributes.py new file mode 100644 index 0000000000..a4562c67d7 --- /dev/null +++ b/src/datadog_api_client/v2/model/historical_metrics_configuration_attributes.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 Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + unset, + UnsetType, +) + + +class HistoricalMetricsConfigurationAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "created_at": (datetime,), + } + + attribute_map = { + "created_at": "created_at", + } + read_only_vars = { + "created_at", + } + + def __init__(self_, created_at: Union[datetime, UnsetType] = unset, **kwargs): + """ + Attributes of a historical metrics configuration. + + :param created_at: Timestamp when historical metrics ingestion was enabled for the metric. + :type created_at: datetime, optional + """ + if created_at is not unset: + kwargs["created_at"] = created_at + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/historical_metrics_configuration_create_data.py b/src/datadog_api_client/v2/model/historical_metrics_configuration_create_data.py new file mode 100644 index 0000000000..a43d6f5a8c --- /dev/null +++ b/src/datadog_api_client/v2/model/historical_metrics_configuration_create_data.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.historical_metrics_configuration_type import HistoricalMetricsConfigurationType + + +class HistoricalMetricsConfigurationCreateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.historical_metrics_configuration_type import HistoricalMetricsConfigurationType + + return { + "id": (str,), + "type": (HistoricalMetricsConfigurationType,), + } + + attribute_map = { + "id": "id", + "type": "type", + } + + def __init__(self_, id: str, type: HistoricalMetricsConfigurationType, **kwargs): + """ + Data object for enabling historical metrics ingestion for a metric. + + :param id: The metric name, used as the resource ID. + :type id: str + + :param type: The historical metrics configuration resource type. + :type type: HistoricalMetricsConfigurationType + """ + super().__init__(kwargs) + + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/historical_metrics_configuration_create_request.py b/src/datadog_api_client/v2/model/historical_metrics_configuration_create_request.py new file mode 100644 index 0000000000..587db94962 --- /dev/null +++ b/src/datadog_api_client/v2/model/historical_metrics_configuration_create_request.py @@ -0,0 +1,44 @@ +# 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.historical_metrics_configuration_create_data import ( + HistoricalMetricsConfigurationCreateData, + ) + + +class HistoricalMetricsConfigurationCreateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.historical_metrics_configuration_create_data import ( + HistoricalMetricsConfigurationCreateData, + ) + + return { + "data": (HistoricalMetricsConfigurationCreateData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: HistoricalMetricsConfigurationCreateData, **kwargs): + """ + Request body for enabling historical metrics ingestion for a metric. + + :param data: Data object for enabling historical metrics ingestion for a metric. + :type data: HistoricalMetricsConfigurationCreateData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/historical_metrics_configuration_data.py b/src/datadog_api_client/v2/model/historical_metrics_configuration_data.py new file mode 100644 index 0000000000..7f1ea92eb7 --- /dev/null +++ b/src/datadog_api_client/v2/model/historical_metrics_configuration_data.py @@ -0,0 +1,68 @@ +# 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 Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.historical_metrics_configuration_attributes import ( + HistoricalMetricsConfigurationAttributes, + ) + from datadog_api_client.v2.model.historical_metrics_configuration_type import HistoricalMetricsConfigurationType + + +class HistoricalMetricsConfigurationData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.historical_metrics_configuration_attributes import ( + HistoricalMetricsConfigurationAttributes, + ) + from datadog_api_client.v2.model.historical_metrics_configuration_type import HistoricalMetricsConfigurationType + + return { + "attributes": (HistoricalMetricsConfigurationAttributes,), + "id": (str,), + "type": (HistoricalMetricsConfigurationType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: Union[HistoricalMetricsConfigurationAttributes, UnsetType] = unset, + id: Union[str, UnsetType] = unset, + type: Union[HistoricalMetricsConfigurationType, UnsetType] = unset, + **kwargs, + ): + """ + A historical metrics configuration resource object. Existence of this resource means historical metrics ingestion is enabled for the metric; there is no separate enabled attribute. + + :param attributes: Attributes of a historical metrics configuration. + :type attributes: HistoricalMetricsConfigurationAttributes, optional + + :param id: The metric name, used as the resource ID. + :type id: str, optional + + :param type: The historical metrics configuration resource type. + :type type: HistoricalMetricsConfigurationType, optional + """ + if attributes is not unset: + kwargs["attributes"] = attributes + if id is not unset: + kwargs["id"] = id + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/historical_metrics_configuration_response.py b/src/datadog_api_client/v2/model/historical_metrics_configuration_response.py new file mode 100644 index 0000000000..5e6cd206aa --- /dev/null +++ b/src/datadog_api_client/v2/model/historical_metrics_configuration_response.py @@ -0,0 +1,42 @@ +# 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 Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.historical_metrics_configuration_data import HistoricalMetricsConfigurationData + + +class HistoricalMetricsConfigurationResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.historical_metrics_configuration_data import HistoricalMetricsConfigurationData + + return { + "data": (HistoricalMetricsConfigurationData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[HistoricalMetricsConfigurationData, UnsetType] = unset, **kwargs): + """ + Response containing a historical metrics configuration. + + :param data: A historical metrics configuration resource object. Existence of this resource means historical metrics ingestion is enabled for the metric; there is no separate enabled attribute. + :type data: HistoricalMetricsConfigurationData, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/historical_metrics_configuration_type.py b/src/datadog_api_client/v2/model/historical_metrics_configuration_type.py new file mode 100644 index 0000000000..732d2c30e6 --- /dev/null +++ b/src/datadog_api_client/v2/model/historical_metrics_configuration_type.py @@ -0,0 +1,37 @@ +# 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 HistoricalMetricsConfigurationType(ModelSimple): + """ + The historical metrics configuration resource type. + + :param value: If omitted defaults to "historical_metrics_configurations". Must be one of ["historical_metrics_configurations"]. + :type value: str + """ + + allowed_values = { + "historical_metrics_configurations", + } + HISTORICAL_METRICS_CONFIGURATIONS: ClassVar["HistoricalMetricsConfigurationType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +HistoricalMetricsConfigurationType.HISTORICAL_METRICS_CONFIGURATIONS = HistoricalMetricsConfigurationType( + "historical_metrics_configurations" +) diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 8a861f6dd6..600dfe386d 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -3366,6 +3366,18 @@ from datadog_api_client.v2.model.historical_job_response import HistoricalJobResponse from datadog_api_client.v2.model.historical_job_response_attributes import HistoricalJobResponseAttributes from datadog_api_client.v2.model.historical_job_response_data import HistoricalJobResponseData +from datadog_api_client.v2.model.historical_metrics_configuration_attributes import ( + HistoricalMetricsConfigurationAttributes, +) +from datadog_api_client.v2.model.historical_metrics_configuration_create_data import ( + HistoricalMetricsConfigurationCreateData, +) +from datadog_api_client.v2.model.historical_metrics_configuration_create_request import ( + HistoricalMetricsConfigurationCreateRequest, +) +from datadog_api_client.v2.model.historical_metrics_configuration_data import HistoricalMetricsConfigurationData +from datadog_api_client.v2.model.historical_metrics_configuration_response import HistoricalMetricsConfigurationResponse +from datadog_api_client.v2.model.historical_metrics_configuration_type import HistoricalMetricsConfigurationType from datadog_api_client.v2.model.hourly_usage import HourlyUsage from datadog_api_client.v2.model.hourly_usage_attributes import HourlyUsageAttributes from datadog_api_client.v2.model.hourly_usage_measurement import HourlyUsageMeasurement @@ -12606,6 +12618,12 @@ "HistoricalJobResponse", "HistoricalJobResponseAttributes", "HistoricalJobResponseData", + "HistoricalMetricsConfigurationAttributes", + "HistoricalMetricsConfigurationCreateData", + "HistoricalMetricsConfigurationCreateRequest", + "HistoricalMetricsConfigurationData", + "HistoricalMetricsConfigurationResponse", + "HistoricalMetricsConfigurationType", "HourlyUsage", "HourlyUsageAttributes", "HourlyUsageMeasurement", diff --git a/tests/v2/features/metrics.feature b/tests/v2/features/metrics.feature index d463aa4250..30517072c6 100644 --- a/tests/v2/features/metrics.feature +++ b/tests/v2/features/metrics.feature @@ -142,6 +142,24 @@ Feature: Metrics When the request is sent Then the response status is 400 Bad Request + @generated @skip @team:DataDog/metrics-experience + Scenario: Delete a historical metrics configuration returns "Bad Request" response + Given a valid "appKeyAuth" key in the system + And operation "DeleteHistoricalMetricsConfiguration" enabled + And new "DeleteHistoricalMetricsConfiguration" request + And request contains "metric_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/metrics-experience + Scenario: Delete a historical metrics configuration returns "No Content" response + Given a valid "appKeyAuth" key in the system + And operation "DeleteHistoricalMetricsConfiguration" enabled + And new "DeleteHistoricalMetricsConfiguration" request + And request contains "metric_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + @replay-only @skip-validation @team:DataDog/metrics-experience Scenario: Delete a tag configuration returns "No Content" response Given there is a valid "metric" in the system @@ -221,6 +239,78 @@ Feature: Metrics When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/metrics-experience + Scenario: Enable historical metrics ingestion returns "Bad Request" response + Given a valid "appKeyAuth" key in the system + And operation "CreateHistoricalMetricsConfiguration" enabled + And new "CreateHistoricalMetricsConfiguration" request + And body with value {"data": {"id": "dd.test.metric", "type": "historical_metrics_configurations"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/metrics-experience + Scenario: Enable historical metrics ingestion returns "Created" response + Given a valid "appKeyAuth" key in the system + And operation "CreateHistoricalMetricsConfiguration" enabled + And new "CreateHistoricalMetricsConfiguration" request + And body with value {"data": {"id": "dd.test.metric", "type": "historical_metrics_configurations"}} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:DataDog/metrics-experience + Scenario: Enable historical metrics ingestion returns "Not Found" response + Given a valid "appKeyAuth" key in the system + And operation "CreateHistoricalMetricsConfiguration" enabled + And new "CreateHistoricalMetricsConfiguration" request + And body with value {"data": {"id": "dd.test.metric", "type": "historical_metrics_configurations"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/metrics-experience + Scenario: Enable historical metrics ingestion returns "OK" response + Given a valid "appKeyAuth" key in the system + And operation "CreateHistoricalMetricsConfiguration" enabled + And new "CreateHistoricalMetricsConfiguration" request + And body with value {"data": {"id": "dd.test.metric", "type": "historical_metrics_configurations"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/metrics-experience + Scenario: Enable historical metrics ingestion returns "Unprocessable Entity" response + Given a valid "appKeyAuth" key in the system + And operation "CreateHistoricalMetricsConfiguration" enabled + And new "CreateHistoricalMetricsConfiguration" request + And body with value {"data": {"id": "dd.test.metric", "type": "historical_metrics_configurations"}} + When the request is sent + Then the response status is 422 Unprocessable Entity + + @generated @skip @team:DataDog/metrics-experience + Scenario: Get a historical metrics configuration returns "Bad Request" response + Given a valid "appKeyAuth" key in the system + And operation "GetHistoricalMetricsConfiguration" enabled + And new "GetHistoricalMetricsConfiguration" request + And request contains "metric_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/metrics-experience + Scenario: Get a historical metrics configuration returns "Not Found" response + Given a valid "appKeyAuth" key in the system + And operation "GetHistoricalMetricsConfiguration" enabled + And new "GetHistoricalMetricsConfiguration" request + And request contains "metric_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/metrics-experience + Scenario: Get a historical metrics configuration returns "OK" response + Given a valid "appKeyAuth" key in the system + And operation "GetHistoricalMetricsConfiguration" enabled + And new "GetHistoricalMetricsConfiguration" request + And request contains "metric_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/metrics-experience Scenario: Get a list of metrics returns "Bad Request" response Given a valid "appKeyAuth" key in the system diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 2a7fb64a0a..f6d33436a5 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -5154,6 +5154,31 @@ "type": "unsafe" } }, + "CreateHistoricalMetricsConfiguration": { + "tag": "Metrics", + "undo": { + "operationId": "DeleteHistoricalMetricsConfiguration", + "parameters": [ + { + "name": "metric_name", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteHistoricalMetricsConfiguration": { + "tag": "Metrics", + "undo": { + "type": "idempotent" + } + }, + "GetHistoricalMetricsConfiguration": { + "tag": "Metrics", + "undo": { + "type": "safe" + } + }, "ListTagIndexingRules": { "tag": "Metrics", "undo": {