diff --git a/.generated-info b/.generated-info index 72848a33ac..8ca607db63 100644 --- a/.generated-info +++ b/.generated-info @@ -1,4 +1,4 @@ { - "spec_repo_commit": "df31e44", - "generated": "2025-07-28 19:54:45.232" + "spec_repo_commit": "2f91666", + "generated": "2025-07-29 21:54:45.402" } diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index c26c8055f8..b4dff0ae8d 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -12939,6 +12939,42 @@ components: description: The type of the resource. The value should always be device. type: string type: object + DnsMetricKey: + description: The metric key for DNS metrics. + enum: + - dns_total_requests + - dns_failures + - dns_successful_responses + - dns_failed_responses + - dns_timeouts + - dns_responses.nxdomain + - dns_responses.servfail + - dns_responses.other + - dns_success_latency_percentile + - dns_failure_latency_percentile + type: string + x-enum-descriptions: + - The total number of DNS requests made by the client. + - The total number of timeouts and errors in DNS requests. + - The total number of successful DNS responses. + - The total number of failed DNS responses. + - The total number of DNS timeouts. + - The total number of DNS responses with the NXDOMAIN error code. + - The total number of DNS responses with the SERVFAIL error code. + - The total number of DNS responses with other error codes. + - The latency percentile for successful DNS responses. + - The latency percentile for failed DNS responses. + x-enum-varnames: + - DNS_TOTAL_REQUESTS + - DNS_FAILURES + - DNS_SUCCESSFUL_RESPONSES + - DNS_FAILED_RESPONSES + - DNS_TIMEOUTS + - DNS_RESPONSES_NXDOMAIN + - DNS_RESPONSES_SERVFAIL + - DNS_RESPONSES_OTHER + - DNS_SUCCESS_LATENCY_PERCENTILE + - DNS_FAILURE_LATENCY_PERCENTILE DomainAllowlist: description: The email domain allowlist for an org. properties: @@ -38433,6 +38469,100 @@ components: type: string x-enum-varnames: - AGGREGATED_CONNECTION + SingleAggregatedDnsResponseArray: + description: List of aggregated DNS flows. + example: + data: + - attributes: + group_bys: + - key: client_service + value: example-service + - key: network.dns_query + value: example.com + metrics: + - key: dns_total_requests + value: 100 + - key: dns_failures + value: 7 + - key: dns_successful_responses + value: 93 + - key: dns_failed_responses + value: 5 + - key: dns_timeouts + value: 2 + - key: dns_responses.nxdomain + value: 1 + - key: dns_responses.servfail + value: 1 + - key: dns_responses.other + value: 3 + - key: dns_success_latency_percentile + value: 50 + - key: dns_failure_latency_percentile + value: 75 + id: client_service:example-service,network.dns_query:example.com + type: aggregated_dns + properties: + data: + description: Array of aggregated DNS objects. + items: + $ref: '#/components/schemas/SingleAggregatedDnsResponseData' + type: array + type: object + SingleAggregatedDnsResponseData: + description: Object describing an aggregated DNS flow. + properties: + attributes: + $ref: '#/components/schemas/SingleAggregatedDnsResponseDataAttributes' + id: + description: A unique identifier for the aggregated DNS traffic based on + the group by values. + type: string + type: + $ref: '#/components/schemas/SingleAggregatedDnsResponseDataType' + type: object + SingleAggregatedDnsResponseDataAttributes: + description: Attributes for an aggregated DNS flow. + properties: + group_bys: + description: The key, value pairs for each group by. + items: + $ref: '#/components/schemas/SingleAggregatedDnsResponseDataAttributesGroupByItems' + type: array + metrics: + description: Metrics associated with an aggregated DNS flow. + items: + $ref: '#/components/schemas/SingleAggregatedDnsResponseDataAttributesMetricsItems' + type: array + type: object + SingleAggregatedDnsResponseDataAttributesGroupByItems: + description: Attributes associated with a group by + properties: + key: + description: The group by key. + type: string + value: + description: The group by value. + type: string + type: object + SingleAggregatedDnsResponseDataAttributesMetricsItems: + description: Metrics associated with an aggregated DNS flow. + properties: + key: + $ref: '#/components/schemas/DnsMetricKey' + value: + description: The metric value. + format: int64 + type: integer + type: object + SingleAggregatedDnsResponseDataType: + default: aggregated_dns + description: Aggregated DNS resource type. + enum: + - aggregated_dns + type: string + x-enum-varnames: + - AGGREGATED_DNS SlackIntegrationMetadata: description: Incident integration metadata for the Slack integration. properties: @@ -55093,7 +55223,7 @@ paths: schema: type: string - description: The number of connections to be returned. The maximum value is - 7500. + 7500. The default is 100. in: query name: limit schema: @@ -55119,6 +55249,69 @@ paths: x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/network/dns/aggregate: + get: + description: Get all aggregated DNS traffic. + operationId: GetAggregatedDns + parameters: + - description: Unix timestamp (number of seconds since epoch) of the start of + the query window. If not provided, the start of the query window is 15 minutes + before the `to` timestamp. If neither `from` nor `to` are provided, the + query window is `[now - 15m, now]`. + in: query + name: from + schema: + format: int64 + type: integer + - description: Unix timestamp (number of seconds since epoch) of the end of + the query window. If not provided, the end of the query window is the current + time. If neither `from` nor `to` are provided, the query window is `[now + - 15m, now]`. + in: query + name: to + schema: + format: int64 + type: integer + - description: Comma-separated list of fields to group DNS traffic by. The server + side defaults to `network.dns_query` if unspecified. `server_ungrouped` + may be used if groups are not desired. The maximum number of group_by(s) + is 10. + in: query + name: group_by + schema: + type: string + - description: Comma-separated list of tags to filter DNS traffic by. + in: query + name: tags + schema: + type: string + - description: The number of aggregated DNS entries to be returned. The maximum + value is 7500. The default is 100. + in: query + name: limit + schema: + default: 100 + format: int32 + maximum: 7500 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SingleAggregatedDnsResponseArray' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get all aggregated DNS traffic + tags: + - Cloud Network Monitoring + x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/on-call/escalation-policies: post: description: Create a new On-Call escalation policy @@ -65906,7 +66099,8 @@ tags: documentation](https://docs.datadoghq.com/cloud_cost_management/). name: Cloud Cost Management - description: The Cloud Network Monitoring API allows you to fetch aggregated connections - and their attributes. See the [Cloud Network Monitoring page](https://docs.datadoghq.com/network_monitoring/cloud_network_monitoring/) + and DNS traffic with their attributes. See the [Cloud Network Monitoring page](https://docs.datadoghq.com/network_monitoring/cloud_network_monitoring/) + and [DNS Monitoring page](https://docs.datadoghq.com/network_monitoring/dns/) for more information. name: Cloud Network Monitoring - description: Manage your Datadog Cloudflare integration directly through the Datadog diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 1354b7d7a6..ebf63a2785 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -4981,6 +4981,13 @@ datadog\_api\_client.v2.model.devices\_list\_data module :members: :show-inheritance: +datadog\_api\_client.v2.model.dns\_metric\_key module +----------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.dns_metric_key + :members: + :show-inheritance: + datadog\_api\_client.v2.model.domain\_allowlist module ------------------------------------------------------ @@ -16559,6 +16566,48 @@ datadog\_api\_client.v2.model.single\_aggregated\_connection\_response\_data\_ty :members: :show-inheritance: +datadog\_api\_client.v2.model.single\_aggregated\_dns\_response\_array module +----------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.single_aggregated_dns_response_array + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.single\_aggregated\_dns\_response\_data module +---------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.single_aggregated_dns_response_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.single\_aggregated\_dns\_response\_data\_attributes module +---------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.single_aggregated_dns_response_data_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.single\_aggregated\_dns\_response\_data\_attributes\_group\_by\_items module +---------------------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.single_aggregated_dns_response_data_attributes_group_by_items + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.single\_aggregated\_dns\_response\_data\_attributes\_metrics\_items module +-------------------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.single_aggregated_dns_response_data_attributes_metrics_items + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.single\_aggregated\_dns\_response\_data\_type module +---------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.single_aggregated_dns_response_data_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.slack\_integration\_metadata module ----------------------------------------------------------------- diff --git a/examples/v2/cloud-network-monitoring/GetAggregatedDns.py b/examples/v2/cloud-network-monitoring/GetAggregatedDns.py new file mode 100644 index 0000000000..7127e75f7f --- /dev/null +++ b/examples/v2/cloud-network-monitoring/GetAggregatedDns.py @@ -0,0 +1,14 @@ +""" +Get all aggregated DNS traffic returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.cloud_network_monitoring_api import CloudNetworkMonitoringApi + +configuration = Configuration() +configuration.unstable_operations["get_aggregated_dns"] = True +with ApiClient(configuration) as api_client: + api_instance = CloudNetworkMonitoringApi(api_client) + response = api_instance.get_aggregated_dns() + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index 03fb2a5256..4fdc8a8d41 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -297,6 +297,7 @@ def __init__( "v2.validate_existing_monitor_user_template": False, "v2.validate_monitor_user_template": False, "v2.get_aggregated_connections": False, + "v2.get_aggregated_dns": False, "v2.create_pipeline": False, "v2.delete_pipeline": False, "v2.get_pipeline": False, diff --git a/src/datadog_api_client/v2/api/cloud_network_monitoring_api.py b/src/datadog_api_client/v2/api/cloud_network_monitoring_api.py index bbde03940e..b3c44ff660 100644 --- a/src/datadog_api_client/v2/api/cloud_network_monitoring_api.py +++ b/src/datadog_api_client/v2/api/cloud_network_monitoring_api.py @@ -14,11 +14,12 @@ from datadog_api_client.v2.model.single_aggregated_connection_response_array import ( SingleAggregatedConnectionResponseArray, ) +from datadog_api_client.v2.model.single_aggregated_dns_response_array import SingleAggregatedDnsResponseArray class CloudNetworkMonitoringApi: """ - The Cloud Network Monitoring API allows you to fetch aggregated connections and their attributes. See the `Cloud Network Monitoring page `_ for more information. + The Cloud Network Monitoring API allows you to fetch aggregated connections and DNS traffic with their attributes. See the `Cloud Network Monitoring page `_ and `DNS Monitoring page `_ for more information. """ def __init__(self, api_client=None): @@ -72,6 +73,52 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._get_aggregated_dns_endpoint = _Endpoint( + settings={ + "response_type": (SingleAggregatedDnsResponseArray,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/network/dns/aggregate", + "operation_id": "get_aggregated_dns", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "_from": { + "openapi_types": (int,), + "attribute": "from", + "location": "query", + }, + "to": { + "openapi_types": (int,), + "attribute": "to", + "location": "query", + }, + "group_by": { + "openapi_types": (str,), + "attribute": "group_by", + "location": "query", + }, + "tags": { + "openapi_types": (str,), + "attribute": "tags", + "location": "query", + }, + "limit": { + "validation": { + "inclusive_maximum": 7500, + "inclusive_minimum": 1, + }, + "openapi_types": (int,), + "attribute": "limit", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + def get_aggregated_connections( self, *, @@ -93,7 +140,7 @@ def get_aggregated_connections( :type group_by: str, optional :param tags: Comma-separated list of tags to filter connections by. :type tags: str, optional - :param limit: The number of connections to be returned. The maximum value is 7500. + :param limit: The number of connections to be returned. The maximum value is 7500. The default is 100. :type limit: int, optional :rtype: SingleAggregatedConnectionResponseArray """ @@ -114,3 +161,46 @@ def get_aggregated_connections( kwargs["limit"] = limit return self._get_aggregated_connections_endpoint.call_with_http_info(**kwargs) + + def get_aggregated_dns( + self, + *, + _from: Union[int, UnsetType] = unset, + to: Union[int, UnsetType] = unset, + group_by: Union[str, UnsetType] = unset, + tags: Union[str, UnsetType] = unset, + limit: Union[int, UnsetType] = unset, + ) -> SingleAggregatedDnsResponseArray: + """Get all aggregated DNS traffic. + + Get all aggregated DNS traffic. + + :param _from: Unix timestamp (number of seconds since epoch) of the start of the query window. If not provided, the start of the query window is 15 minutes before the ``to`` timestamp. If neither ``from`` nor ``to`` are provided, the query window is ``[now - 15m, now]``. + :type _from: int, optional + :param to: Unix timestamp (number of seconds since epoch) of the end of the query window. If not provided, the end of the query window is the current time. If neither ``from`` nor ``to`` are provided, the query window is ``[now - 15m, now]``. + :type to: int, optional + :param group_by: Comma-separated list of fields to group DNS traffic by. The server side defaults to ``network.dns_query`` if unspecified. ``server_ungrouped`` may be used if groups are not desired. The maximum number of group_by(s) is 10. + :type group_by: str, optional + :param tags: Comma-separated list of tags to filter DNS traffic by. + :type tags: str, optional + :param limit: The number of aggregated DNS entries to be returned. The maximum value is 7500. The default is 100. + :type limit: int, optional + :rtype: SingleAggregatedDnsResponseArray + """ + kwargs: Dict[str, Any] = {} + if _from is not unset: + kwargs["_from"] = _from + + if to is not unset: + kwargs["to"] = to + + if group_by is not unset: + kwargs["group_by"] = group_by + + if tags is not unset: + kwargs["tags"] = tags + + if limit is not unset: + kwargs["limit"] = limit + + return self._get_aggregated_dns_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/model/dns_metric_key.py b/src/datadog_api_client/v2/model/dns_metric_key.py new file mode 100644 index 0000000000..a9474e5542 --- /dev/null +++ b/src/datadog_api_client/v2/model/dns_metric_key.py @@ -0,0 +1,62 @@ +# 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 DnsMetricKey(ModelSimple): + """ + The metric key for DNS metrics. + + :param value: Must be one of ["dns_total_requests", "dns_failures", "dns_successful_responses", "dns_failed_responses", "dns_timeouts", "dns_responses.nxdomain", "dns_responses.servfail", "dns_responses.other", "dns_success_latency_percentile", "dns_failure_latency_percentile"]. + :type value: str + """ + + allowed_values = { + "dns_total_requests", + "dns_failures", + "dns_successful_responses", + "dns_failed_responses", + "dns_timeouts", + "dns_responses.nxdomain", + "dns_responses.servfail", + "dns_responses.other", + "dns_success_latency_percentile", + "dns_failure_latency_percentile", + } + DNS_TOTAL_REQUESTS: ClassVar["DnsMetricKey"] + DNS_FAILURES: ClassVar["DnsMetricKey"] + DNS_SUCCESSFUL_RESPONSES: ClassVar["DnsMetricKey"] + DNS_FAILED_RESPONSES: ClassVar["DnsMetricKey"] + DNS_TIMEOUTS: ClassVar["DnsMetricKey"] + DNS_RESPONSES_NXDOMAIN: ClassVar["DnsMetricKey"] + DNS_RESPONSES_SERVFAIL: ClassVar["DnsMetricKey"] + DNS_RESPONSES_OTHER: ClassVar["DnsMetricKey"] + DNS_SUCCESS_LATENCY_PERCENTILE: ClassVar["DnsMetricKey"] + DNS_FAILURE_LATENCY_PERCENTILE: ClassVar["DnsMetricKey"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +DnsMetricKey.DNS_TOTAL_REQUESTS = DnsMetricKey("dns_total_requests") +DnsMetricKey.DNS_FAILURES = DnsMetricKey("dns_failures") +DnsMetricKey.DNS_SUCCESSFUL_RESPONSES = DnsMetricKey("dns_successful_responses") +DnsMetricKey.DNS_FAILED_RESPONSES = DnsMetricKey("dns_failed_responses") +DnsMetricKey.DNS_TIMEOUTS = DnsMetricKey("dns_timeouts") +DnsMetricKey.DNS_RESPONSES_NXDOMAIN = DnsMetricKey("dns_responses.nxdomain") +DnsMetricKey.DNS_RESPONSES_SERVFAIL = DnsMetricKey("dns_responses.servfail") +DnsMetricKey.DNS_RESPONSES_OTHER = DnsMetricKey("dns_responses.other") +DnsMetricKey.DNS_SUCCESS_LATENCY_PERCENTILE = DnsMetricKey("dns_success_latency_percentile") +DnsMetricKey.DNS_FAILURE_LATENCY_PERCENTILE = DnsMetricKey("dns_failure_latency_percentile") diff --git a/src/datadog_api_client/v2/model/single_aggregated_dns_response_array.py b/src/datadog_api_client/v2/model/single_aggregated_dns_response_array.py new file mode 100644 index 0000000000..b7eac5b4e9 --- /dev/null +++ b/src/datadog_api_client/v2/model/single_aggregated_dns_response_array.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 List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.single_aggregated_dns_response_data import SingleAggregatedDnsResponseData + + +class SingleAggregatedDnsResponseArray(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.single_aggregated_dns_response_data import SingleAggregatedDnsResponseData + + return { + "data": ([SingleAggregatedDnsResponseData],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[List[SingleAggregatedDnsResponseData], UnsetType] = unset, **kwargs): + """ + List of aggregated DNS flows. + + :param data: Array of aggregated DNS objects. + :type data: [SingleAggregatedDnsResponseData], optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/single_aggregated_dns_response_data.py b/src/datadog_api_client/v2/model/single_aggregated_dns_response_data.py new file mode 100644 index 0000000000..f142f15116 --- /dev/null +++ b/src/datadog_api_client/v2/model/single_aggregated_dns_response_data.py @@ -0,0 +1,70 @@ +# 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.single_aggregated_dns_response_data_attributes import ( + SingleAggregatedDnsResponseDataAttributes, + ) + from datadog_api_client.v2.model.single_aggregated_dns_response_data_type import SingleAggregatedDnsResponseDataType + + +class SingleAggregatedDnsResponseData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.single_aggregated_dns_response_data_attributes import ( + SingleAggregatedDnsResponseDataAttributes, + ) + from datadog_api_client.v2.model.single_aggregated_dns_response_data_type import ( + SingleAggregatedDnsResponseDataType, + ) + + return { + "attributes": (SingleAggregatedDnsResponseDataAttributes,), + "id": (str,), + "type": (SingleAggregatedDnsResponseDataType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: Union[SingleAggregatedDnsResponseDataAttributes, UnsetType] = unset, + id: Union[str, UnsetType] = unset, + type: Union[SingleAggregatedDnsResponseDataType, UnsetType] = unset, + **kwargs, + ): + """ + Object describing an aggregated DNS flow. + + :param attributes: Attributes for an aggregated DNS flow. + :type attributes: SingleAggregatedDnsResponseDataAttributes, optional + + :param id: A unique identifier for the aggregated DNS traffic based on the group by values. + :type id: str, optional + + :param type: Aggregated DNS resource type. + :type type: SingleAggregatedDnsResponseDataType, 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/single_aggregated_dns_response_data_attributes.py b/src/datadog_api_client/v2/model/single_aggregated_dns_response_data_attributes.py new file mode 100644 index 0000000000..384d50be44 --- /dev/null +++ b/src/datadog_api_client/v2/model/single_aggregated_dns_response_data_attributes.py @@ -0,0 +1,64 @@ +# 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, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.single_aggregated_dns_response_data_attributes_group_by_items import ( + SingleAggregatedDnsResponseDataAttributesGroupByItems, + ) + from datadog_api_client.v2.model.single_aggregated_dns_response_data_attributes_metrics_items import ( + SingleAggregatedDnsResponseDataAttributesMetricsItems, + ) + + +class SingleAggregatedDnsResponseDataAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.single_aggregated_dns_response_data_attributes_group_by_items import ( + SingleAggregatedDnsResponseDataAttributesGroupByItems, + ) + from datadog_api_client.v2.model.single_aggregated_dns_response_data_attributes_metrics_items import ( + SingleAggregatedDnsResponseDataAttributesMetricsItems, + ) + + return { + "group_bys": ([SingleAggregatedDnsResponseDataAttributesGroupByItems],), + "metrics": ([SingleAggregatedDnsResponseDataAttributesMetricsItems],), + } + + attribute_map = { + "group_bys": "group_bys", + "metrics": "metrics", + } + + def __init__( + self_, + group_bys: Union[List[SingleAggregatedDnsResponseDataAttributesGroupByItems], UnsetType] = unset, + metrics: Union[List[SingleAggregatedDnsResponseDataAttributesMetricsItems], UnsetType] = unset, + **kwargs, + ): + """ + Attributes for an aggregated DNS flow. + + :param group_bys: The key, value pairs for each group by. + :type group_bys: [SingleAggregatedDnsResponseDataAttributesGroupByItems], optional + + :param metrics: Metrics associated with an aggregated DNS flow. + :type metrics: [SingleAggregatedDnsResponseDataAttributesMetricsItems], optional + """ + if group_bys is not unset: + kwargs["group_bys"] = group_bys + if metrics is not unset: + kwargs["metrics"] = metrics + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/single_aggregated_dns_response_data_attributes_group_by_items.py b/src/datadog_api_client/v2/model/single_aggregated_dns_response_data_attributes_group_by_items.py new file mode 100644 index 0000000000..caeca1668e --- /dev/null +++ b/src/datadog_api_client/v2/model/single_aggregated_dns_response_data_attributes_group_by_items.py @@ -0,0 +1,43 @@ +# 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, + unset, + UnsetType, +) + + +class SingleAggregatedDnsResponseDataAttributesGroupByItems(ModelNormal): + @cached_property + def openapi_types(_): + return { + "key": (str,), + "value": (str,), + } + + attribute_map = { + "key": "key", + "value": "value", + } + + def __init__(self_, key: Union[str, UnsetType] = unset, value: Union[str, UnsetType] = unset, **kwargs): + """ + Attributes associated with a group by + + :param key: The group by key. + :type key: str, optional + + :param value: The group by value. + :type value: str, optional + """ + if key is not unset: + kwargs["key"] = key + if value is not unset: + kwargs["value"] = value + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/single_aggregated_dns_response_data_attributes_metrics_items.py b/src/datadog_api_client/v2/model/single_aggregated_dns_response_data_attributes_metrics_items.py new file mode 100644 index 0000000000..5581f66f20 --- /dev/null +++ b/src/datadog_api_client/v2/model/single_aggregated_dns_response_data_attributes_metrics_items.py @@ -0,0 +1,49 @@ +# 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.dns_metric_key import DnsMetricKey + + +class SingleAggregatedDnsResponseDataAttributesMetricsItems(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.dns_metric_key import DnsMetricKey + + return { + "key": (DnsMetricKey,), + "value": (int,), + } + + attribute_map = { + "key": "key", + "value": "value", + } + + def __init__(self_, key: Union[DnsMetricKey, UnsetType] = unset, value: Union[int, UnsetType] = unset, **kwargs): + """ + Metrics associated with an aggregated DNS flow. + + :param key: The metric key for DNS metrics. + :type key: DnsMetricKey, optional + + :param value: The metric value. + :type value: int, optional + """ + if key is not unset: + kwargs["key"] = key + if value is not unset: + kwargs["value"] = value + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/single_aggregated_dns_response_data_type.py b/src/datadog_api_client/v2/model/single_aggregated_dns_response_data_type.py new file mode 100644 index 0000000000..b079d0bd0e --- /dev/null +++ b/src/datadog_api_client/v2/model/single_aggregated_dns_response_data_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 SingleAggregatedDnsResponseDataType(ModelSimple): + """ + Aggregated DNS resource type. + + :param value: If omitted defaults to "aggregated_dns". Must be one of ["aggregated_dns"]. + :type value: str + """ + + allowed_values = { + "aggregated_dns", + } + AGGREGATED_DNS: ClassVar["SingleAggregatedDnsResponseDataType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +SingleAggregatedDnsResponseDataType.AGGREGATED_DNS = SingleAggregatedDnsResponseDataType("aggregated_dns") diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index ee45d35b41..d058b93c39 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -999,6 +999,7 @@ from datadog_api_client.v2.model.device_attributes import DeviceAttributes from datadog_api_client.v2.model.device_attributes_interface_statuses import DeviceAttributesInterfaceStatuses from datadog_api_client.v2.model.devices_list_data import DevicesListData +from datadog_api_client.v2.model.dns_metric_key import DnsMetricKey from datadog_api_client.v2.model.domain_allowlist import DomainAllowlist from datadog_api_client.v2.model.domain_allowlist_attributes import DomainAllowlistAttributes from datadog_api_client.v2.model.domain_allowlist_request import DomainAllowlistRequest @@ -3288,6 +3289,18 @@ from datadog_api_client.v2.model.single_aggregated_connection_response_data_type import ( SingleAggregatedConnectionResponseDataType, ) +from datadog_api_client.v2.model.single_aggregated_dns_response_array import SingleAggregatedDnsResponseArray +from datadog_api_client.v2.model.single_aggregated_dns_response_data import SingleAggregatedDnsResponseData +from datadog_api_client.v2.model.single_aggregated_dns_response_data_attributes import ( + SingleAggregatedDnsResponseDataAttributes, +) +from datadog_api_client.v2.model.single_aggregated_dns_response_data_attributes_group_by_items import ( + SingleAggregatedDnsResponseDataAttributesGroupByItems, +) +from datadog_api_client.v2.model.single_aggregated_dns_response_data_attributes_metrics_items import ( + SingleAggregatedDnsResponseDataAttributesMetricsItems, +) +from datadog_api_client.v2.model.single_aggregated_dns_response_data_type import SingleAggregatedDnsResponseDataType from datadog_api_client.v2.model.slack_integration_metadata import SlackIntegrationMetadata from datadog_api_client.v2.model.slack_integration_metadata_channel_item import SlackIntegrationMetadataChannelItem from datadog_api_client.v2.model.slack_trigger_wrapper import SlackTriggerWrapper @@ -4361,6 +4374,7 @@ "DeviceAttributes", "DeviceAttributesInterfaceStatuses", "DevicesListData", + "DnsMetricKey", "DomainAllowlist", "DomainAllowlistAttributes", "DomainAllowlistRequest", @@ -6004,6 +6018,12 @@ "SingleAggregatedConnectionResponseData", "SingleAggregatedConnectionResponseDataAttributes", "SingleAggregatedConnectionResponseDataType", + "SingleAggregatedDnsResponseArray", + "SingleAggregatedDnsResponseData", + "SingleAggregatedDnsResponseDataAttributes", + "SingleAggregatedDnsResponseDataAttributesGroupByItems", + "SingleAggregatedDnsResponseDataAttributesMetricsItems", + "SingleAggregatedDnsResponseDataType", "SlackIntegrationMetadata", "SlackIntegrationMetadataChannelItem", "SlackTriggerWrapper", diff --git a/tests/v2/cassettes/test_scenarios/test_get_all_aggregated_connections_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_all_aggregated_connections_returns_bad_request_response.frozen index ca4c2f607f..e555d14675 100644 --- a/tests/v2/cassettes/test_scenarios/test_get_all_aggregated_connections_returns_bad_request_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_get_all_aggregated_connections_returns_bad_request_response.frozen @@ -1 +1 @@ -2025-03-31T18:18:50.770Z \ No newline at end of file +2025-07-25T20:54:53.978Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_all_aggregated_connections_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_all_aggregated_connections_returns_bad_request_response.yaml index ce62443c16..d2c15d4ad6 100644 --- a/tests/v2/cassettes/test_scenarios/test_get_all_aggregated_connections_returns_bad_request_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_get_all_aggregated_connections_returns_bad_request_response.yaml @@ -5,10 +5,11 @@ interactions: accept: - application/json method: GET - uri: https://api.datadoghq.com/api/v2/network/connections/aggregate?limit=6000 + uri: https://api.datadoghq.com/api/v2/network/connections/aggregate?limit=8000 response: body: - string: '{"errors":[{"status":"400","title":"Invalid limit"}]}' + string: '{"errors":[{"status":"400","title":"Invalid limit","detail":"Limit + must meet requirements listed in https://docs.datadoghq.com/api/latest/cloud-network-monitoring/"}]}' headers: content-type: - application/vnd.api+json diff --git a/tests/v2/cassettes/test_scenarios/test_get_all_aggregated_dns_traffic_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_all_aggregated_dns_traffic_returns_bad_request_response.frozen new file mode 100644 index 0000000000..93894bd9fa --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_all_aggregated_dns_traffic_returns_bad_request_response.frozen @@ -0,0 +1 @@ +2025-07-25T20:54:53.474Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_all_aggregated_dns_traffic_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_all_aggregated_dns_traffic_returns_bad_request_response.yaml new file mode 100644 index 0000000000..59ab0fe56e --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_all_aggregated_dns_traffic_returns_bad_request_response.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/network/dns/aggregate?group_by=server_ungrouped%2Cserver_service + response: + body: + string: '{"errors":[{"status":"400","title":"Cannot combine server_ungrouped + with other server groupings or network.dns_query"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_all_aggregated_dns_traffic_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_all_aggregated_dns_traffic_returns_ok_response.frozen new file mode 100644 index 0000000000..5d59f9b397 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_all_aggregated_dns_traffic_returns_ok_response.frozen @@ -0,0 +1 @@ +2025-07-25T20:54:53.819Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_all_aggregated_dns_traffic_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_all_aggregated_dns_traffic_returns_ok_response.yaml new file mode 100644 index 0000000000..9c7f862a67 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_all_aggregated_dns_traffic_returns_ok_response.yaml @@ -0,0 +1,18 @@ +interactions: +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/network/dns/aggregate + response: + body: + string: '{"data":[]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v2/features/cloud_network_monitoring.feature b/tests/v2/features/cloud_network_monitoring.feature index 11e44ca184..feabf8845d 100644 --- a/tests/v2/features/cloud_network_monitoring.feature +++ b/tests/v2/features/cloud_network_monitoring.feature @@ -1,29 +1,50 @@ @endpoint(cloud-network-monitoring) @endpoint(cloud-network-monitoring-v2) Feature: Cloud Network Monitoring The Cloud Network Monitoring API allows you to fetch aggregated - connections and their attributes. See the [Cloud Network Monitoring page]( - https://docs.datadoghq.com/network_monitoring/cloud_network_monitoring/) - for more information. + connections and DNS traffic with their attributes. See the [Cloud Network + Monitoring page](https://docs.datadoghq.com/network_monitoring/cloud_netwo + rk_monitoring/) and [DNS Monitoring + page](https://docs.datadoghq.com/network_monitoring/dns/) for more + information. Background: Given a valid "apiKeyAuth" key in the system And a valid "appKeyAuth" key in the system And an instance of "CloudNetworkMonitoring" API - And operation "GetAggregatedConnections" enabled - And new "GetAggregatedConnections" request @team:Datadog/networks Scenario: Get aggregated connections returns "OK" response + Given operation "GetAggregatedConnections" enabled + And new "GetAggregatedConnections" request + When the request is sent + Then the response status is 200 OK + + @team:Datadog/networks + Scenario: Get all aggregated DNS traffic returns "Bad Request" response + Given operation "GetAggregatedDns" enabled + And new "GetAggregatedDns" request + And request contains "group_by" parameter with value "server_ungrouped,server_service" + When the request is sent + Then the response status is 400 Bad Request + + @team:Datadog/networks + Scenario: Get all aggregated DNS traffic returns "OK" response + Given operation "GetAggregatedDns" enabled + And new "GetAggregatedDns" request When the request is sent Then the response status is 200 OK @skip-python @skip-ruby @team:Datadog/networks Scenario: Get all aggregated connections returns "Bad Request" response - Given request contains "limit" parameter with value 6000 + Given operation "GetAggregatedConnections" enabled + And new "GetAggregatedConnections" request + And request contains "limit" parameter with value 8000 When the request is sent Then the response status is 400 Bad Request @generated @skip @team:Datadog/networks Scenario: Get all aggregated connections returns "OK" response + Given operation "GetAggregatedConnections" enabled + And new "GetAggregatedConnections" request When the request is sent Then the response status is 200 OK diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index a1fe13fed9..f278c5774f 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -2078,6 +2078,12 @@ "type": "safe" } }, + "GetAggregatedDns": { + "tag": "Cloud Network Monitoring", + "undo": { + "type": "safe" + } + }, "CreateOnCallEscalationPolicy": { "tag": "On-Call", "undo": {