From debd777eed19149371cd57d492a8384357d6a3e4 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 5 Aug 2025 16:20:32 +0000 Subject: [PATCH] Regenerate client from commit 69305be of spec repo --- .generated-info | 4 +- .generator/schemas/v2/openapi.yaml | 198 +++++++++++++++++- ...raffic-returns-Bad-Request-response.frozen | 1 + ...S-traffic-returns-Bad-Request-response.yml | 21 ++ ...ted-DNS-traffic-returns-OK-response.frozen | 1 + ...egated-DNS-traffic-returns-OK-response.yml | 20 ++ ...ctions-returns-Bad-Request-response.frozen | 2 +- ...nnections-returns-Bad-Request-response.yml | 7 +- .../GetAggregatedDns.rb | 8 + features/scenarios_model_mapping.rb | 7 + features/v2/cloud_network_monitoring.feature | 33 ++- features/v2/undo.json | 6 + lib/datadog_api_client/configuration.rb | 1 + lib/datadog_api_client/inflector.rb | 7 + .../v2/api/cloud_network_monitoring_api.rb | 84 +++++++- .../v2/models/dns_metric_key.rb | 35 ++++ .../single_aggregated_dns_response_array.rb | 107 ++++++++++ .../single_aggregated_dns_response_data.rb | 125 +++++++++++ ...aggregated_dns_response_data_attributes.rb | 119 +++++++++++ ...response_data_attributes_group_by_items.rb | 115 ++++++++++ ..._response_data_attributes_metrics_items.rb | 115 ++++++++++ ...ingle_aggregated_dns_response_data_type.rb | 26 +++ 22 files changed, 1027 insertions(+), 15 deletions(-) create mode 100644 cassettes/features/v2/cloud_network_monitoring/Get-all-aggregated-DNS-traffic-returns-Bad-Request-response.frozen create mode 100644 cassettes/features/v2/cloud_network_monitoring/Get-all-aggregated-DNS-traffic-returns-Bad-Request-response.yml create mode 100644 cassettes/features/v2/cloud_network_monitoring/Get-all-aggregated-DNS-traffic-returns-OK-response.frozen create mode 100644 cassettes/features/v2/cloud_network_monitoring/Get-all-aggregated-DNS-traffic-returns-OK-response.yml create mode 100644 examples/v2/cloud-network-monitoring/GetAggregatedDns.rb create mode 100644 lib/datadog_api_client/v2/models/dns_metric_key.rb create mode 100644 lib/datadog_api_client/v2/models/single_aggregated_dns_response_array.rb create mode 100644 lib/datadog_api_client/v2/models/single_aggregated_dns_response_data.rb create mode 100644 lib/datadog_api_client/v2/models/single_aggregated_dns_response_data_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/single_aggregated_dns_response_data_attributes_group_by_items.rb create mode 100644 lib/datadog_api_client/v2/models/single_aggregated_dns_response_data_attributes_metrics_items.rb create mode 100644 lib/datadog_api_client/v2/models/single_aggregated_dns_response_data_type.rb diff --git a/.generated-info b/.generated-info index d14ef345095a..56c68553cccb 100644 --- a/.generated-info +++ b/.generated-info @@ -1,4 +1,4 @@ { - "spec_repo_commit": "b308db8", - "generated": "2025-08-04 15:39:57.539" + "spec_repo_commit": "69305be", + "generated": "2025-08-05 16:20:32.413" } diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 65f05ab5f71a..5da536bf8c8d 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -13644,6 +13644,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: @@ -39937,6 +39973,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: @@ -56857,7 +56987,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: @@ -56883,6 +57013,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 @@ -67689,7 +67882,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/cassettes/features/v2/cloud_network_monitoring/Get-all-aggregated-DNS-traffic-returns-Bad-Request-response.frozen b/cassettes/features/v2/cloud_network_monitoring/Get-all-aggregated-DNS-traffic-returns-Bad-Request-response.frozen new file mode 100644 index 000000000000..93894bd9fa12 --- /dev/null +++ b/cassettes/features/v2/cloud_network_monitoring/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/cassettes/features/v2/cloud_network_monitoring/Get-all-aggregated-DNS-traffic-returns-Bad-Request-response.yml b/cassettes/features/v2/cloud_network_monitoring/Get-all-aggregated-DNS-traffic-returns-Bad-Request-response.yml new file mode 100644 index 000000000000..df40c728564b --- /dev/null +++ b/cassettes/features/v2/cloud_network_monitoring/Get-all-aggregated-DNS-traffic-returns-Bad-Request-response.yml @@ -0,0 +1,21 @@ +http_interactions: +- recorded_at: Fri, 25 Jul 2025 20:54:53 GMT + 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: + encoding: UTF-8 + 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 +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/cloud_network_monitoring/Get-all-aggregated-DNS-traffic-returns-OK-response.frozen b/cassettes/features/v2/cloud_network_monitoring/Get-all-aggregated-DNS-traffic-returns-OK-response.frozen new file mode 100644 index 000000000000..5d59f9b39713 --- /dev/null +++ b/cassettes/features/v2/cloud_network_monitoring/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/cassettes/features/v2/cloud_network_monitoring/Get-all-aggregated-DNS-traffic-returns-OK-response.yml b/cassettes/features/v2/cloud_network_monitoring/Get-all-aggregated-DNS-traffic-returns-OK-response.yml new file mode 100644 index 000000000000..65c3b79ebf45 --- /dev/null +++ b/cassettes/features/v2/cloud_network_monitoring/Get-all-aggregated-DNS-traffic-returns-OK-response.yml @@ -0,0 +1,20 @@ +http_interactions: +- recorded_at: Fri, 25 Jul 2025 20:54:53 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/network/dns/aggregate + response: + body: + encoding: UTF-8 + string: '{"data":[]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/cloud_network_monitoring/Get-all-aggregated-connections-returns-Bad-Request-response.frozen b/cassettes/features/v2/cloud_network_monitoring/Get-all-aggregated-connections-returns-Bad-Request-response.frozen index ca4c2f607f79..e555d1467580 100644 --- a/cassettes/features/v2/cloud_network_monitoring/Get-all-aggregated-connections-returns-Bad-Request-response.frozen +++ b/cassettes/features/v2/cloud_network_monitoring/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/cassettes/features/v2/cloud_network_monitoring/Get-all-aggregated-connections-returns-Bad-Request-response.yml b/cassettes/features/v2/cloud_network_monitoring/Get-all-aggregated-connections-returns-Bad-Request-response.yml index 364bf8be3635..2906e7c32ed8 100644 --- a/cassettes/features/v2/cloud_network_monitoring/Get-all-aggregated-connections-returns-Bad-Request-response.yml +++ b/cassettes/features/v2/cloud_network_monitoring/Get-all-aggregated-connections-returns-Bad-Request-response.yml @@ -1,16 +1,17 @@ http_interactions: -- recorded_at: Mon, 31 Mar 2025 18:18:50 GMT +- recorded_at: Fri, 25 Jul 2025 20:54:53 GMT request: body: null headers: 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: encoding: UTF-8 - 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/examples/v2/cloud-network-monitoring/GetAggregatedDns.rb b/examples/v2/cloud-network-monitoring/GetAggregatedDns.rb new file mode 100644 index 000000000000..d3166eaeb51c --- /dev/null +++ b/examples/v2/cloud-network-monitoring/GetAggregatedDns.rb @@ -0,0 +1,8 @@ +# Get all aggregated DNS traffic returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_aggregated_dns".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CloudNetworkMonitoringAPI.new +p api_instance.get_aggregated_dns() diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 608e9c38b74d..039243aa5ad9 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2173,6 +2173,13 @@ "tags" => "String", "limit" => "Integer", }, + "v2.GetAggregatedDns" => { + "from" => "Integer", + "to" => "Integer", + "group_by" => "String", + "tags" => "String", + "limit" => "Integer", + }, "v2.CreateOnCallEscalationPolicy" => { "include" => "String", "body" => "EscalationPolicyCreateRequest", diff --git a/features/v2/cloud_network_monitoring.feature b/features/v2/cloud_network_monitoring.feature index 11e44ca18450..feabf8845d0a 100644 --- a/features/v2/cloud_network_monitoring.feature +++ b/features/v2/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/features/v2/undo.json b/features/v2/undo.json index 40ab14773c47..fd14fad09365 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -2084,6 +2084,12 @@ "type": "safe" } }, + "GetAggregatedDns": { + "tag": "Cloud Network Monitoring", + "undo": { + "type": "safe" + } + }, "CreateOnCallEscalationPolicy": { "tag": "On-Call", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index d343edd8e318..4249b464ee82 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -255,6 +255,7 @@ def initialize "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/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index b4b3b51c2caa..2a1217b58845 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1710,6 +1710,7 @@ def overrides "v2.device_attributes" => "DeviceAttributes", "v2.device_attributes_interface_statuses" => "DeviceAttributesInterfaceStatuses", "v2.devices_list_data" => "DevicesListData", + "v2.dns_metric_key" => "DnsMetricKey", "v2.domain_allowlist" => "DomainAllowlist", "v2.domain_allowlist_attributes" => "DomainAllowlistAttributes", "v2.domain_allowlist_request" => "DomainAllowlistRequest", @@ -3443,6 +3444,12 @@ def overrides "v2.single_aggregated_connection_response_data" => "SingleAggregatedConnectionResponseData", "v2.single_aggregated_connection_response_data_attributes" => "SingleAggregatedConnectionResponseDataAttributes", "v2.single_aggregated_connection_response_data_type" => "SingleAggregatedConnectionResponseDataType", + "v2.single_aggregated_dns_response_array" => "SingleAggregatedDnsResponseArray", + "v2.single_aggregated_dns_response_data" => "SingleAggregatedDnsResponseData", + "v2.single_aggregated_dns_response_data_attributes" => "SingleAggregatedDnsResponseDataAttributes", + "v2.single_aggregated_dns_response_data_attributes_group_by_items" => "SingleAggregatedDnsResponseDataAttributesGroupByItems", + "v2.single_aggregated_dns_response_data_attributes_metrics_items" => "SingleAggregatedDnsResponseDataAttributesMetricsItems", + "v2.single_aggregated_dns_response_data_type" => "SingleAggregatedDnsResponseDataType", "v2.slack_integration_metadata" => "SlackIntegrationMetadata", "v2.slack_integration_metadata_channel_item" => "SlackIntegrationMetadataChannelItem", "v2.slack_trigger_wrapper" => "SlackTriggerWrapper", diff --git a/lib/datadog_api_client/v2/api/cloud_network_monitoring_api.rb b/lib/datadog_api_client/v2/api/cloud_network_monitoring_api.rb index 82f42000a4b4..108e5ef3af54 100644 --- a/lib/datadog_api_client/v2/api/cloud_network_monitoring_api.rb +++ b/lib/datadog_api_client/v2/api/cloud_network_monitoring_api.rb @@ -40,7 +40,7 @@ def get_aggregated_connections(opts = {}) # @option opts [Integer] :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]`. # @option opts [String] :group_by Comma-separated list of fields to group connections by. The maximum number of group_by(s) is 10. # @option opts [String] :tags Comma-separated list of tags to filter connections by. - # @option opts [Integer] :limit The number of connections to be returned. The maximum value is 7500. + # @option opts [Integer] :limit The number of connections to be returned. The maximum value is 7500. The default is 100. # @return [Array<(SingleAggregatedConnectionResponseArray, Integer, Hash)>] SingleAggregatedConnectionResponseArray data, response status code and response headers def get_aggregated_connections_with_http_info(opts = {}) unstable_enabled = @api_client.config.unstable_operations["v2.get_aggregated_connections".to_sym] @@ -104,5 +104,87 @@ def get_aggregated_connections_with_http_info(opts = {}) end return data, status_code, headers end + + # Get all aggregated DNS traffic. + # + # @see #get_aggregated_dns_with_http_info + def get_aggregated_dns(opts = {}) + data, _status_code, _headers = get_aggregated_dns_with_http_info(opts) + data + end + + # Get all aggregated DNS traffic. + # + # Get all aggregated DNS traffic. + # + # @param opts [Hash] the optional parameters + # @option opts [Integer] :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]`. + # @option opts [Integer] :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]`. + # @option opts [String] :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. + # @option opts [String] :tags Comma-separated list of tags to filter DNS traffic by. + # @option opts [Integer] :limit The number of aggregated DNS entries to be returned. The maximum value is 7500. The default is 100. + # @return [Array<(SingleAggregatedDnsResponseArray, Integer, Hash)>] SingleAggregatedDnsResponseArray data, response status code and response headers + def get_aggregated_dns_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_aggregated_dns".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_aggregated_dns") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_aggregated_dns")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CloudNetworkMonitoringAPI.get_aggregated_dns ...' + end + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 7500 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CloudNetworkMonitoringAPI.get_aggregated_dns, must be smaller than or equal to 7500.' + end + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CloudNetworkMonitoringAPI.get_aggregated_dns, must be greater than or equal to 1.' + end + # resource path + local_var_path = '/api/v2/network/dns/aggregate' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil? + query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil? + query_params[:'group_by'] = opts[:'group_by'] if !opts[:'group_by'].nil? + query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil? + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'SingleAggregatedDnsResponseArray' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :get_aggregated_dns, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CloudNetworkMonitoringAPI#get_aggregated_dns\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end end end diff --git a/lib/datadog_api_client/v2/models/dns_metric_key.rb b/lib/datadog_api_client/v2/models/dns_metric_key.rb new file mode 100644 index 000000000000..0aea0b485278 --- /dev/null +++ b/lib/datadog_api_client/v2/models/dns_metric_key.rb @@ -0,0 +1,35 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The metric key for DNS metrics. + class DnsMetricKey + include BaseEnumModel + + DNS_TOTAL_REQUESTS = "dns_total_requests".freeze + DNS_FAILURES = "dns_failures".freeze + DNS_SUCCESSFUL_RESPONSES = "dns_successful_responses".freeze + DNS_FAILED_RESPONSES = "dns_failed_responses".freeze + DNS_TIMEOUTS = "dns_timeouts".freeze + DNS_RESPONSES_NXDOMAIN = "dns_responses.nxdomain".freeze + DNS_RESPONSES_SERVFAIL = "dns_responses.servfail".freeze + DNS_RESPONSES_OTHER = "dns_responses.other".freeze + DNS_SUCCESS_LATENCY_PERCENTILE = "dns_success_latency_percentile".freeze + DNS_FAILURE_LATENCY_PERCENTILE = "dns_failure_latency_percentile".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/single_aggregated_dns_response_array.rb b/lib/datadog_api_client/v2/models/single_aggregated_dns_response_array.rb new file mode 100644 index 000000000000..9a7cb5729aa2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/single_aggregated_dns_response_array.rb @@ -0,0 +1,107 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # List of aggregated DNS flows. + class SingleAggregatedDnsResponseArray + include BaseGenericModel + + # Array of aggregated DNS objects. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SingleAggregatedDnsResponseArray` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/single_aggregated_dns_response_data.rb b/lib/datadog_api_client/v2/models/single_aggregated_dns_response_data.rb new file mode 100644 index 000000000000..df360933a374 --- /dev/null +++ b/lib/datadog_api_client/v2/models/single_aggregated_dns_response_data.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Object describing an aggregated DNS flow. + class SingleAggregatedDnsResponseData + include BaseGenericModel + + # Attributes for an aggregated DNS flow. + attr_accessor :attributes + + # A unique identifier for the aggregated DNS traffic based on the group by values. + attr_accessor :id + + # Aggregated DNS resource type. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'SingleAggregatedDnsResponseDataAttributes', + :'id' => :'String', + :'type' => :'SingleAggregatedDnsResponseDataType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SingleAggregatedDnsResponseData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/single_aggregated_dns_response_data_attributes.rb b/lib/datadog_api_client/v2/models/single_aggregated_dns_response_data_attributes.rb new file mode 100644 index 000000000000..1e7c4cef2a9f --- /dev/null +++ b/lib/datadog_api_client/v2/models/single_aggregated_dns_response_data_attributes.rb @@ -0,0 +1,119 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes for an aggregated DNS flow. + class SingleAggregatedDnsResponseDataAttributes + include BaseGenericModel + + # The key, value pairs for each group by. + attr_accessor :group_bys + + # Metrics associated with an aggregated DNS flow. + attr_accessor :metrics + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'group_bys' => :'group_bys', + :'metrics' => :'metrics' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'group_bys' => :'Array', + :'metrics' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SingleAggregatedDnsResponseDataAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'group_bys') + if (value = attributes[:'group_bys']).is_a?(Array) + self.group_bys = value + end + end + + if attributes.key?(:'metrics') + if (value = attributes[:'metrics']).is_a?(Array) + self.metrics = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + group_bys == o.group_bys && + metrics == o.metrics && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [group_bys, metrics, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/single_aggregated_dns_response_data_attributes_group_by_items.rb b/lib/datadog_api_client/v2/models/single_aggregated_dns_response_data_attributes_group_by_items.rb new file mode 100644 index 000000000000..ec0175847e3d --- /dev/null +++ b/lib/datadog_api_client/v2/models/single_aggregated_dns_response_data_attributes_group_by_items.rb @@ -0,0 +1,115 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes associated with a group by + class SingleAggregatedDnsResponseDataAttributesGroupByItems + include BaseGenericModel + + # The group by key. + attr_accessor :key + + # The group by value. + attr_accessor :value + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'key' => :'key', + :'value' => :'value' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'key' => :'String', + :'value' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SingleAggregatedDnsResponseDataAttributesGroupByItems` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'key') + self.key = attributes[:'key'] + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + key == o.key && + value == o.value && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [key, value, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/single_aggregated_dns_response_data_attributes_metrics_items.rb b/lib/datadog_api_client/v2/models/single_aggregated_dns_response_data_attributes_metrics_items.rb new file mode 100644 index 000000000000..a1210650fb53 --- /dev/null +++ b/lib/datadog_api_client/v2/models/single_aggregated_dns_response_data_attributes_metrics_items.rb @@ -0,0 +1,115 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Metrics associated with an aggregated DNS flow. + class SingleAggregatedDnsResponseDataAttributesMetricsItems + include BaseGenericModel + + # The metric key for DNS metrics. + attr_accessor :key + + # The metric value. + attr_accessor :value + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'key' => :'key', + :'value' => :'value' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'key' => :'DnsMetricKey', + :'value' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SingleAggregatedDnsResponseDataAttributesMetricsItems` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'key') + self.key = attributes[:'key'] + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + key == o.key && + value == o.value && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [key, value, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/single_aggregated_dns_response_data_type.rb b/lib/datadog_api_client/v2/models/single_aggregated_dns_response_data_type.rb new file mode 100644 index 000000000000..ffc4a2e2606b --- /dev/null +++ b/lib/datadog_api_client/v2/models/single_aggregated_dns_response_data_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Aggregated DNS resource type. + class SingleAggregatedDnsResponseDataType + include BaseEnumModel + + AGGREGATED_DNS = "aggregated_dns".freeze + end +end