From 0dd5dd9a39194f7a4983657b29967b2dc4c76105 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 5 Aug 2025 16:21:55 +0000 Subject: [PATCH] Regenerate client from commit 69305be of spec repo --- .generated-info | 4 +- .generator/schemas/v2/openapi.yaml | 198 ++++++++++++- .../GetAggregatedDns.java | 25 ++ .../com/datadog/api/client/ApiClient.java | 1 + .../v2/api/CloudNetworkMonitoringApi.java | 266 +++++++++++++++++- .../api/client/v2/model/DnsMetricKey.java | 79 ++++++ .../SingleAggregatedDnsResponseArray.java | 151 ++++++++++ .../SingleAggregatedDnsResponseData.java | 200 +++++++++++++ ...leAggregatedDnsResponseDataAttributes.java | 197 +++++++++++++ ...DnsResponseDataAttributesGroupByItems.java | 171 +++++++++++ ...DnsResponseDataAttributesMetricsItems.java | 175 ++++++++++++ .../SingleAggregatedDnsResponseDataType.java | 59 ++++ ...raffic_returns_Bad_Request_response.freeze | 1 + ..._traffic_returns_Bad_Request_response.json | 33 +++ ...ted_DNS_traffic_returns_OK_response.freeze | 1 + ...gated_DNS_traffic_returns_OK_response.json | 28 ++ ...ctions_returns_Bad_Request_response.freeze | 2 +- ...nections_returns_Bad_Request_response.json | 6 +- .../v2/api/cloud_network_monitoring.feature | 33 ++- .../com/datadog/api/client/v2/api/undo.json | 6 + 20 files changed, 1620 insertions(+), 16 deletions(-) create mode 100644 examples/v2/cloud-network-monitoring/GetAggregatedDns.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DnsMetricKey.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/SingleAggregatedDnsResponseArray.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/SingleAggregatedDnsResponseData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/SingleAggregatedDnsResponseDataAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/SingleAggregatedDnsResponseDataAttributesGroupByItems.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/SingleAggregatedDnsResponseDataAttributesMetricsItems.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/SingleAggregatedDnsResponseDataType.java create mode 100644 src/test/resources/cassettes/features/v2/Get_all_aggregated_DNS_traffic_returns_Bad_Request_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Get_all_aggregated_DNS_traffic_returns_Bad_Request_response.json create mode 100644 src/test/resources/cassettes/features/v2/Get_all_aggregated_DNS_traffic_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Get_all_aggregated_DNS_traffic_returns_OK_response.json diff --git a/.generated-info b/.generated-info index e6ea9532f71..7efb87a5a03 100644 --- a/.generated-info +++ b/.generated-info @@ -1,4 +1,4 @@ { - "spec_repo_commit": "b308db8", - "generated": "2025-08-04 15:41:32.832" + "spec_repo_commit": "69305be", + "generated": "2025-08-05 16:21:55.068" } diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 65f05ab5f71..5da536bf8c8 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/examples/v2/cloud-network-monitoring/GetAggregatedDns.java b/examples/v2/cloud-network-monitoring/GetAggregatedDns.java new file mode 100644 index 00000000000..53dbf38b49b --- /dev/null +++ b/examples/v2/cloud-network-monitoring/GetAggregatedDns.java @@ -0,0 +1,25 @@ +// Get all aggregated DNS traffic returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CloudNetworkMonitoringApi; +import com.datadog.api.client.v2.model.SingleAggregatedDnsResponseArray; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getAggregatedDns", true); + CloudNetworkMonitoringApi apiInstance = new CloudNetworkMonitoringApi(defaultClient); + + try { + SingleAggregatedDnsResponseArray result = apiInstance.getAggregatedDns(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CloudNetworkMonitoringApi#getAggregatedDns"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index ab1c6b163f3..de59f86fe06 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -753,6 +753,7 @@ public class ApiClient { put("v2.validateExistingMonitorUserTemplate", false); put("v2.validateMonitorUserTemplate", false); put("v2.getAggregatedConnections", false); + put("v2.getAggregatedDns", false); put("v2.createPipeline", false); put("v2.deletePipeline", false); put("v2.getPipeline", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/CloudNetworkMonitoringApi.java b/src/main/java/com/datadog/api/client/v2/api/CloudNetworkMonitoringApi.java index 852855c0ebd..117cea6d080 100644 --- a/src/main/java/com/datadog/api/client/v2/api/CloudNetworkMonitoringApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/CloudNetworkMonitoringApi.java @@ -5,6 +5,7 @@ import com.datadog.api.client.ApiResponse; import com.datadog.api.client.Pair; import com.datadog.api.client.v2.model.SingleAggregatedConnectionResponseArray; +import com.datadog.api.client.v2.model.SingleAggregatedDnsResponseArray; import jakarta.ws.rs.client.Invocation; import jakarta.ws.rs.core.GenericType; import java.util.ArrayList; @@ -106,8 +107,8 @@ public GetAggregatedConnectionsOptionalParameters tags(String tags) { /** * Set limit. * - * @param limit The number of connections to be returned. The maximum value is 7500. (optional, - * default to 100) + * @param limit The number of connections to be returned. The maximum value is 7500. The default + * is 100. (optional, default to 100) * @return GetAggregatedConnectionsOptionalParameters */ public GetAggregatedConnectionsOptionalParameters limit(Integer limit) { @@ -306,4 +307,265 @@ public ApiResponse getAggregatedConnect false, new GenericType() {}); } + + /** Manage optional parameters to getAggregatedDns. */ + public static class GetAggregatedDnsOptionalParameters { + private Long from; + private Long to; + private String groupBy; + private String tags; + private Integer limit; + + /** + * Set from. + * + * @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]. (optional) + * @return GetAggregatedDnsOptionalParameters + */ + public GetAggregatedDnsOptionalParameters from(Long from) { + this.from = from; + return this; + } + + /** + * Set to. + * + * @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] + * . (optional) + * @return GetAggregatedDnsOptionalParameters + */ + public GetAggregatedDnsOptionalParameters to(Long to) { + this.to = to; + return this; + } + + /** + * Set groupBy. + * + * @param groupBy 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. + * (optional) + * @return GetAggregatedDnsOptionalParameters + */ + public GetAggregatedDnsOptionalParameters groupBy(String groupBy) { + this.groupBy = groupBy; + return this; + } + + /** + * Set tags. + * + * @param tags Comma-separated list of tags to filter DNS traffic by. (optional) + * @return GetAggregatedDnsOptionalParameters + */ + public GetAggregatedDnsOptionalParameters tags(String tags) { + this.tags = tags; + return this; + } + + /** + * Set limit. + * + * @param limit The number of aggregated DNS entries to be returned. The maximum value is 7500. + * The default is 100. (optional, default to 100) + * @return GetAggregatedDnsOptionalParameters + */ + public GetAggregatedDnsOptionalParameters limit(Integer limit) { + this.limit = limit; + return this; + } + } + + /** + * Get all aggregated DNS traffic. + * + *

See {@link #getAggregatedDnsWithHttpInfo}. + * + * @return SingleAggregatedDnsResponseArray + * @throws ApiException if fails to make API call + */ + public SingleAggregatedDnsResponseArray getAggregatedDns() throws ApiException { + return getAggregatedDnsWithHttpInfo(new GetAggregatedDnsOptionalParameters()).getData(); + } + + /** + * Get all aggregated DNS traffic. + * + *

See {@link #getAggregatedDnsWithHttpInfoAsync}. + * + * @return CompletableFuture<SingleAggregatedDnsResponseArray> + */ + public CompletableFuture getAggregatedDnsAsync() { + return getAggregatedDnsWithHttpInfoAsync(new GetAggregatedDnsOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get all aggregated DNS traffic. + * + *

See {@link #getAggregatedDnsWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return SingleAggregatedDnsResponseArray + * @throws ApiException if fails to make API call + */ + public SingleAggregatedDnsResponseArray getAggregatedDns( + GetAggregatedDnsOptionalParameters parameters) throws ApiException { + return getAggregatedDnsWithHttpInfo(parameters).getData(); + } + + /** + * Get all aggregated DNS traffic. + * + *

See {@link #getAggregatedDnsWithHttpInfoAsync}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<SingleAggregatedDnsResponseArray> + */ + public CompletableFuture getAggregatedDnsAsync( + GetAggregatedDnsOptionalParameters parameters) { + return getAggregatedDnsWithHttpInfoAsync(parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get all aggregated DNS traffic. + * + * @param parameters Optional parameters for the request. + * @return ApiResponse<SingleAggregatedDnsResponseArray> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
429 Too many requests -
+ */ + public ApiResponse getAggregatedDnsWithHttpInfo( + GetAggregatedDnsOptionalParameters parameters) throws ApiException { + // Check if unstable operation is enabled + String operationId = "getAggregatedDns"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + Long from = parameters.from; + Long to = parameters.to; + String groupBy = parameters.groupBy; + String tags = parameters.tags; + Integer limit = parameters.limit; + // create path and map variables + String localVarPath = "/api/v2/network/dns/aggregate"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "from", from)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "to", to)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "group_by", groupBy)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "tags", tags)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CloudNetworkMonitoringApi.getAggregatedDns", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get all aggregated DNS traffic. + * + *

See {@link #getAggregatedDnsWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<SingleAggregatedDnsResponseArray>> + */ + public CompletableFuture> + getAggregatedDnsWithHttpInfoAsync(GetAggregatedDnsOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "getAggregatedDns"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + Long from = parameters.from; + Long to = parameters.to; + String groupBy = parameters.groupBy; + String tags = parameters.tags; + Integer limit = parameters.limit; + // create path and map variables + String localVarPath = "/api/v2/network/dns/aggregate"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "from", from)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "to", to)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "group_by", groupBy)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "tags", tags)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CloudNetworkMonitoringApi.getAggregatedDns", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } } diff --git a/src/main/java/com/datadog/api/client/v2/model/DnsMetricKey.java b/src/main/java/com/datadog/api/client/v2/model/DnsMetricKey.java new file mode 100644 index 00000000000..9a2ede83909 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DnsMetricKey.java @@ -0,0 +1,79 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The metric key for DNS metrics. */ +@JsonSerialize(using = DnsMetricKey.DnsMetricKeySerializer.class) +public class DnsMetricKey extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList( + "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")); + + public static final DnsMetricKey DNS_TOTAL_REQUESTS = new DnsMetricKey("dns_total_requests"); + public static final DnsMetricKey DNS_FAILURES = new DnsMetricKey("dns_failures"); + public static final DnsMetricKey DNS_SUCCESSFUL_RESPONSES = + new DnsMetricKey("dns_successful_responses"); + public static final DnsMetricKey DNS_FAILED_RESPONSES = new DnsMetricKey("dns_failed_responses"); + public static final DnsMetricKey DNS_TIMEOUTS = new DnsMetricKey("dns_timeouts"); + public static final DnsMetricKey DNS_RESPONSES_NXDOMAIN = + new DnsMetricKey("dns_responses.nxdomain"); + public static final DnsMetricKey DNS_RESPONSES_SERVFAIL = + new DnsMetricKey("dns_responses.servfail"); + public static final DnsMetricKey DNS_RESPONSES_OTHER = new DnsMetricKey("dns_responses.other"); + public static final DnsMetricKey DNS_SUCCESS_LATENCY_PERCENTILE = + new DnsMetricKey("dns_success_latency_percentile"); + public static final DnsMetricKey DNS_FAILURE_LATENCY_PERCENTILE = + new DnsMetricKey("dns_failure_latency_percentile"); + + DnsMetricKey(String value) { + super(value, allowedValues); + } + + public static class DnsMetricKeySerializer extends StdSerializer { + public DnsMetricKeySerializer(Class t) { + super(t); + } + + public DnsMetricKeySerializer() { + this(null); + } + + @Override + public void serialize(DnsMetricKey value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static DnsMetricKey fromValue(String value) { + return new DnsMetricKey(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SingleAggregatedDnsResponseArray.java b/src/main/java/com/datadog/api/client/v2/model/SingleAggregatedDnsResponseArray.java new file mode 100644 index 00000000000..bd925cb008a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SingleAggregatedDnsResponseArray.java @@ -0,0 +1,151 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** List of aggregated DNS flows. */ +@JsonPropertyOrder({SingleAggregatedDnsResponseArray.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SingleAggregatedDnsResponseArray { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = null; + + public SingleAggregatedDnsResponseArray data(List data) { + this.data = data; + for (SingleAggregatedDnsResponseData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public SingleAggregatedDnsResponseArray addDataItem(SingleAggregatedDnsResponseData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * Array of aggregated DNS objects. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return SingleAggregatedDnsResponseArray + */ + @JsonAnySetter + public SingleAggregatedDnsResponseArray putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this SingleAggregatedDnsResponseArray object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SingleAggregatedDnsResponseArray singleAggregatedDnsResponseArray = + (SingleAggregatedDnsResponseArray) o; + return Objects.equals(this.data, singleAggregatedDnsResponseArray.data) + && Objects.equals( + this.additionalProperties, singleAggregatedDnsResponseArray.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SingleAggregatedDnsResponseArray {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SingleAggregatedDnsResponseData.java b/src/main/java/com/datadog/api/client/v2/model/SingleAggregatedDnsResponseData.java new file mode 100644 index 00000000000..b937987c787 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SingleAggregatedDnsResponseData.java @@ -0,0 +1,200 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Object describing an aggregated DNS flow. */ +@JsonPropertyOrder({ + SingleAggregatedDnsResponseData.JSON_PROPERTY_ATTRIBUTES, + SingleAggregatedDnsResponseData.JSON_PROPERTY_ID, + SingleAggregatedDnsResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SingleAggregatedDnsResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private SingleAggregatedDnsResponseDataAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private SingleAggregatedDnsResponseDataType type = + SingleAggregatedDnsResponseDataType.AGGREGATED_DNS; + + public SingleAggregatedDnsResponseData attributes( + SingleAggregatedDnsResponseDataAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for an aggregated DNS flow. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public SingleAggregatedDnsResponseDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(SingleAggregatedDnsResponseDataAttributes attributes) { + this.attributes = attributes; + } + + public SingleAggregatedDnsResponseData id(String id) { + this.id = id; + return this; + } + + /** + * A unique identifier for the aggregated DNS traffic based on the group by values. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public SingleAggregatedDnsResponseData type(SingleAggregatedDnsResponseDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Aggregated DNS resource type. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public SingleAggregatedDnsResponseDataType getType() { + return type; + } + + public void setType(SingleAggregatedDnsResponseDataType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return SingleAggregatedDnsResponseData + */ + @JsonAnySetter + public SingleAggregatedDnsResponseData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this SingleAggregatedDnsResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SingleAggregatedDnsResponseData singleAggregatedDnsResponseData = + (SingleAggregatedDnsResponseData) o; + return Objects.equals(this.attributes, singleAggregatedDnsResponseData.attributes) + && Objects.equals(this.id, singleAggregatedDnsResponseData.id) + && Objects.equals(this.type, singleAggregatedDnsResponseData.type) + && Objects.equals( + this.additionalProperties, singleAggregatedDnsResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SingleAggregatedDnsResponseData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SingleAggregatedDnsResponseDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/SingleAggregatedDnsResponseDataAttributes.java new file mode 100644 index 00000000000..6eb89961808 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SingleAggregatedDnsResponseDataAttributes.java @@ -0,0 +1,197 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Attributes for an aggregated DNS flow. */ +@JsonPropertyOrder({ + SingleAggregatedDnsResponseDataAttributes.JSON_PROPERTY_GROUP_BYS, + SingleAggregatedDnsResponseDataAttributes.JSON_PROPERTY_METRICS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SingleAggregatedDnsResponseDataAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_GROUP_BYS = "group_bys"; + private List groupBys = null; + + public static final String JSON_PROPERTY_METRICS = "metrics"; + private List metrics = null; + + public SingleAggregatedDnsResponseDataAttributes groupBys( + List groupBys) { + this.groupBys = groupBys; + for (SingleAggregatedDnsResponseDataAttributesGroupByItems item : groupBys) { + this.unparsed |= item.unparsed; + } + return this; + } + + public SingleAggregatedDnsResponseDataAttributes addGroupBysItem( + SingleAggregatedDnsResponseDataAttributesGroupByItems groupBysItem) { + if (this.groupBys == null) { + this.groupBys = new ArrayList<>(); + } + this.groupBys.add(groupBysItem); + this.unparsed |= groupBysItem.unparsed; + return this; + } + + /** + * The key, value pairs for each group by. + * + * @return groupBys + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_GROUP_BYS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getGroupBys() { + return groupBys; + } + + public void setGroupBys(List groupBys) { + this.groupBys = groupBys; + } + + public SingleAggregatedDnsResponseDataAttributes metrics( + List metrics) { + this.metrics = metrics; + for (SingleAggregatedDnsResponseDataAttributesMetricsItems item : metrics) { + this.unparsed |= item.unparsed; + } + return this; + } + + public SingleAggregatedDnsResponseDataAttributes addMetricsItem( + SingleAggregatedDnsResponseDataAttributesMetricsItems metricsItem) { + if (this.metrics == null) { + this.metrics = new ArrayList<>(); + } + this.metrics.add(metricsItem); + this.unparsed |= metricsItem.unparsed; + return this; + } + + /** + * Metrics associated with an aggregated DNS flow. + * + * @return metrics + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_METRICS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getMetrics() { + return metrics; + } + + public void setMetrics(List metrics) { + this.metrics = metrics; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return SingleAggregatedDnsResponseDataAttributes + */ + @JsonAnySetter + public SingleAggregatedDnsResponseDataAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this SingleAggregatedDnsResponseDataAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SingleAggregatedDnsResponseDataAttributes singleAggregatedDnsResponseDataAttributes = + (SingleAggregatedDnsResponseDataAttributes) o; + return Objects.equals(this.groupBys, singleAggregatedDnsResponseDataAttributes.groupBys) + && Objects.equals(this.metrics, singleAggregatedDnsResponseDataAttributes.metrics) + && Objects.equals( + this.additionalProperties, + singleAggregatedDnsResponseDataAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(groupBys, metrics, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SingleAggregatedDnsResponseDataAttributes {\n"); + sb.append(" groupBys: ").append(toIndentedString(groupBys)).append("\n"); + sb.append(" metrics: ").append(toIndentedString(metrics)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SingleAggregatedDnsResponseDataAttributesGroupByItems.java b/src/main/java/com/datadog/api/client/v2/model/SingleAggregatedDnsResponseDataAttributesGroupByItems.java new file mode 100644 index 00000000000..193f3fbda06 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SingleAggregatedDnsResponseDataAttributesGroupByItems.java @@ -0,0 +1,171 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Attributes associated with a group by */ +@JsonPropertyOrder({ + SingleAggregatedDnsResponseDataAttributesGroupByItems.JSON_PROPERTY_KEY, + SingleAggregatedDnsResponseDataAttributesGroupByItems.JSON_PROPERTY_VALUE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SingleAggregatedDnsResponseDataAttributesGroupByItems { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_KEY = "key"; + private String key; + + public static final String JSON_PROPERTY_VALUE = "value"; + private String value; + + public SingleAggregatedDnsResponseDataAttributesGroupByItems key(String key) { + this.key = key; + return this; + } + + /** + * The group by key. + * + * @return key + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public SingleAggregatedDnsResponseDataAttributesGroupByItems value(String value) { + this.value = value; + return this; + } + + /** + * The group by value. + * + * @return value + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return SingleAggregatedDnsResponseDataAttributesGroupByItems + */ + @JsonAnySetter + public SingleAggregatedDnsResponseDataAttributesGroupByItems putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** + * Return true if this SingleAggregatedDnsResponseDataAttributesGroupByItems object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SingleAggregatedDnsResponseDataAttributesGroupByItems + singleAggregatedDnsResponseDataAttributesGroupByItems = + (SingleAggregatedDnsResponseDataAttributesGroupByItems) o; + return Objects.equals(this.key, singleAggregatedDnsResponseDataAttributesGroupByItems.key) + && Objects.equals(this.value, singleAggregatedDnsResponseDataAttributesGroupByItems.value) + && Objects.equals( + this.additionalProperties, + singleAggregatedDnsResponseDataAttributesGroupByItems.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(key, value, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SingleAggregatedDnsResponseDataAttributesGroupByItems {\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SingleAggregatedDnsResponseDataAttributesMetricsItems.java b/src/main/java/com/datadog/api/client/v2/model/SingleAggregatedDnsResponseDataAttributesMetricsItems.java new file mode 100644 index 00000000000..d41d19545b0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SingleAggregatedDnsResponseDataAttributesMetricsItems.java @@ -0,0 +1,175 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Metrics associated with an aggregated DNS flow. */ +@JsonPropertyOrder({ + SingleAggregatedDnsResponseDataAttributesMetricsItems.JSON_PROPERTY_KEY, + SingleAggregatedDnsResponseDataAttributesMetricsItems.JSON_PROPERTY_VALUE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SingleAggregatedDnsResponseDataAttributesMetricsItems { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_KEY = "key"; + private DnsMetricKey key; + + public static final String JSON_PROPERTY_VALUE = "value"; + private Long value; + + public SingleAggregatedDnsResponseDataAttributesMetricsItems key(DnsMetricKey key) { + this.key = key; + this.unparsed |= !key.isValid(); + return this; + } + + /** + * The metric key for DNS metrics. + * + * @return key + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public DnsMetricKey getKey() { + return key; + } + + public void setKey(DnsMetricKey key) { + if (!key.isValid()) { + this.unparsed = true; + } + this.key = key; + } + + public SingleAggregatedDnsResponseDataAttributesMetricsItems value(Long value) { + this.value = value; + return this; + } + + /** + * The metric value. + * + * @return value + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getValue() { + return value; + } + + public void setValue(Long value) { + this.value = value; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return SingleAggregatedDnsResponseDataAttributesMetricsItems + */ + @JsonAnySetter + public SingleAggregatedDnsResponseDataAttributesMetricsItems putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** + * Return true if this SingleAggregatedDnsResponseDataAttributesMetricsItems object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SingleAggregatedDnsResponseDataAttributesMetricsItems + singleAggregatedDnsResponseDataAttributesMetricsItems = + (SingleAggregatedDnsResponseDataAttributesMetricsItems) o; + return Objects.equals(this.key, singleAggregatedDnsResponseDataAttributesMetricsItems.key) + && Objects.equals(this.value, singleAggregatedDnsResponseDataAttributesMetricsItems.value) + && Objects.equals( + this.additionalProperties, + singleAggregatedDnsResponseDataAttributesMetricsItems.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(key, value, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SingleAggregatedDnsResponseDataAttributesMetricsItems {\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SingleAggregatedDnsResponseDataType.java b/src/main/java/com/datadog/api/client/v2/model/SingleAggregatedDnsResponseDataType.java new file mode 100644 index 00000000000..05c543d64c4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SingleAggregatedDnsResponseDataType.java @@ -0,0 +1,59 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Aggregated DNS resource type. */ +@JsonSerialize( + using = SingleAggregatedDnsResponseDataType.SingleAggregatedDnsResponseDataTypeSerializer.class) +public class SingleAggregatedDnsResponseDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("aggregated_dns")); + + public static final SingleAggregatedDnsResponseDataType AGGREGATED_DNS = + new SingleAggregatedDnsResponseDataType("aggregated_dns"); + + SingleAggregatedDnsResponseDataType(String value) { + super(value, allowedValues); + } + + public static class SingleAggregatedDnsResponseDataTypeSerializer + extends StdSerializer { + public SingleAggregatedDnsResponseDataTypeSerializer( + Class t) { + super(t); + } + + public SingleAggregatedDnsResponseDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + SingleAggregatedDnsResponseDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static SingleAggregatedDnsResponseDataType fromValue(String value) { + return new SingleAggregatedDnsResponseDataType(value); + } +} diff --git a/src/test/resources/cassettes/features/v2/Get_all_aggregated_DNS_traffic_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Get_all_aggregated_DNS_traffic_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..93894bd9fa1 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_all_aggregated_DNS_traffic_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-07-25T20:54:53.474Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_all_aggregated_DNS_traffic_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Get_all_aggregated_DNS_traffic_returns_Bad_Request_response.json new file mode 100644 index 00000000000..3e5fdc0d73c --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_all_aggregated_DNS_traffic_returns_Bad_Request_response.json @@ -0,0 +1,33 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/network/dns/aggregate", + "queryStringParameters": { + "group_by": [ + "server_ungrouped,server_service" + ] + }, + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"400\",\"title\":\"Cannot combine server_ungrouped with other server groupings or network.dns_query\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "ac2ab1d1-c240-e4f4-30ad-cfa916f88152" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_all_aggregated_DNS_traffic_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Get_all_aggregated_DNS_traffic_returns_OK_response.freeze new file mode 100644 index 00000000000..5d59f9b3971 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_all_aggregated_DNS_traffic_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-07-25T20:54:53.819Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_all_aggregated_DNS_traffic_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Get_all_aggregated_DNS_traffic_returns_OK_response.json new file mode 100644 index 00000000000..648b30ef9e5 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_all_aggregated_DNS_traffic_returns_OK_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/network/dns/aggregate", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":[]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "48406e0e-fafc-d38b-2a8c-e740b706ec92" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_all_aggregated_connections_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Get_all_aggregated_connections_returns_Bad_Request_response.freeze index ca4c2f607f7..e555d146758 100644 --- a/src/test/resources/cassettes/features/v2/Get_all_aggregated_connections_returns_Bad_Request_response.freeze +++ b/src/test/resources/cassettes/features/v2/Get_all_aggregated_connections_returns_Bad_Request_response.freeze @@ -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/src/test/resources/cassettes/features/v2/Get_all_aggregated_connections_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Get_all_aggregated_connections_returns_Bad_Request_response.json index a20f598615c..0efd1ef20fe 100644 --- a/src/test/resources/cassettes/features/v2/Get_all_aggregated_connections_returns_Bad_Request_response.json +++ b/src/test/resources/cassettes/features/v2/Get_all_aggregated_connections_returns_Bad_Request_response.json @@ -6,14 +6,14 @@ "path": "/api/v2/network/connections/aggregate", "queryStringParameters": { "limit": [ - "6000" + "8000" ] }, "keepAlive": false, "secure": true }, "httpResponse": { - "body": "{\"errors\":[{\"status\":\"400\",\"title\":\"Invalid limit\"}]}", + "body": "{\"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" @@ -28,6 +28,6 @@ "timeToLive": { "unlimited": true }, - "id": "7d2e1246-1286-3aeb-3175-ac7aac0c7e6c" + "id": "b9f76d5f-0d44-17de-e8e4-e808d43efbd7" } ] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v2/api/cloud_network_monitoring.feature b/src/test/resources/com/datadog/api/client/v2/api/cloud_network_monitoring.feature index 11e44ca1845..feabf8845d0 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/cloud_network_monitoring.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/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/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index 40ab14773c4..fd14fad0936 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/undo.json @@ -2084,6 +2084,12 @@ "type": "safe" } }, + "GetAggregatedDns": { + "tag": "Cloud Network Monitoring", + "undo": { + "type": "safe" + } + }, "CreateOnCallEscalationPolicy": { "tag": "On-Call", "undo": {