diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index c26a927e835..95ca83db408 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -56819,6 +56819,191 @@ components: - type - id type: object + NetworkHealthInsight: + description: A single network health insight describing a service-to-service connectivity issue. + properties: + attributes: + $ref: "#/components/schemas/NetworkHealthInsightAttributes" + id: + description: Unique identifier for this network health insight. + example: example-insight-id + type: string + type: + $ref: "#/components/schemas/NetworkHealthInsightsType" + required: + - type + - id + - attributes + type: object + NetworkHealthInsightAttributes: + description: Detailed attributes of a network health insight. + properties: + account_id: + description: AWS account identifier where the certificate is located. Only set for `tls-cert` insights. + example: "123456789012" + type: string + certificate_id: + description: ARN or identifier of the certificate. Only set for `tls-cert` insights. + example: "arn:aws:acm:us-east-1:123456789012:certificate/abcd1234-a123-456b-a123-12345678901f" + type: string + certificate_lifetime_percent: + description: |- + Percentage of the certificate's validity period that has elapsed, ranging from 0 to 100. + Only set for `tls-cert` insights. + example: 96.7 + format: double + type: number + client_region: + description: AWS region where the client is located. Only set for `tls-cert` insights. + example: us-west-2 + type: string + client_service: + description: |- + Name of the service making the request (DNS query or TLS-secured connection). + Set to `N/A` when the client service cannot be determined. + example: network-logger + type: string + days_until_expiration: + description: |- + Number of days remaining until the certificate expires. Negative values indicate the + certificate has already expired. Only set for `tls-cert` insights. + example: 3 + format: int64 + type: integer + dns_query: + description: Domain name that was being resolved when the DNS failure occurred. Only set for `dns` insights. + example: kafka-broker.internal.domain.com + type: string + dns_server: + description: DNS server that received the failing query. Only set for `dns` insights. + example: cluster-dns + type: string + domain_name: + description: Domain name covered by the certificate. Only set for `tls-cert` insights. + example: api.example.com + type: string + failure_magnitude: + description: |- + Count of failed events observed during the query window. Only set for `dns`, `tcp`, + and `security-group` insights. + example: 150 + format: int64 + minimum: 0 + type: integer + failure_rate: + description: |- + Percentage of requests that failed during the query window, ranging from 0 to 100. + Only set for `dns`, `tcp`, and `security-group` insights. + example: 91 + format: double + maximum: 100 + minimum: 0 + type: number + failure_type: + $ref: "#/components/schemas/NetworkHealthInsightFailureType" + loadbalancer_id: + description: ARN of the load balancer using the certificate. Only set for `tls-cert` insights. + example: "arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/app/my-lb/50dc6c495c0c9188" + type: string + server_region: + description: AWS region where the server or load balancer is located. Only set for `tls-cert` insights. + example: us-east-1 + type: string + server_service: + description: Name of the target service the client was trying to reach. + example: kafka + type: string + total_requests: + description: |- + Total number of requests observed during the query window. Provides context for + `failure_magnitude` and `failure_rate`. Only set for `dns`, `tcp`, and `security-group` insights. + example: 1200 + format: int64 + minimum: 0 + type: integer + traffic_volume: + $ref: "#/components/schemas/NetworkHealthInsightTrafficVolume" + type: + $ref: "#/components/schemas/NetworkHealthInsightCategory" + type: object + NetworkHealthInsightCategory: + description: |- + Category of network health insight. Indicates whether the insight relates to a DNS issue (`dns`), + a TCP issue (`tcp`), a TLS certificate issue (`tls-cert`), or a security group denial (`security-group`). + enum: + - dns + - tcp + - tls-cert + - security-group + example: dns + type: string + x-enum-varnames: + - DNS + - TCP + - TLS_CERT + - SECURITY_GROUP + NetworkHealthInsightFailureType: + description: |- + Specific failure type within the insight category. For DNS insights: `timeout`, `nxdomain`, + `servfail`, or `general_failure`. For TLS certificate insights: `expired` or `expiring_soon`. + For security group insights: `denied`. + enum: + - timeout + - nxdomain + - servfail + - general_failure + - expired + - expiring_soon + - denied + example: nxdomain + type: string + x-enum-varnames: + - TIMEOUT + - NXDOMAIN + - SERVFAIL + - GENERAL_FAILURE + - EXPIRED + - EXPIRING_SOON + - DENIED + NetworkHealthInsightTrafficVolume: + description: Network traffic volume metrics between the client and server services during the query window. + properties: + bytes_read: + description: Total bytes read from the server to the client during the query window. + example: 1800000 + format: int64 + type: integer + bytes_written: + description: Total bytes written from the client to the server during the query window. + example: 2500000 + format: int64 + type: integer + total_traffic: + description: Sum of bytes written and bytes read across the query window. + example: 4300000 + format: int64 + type: integer + type: object + NetworkHealthInsightsResponse: + description: Response containing a list of network health insights for the organization. + properties: + data: + description: Array of network health insights returned for the query window. + items: + $ref: "#/components/schemas/NetworkHealthInsight" + type: array + required: + - data + type: object + NetworkHealthInsightsType: + default: network-health-insights + description: The resource type for network health insights. Always `network-health-insights`. + enum: + - network-health-insights + example: network-health-insights + type: string + x-enum-varnames: + - NETWORK_HEALTH_INSIGHTS NodeType: additionalProperties: {} description: A tree-sitter node type definition for a given language, describing the node's structure, subtypes, and fields. @@ -141152,6 +141337,118 @@ paths: summary: Update the tags for an interface tags: - Network Device Monitoring + /api/v2/network-health-insights: + get: + description: |- + Return network health insights for the organization within the given time window. + Insights are produced by analyzing DNS failures pre-classified by `network-dns-logger`, + TLS certificate metrics, and denied security group connections. Each insight + identifies the client and server services involved, the type of issue, and the + magnitude of the failure observed during the query window. + operationId: ListNetworkHealthInsights + 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 will be 15 minutes before the `to` timestamp. + If neither `from` nor `to` are provided, the query window will be `[now - 15m, now]`. + example: "1716800000" + in: query + name: from + required: false + schema: + type: string + - description: |- + Unix timestamp (number of seconds since epoch) of the end of the query window. + If not provided, the end of the query window will be the current time. + If neither `from` nor `to` are provided, the query window will be `[now - 15m, now]`. + example: "1716800900" + in: query + name: to + required: false + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + client_service: "network-logger" + dns_query: "kafka-broker.internal.domain.com" + dns_server: "cluster-dns" + failure_magnitude: 150 + failure_rate: 91 + failure_type: "nxdomain" + server_service: "kafka" + total_requests: 1200 + traffic_volume: + bytes_read: 1800000 + bytes_written: 2500000 + total_traffic: 4300000 + type: "dns" + id: "example-insight-id" + type: "network-health-insights" + - attributes: + account_id: "123456789012" + certificate_id: "arn:aws:acm:us-east-1:123456789012:certificate/abcd1234-a123-456b-a123-12345678901f" + certificate_lifetime_percent: 96.7 + client_region: "us-west-2" + client_service: "N/A" + days_until_expiration: 3 + domain_name: "api.example.com" + failure_type: "expiring_soon" + loadbalancer_id: "arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/app/my-lb/50dc6c495c0c9188" + server_region: "us-east-1" + server_service: "web-frontend" + type: "tls-cert" + id: "example-cert-insight-id" + type: "network-health-insights" + - attributes: + client_service: "web-frontend" + failure_magnitude: 85 + failure_rate: 68.5 + failure_type: "denied" + server_service: "database" + total_requests: 124 + type: "security-group" + id: "example-security-group-insight-id" + type: "network-health-insights" + schema: + $ref: "#/components/schemas/NetworkHealthInsightsResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Internal Server Error + summary: List network health insights + tags: + - Network Health Insights + x-permission: + operator: OR + permissions: + - network_health_insights_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/network/connections/aggregate: get: description: Get all aggregated connections. @@ -176392,6 +176689,11 @@ tags: - description: |- The Network Device Monitoring API allows you to fetch devices and interfaces and their attributes. See the [Network Device Monitoring page](https://docs.datadoghq.com/network_monitoring/) for more information. name: Network Device Monitoring + - description: |- + Analyze network health by surfacing actionable insights for services experiencing connectivity issues. + Insights are derived from DNS failure data (timeouts, NXDOMAIN, SERVFAIL, general failures), + TLS certificate health (expired, expiring soon), and security group denials. + name: Network Health Insights - description: |- Configure OAuth2 clients for Datadog. Supports RFC 7591 Dynamic Client Registration and management of OAuth2 client scopes restrictions. diff --git a/examples/v2/network-health-insights/ListNetworkHealthInsights.java b/examples/v2/network-health-insights/ListNetworkHealthInsights.java new file mode 100644 index 00000000000..3a715b15ece --- /dev/null +++ b/examples/v2/network-health-insights/ListNetworkHealthInsights.java @@ -0,0 +1,26 @@ +// List network health insights returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.NetworkHealthInsightsApi; +import com.datadog.api.client.v2.model.NetworkHealthInsightsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listNetworkHealthInsights", true); + NetworkHealthInsightsApi apiInstance = new NetworkHealthInsightsApi(defaultClient); + + try { + NetworkHealthInsightsResponse result = apiInstance.listNetworkHealthInsights(); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling NetworkHealthInsightsApi#listNetworkHealthInsights"); + 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 cd35207438f..4cf1fb5c604 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -1099,6 +1099,7 @@ public class ApiClient { put("v2.updateMonitorUserTemplate", false); put("v2.validateExistingMonitorUserTemplate", false); put("v2.validateMonitorUserTemplate", false); + put("v2.listNetworkHealthInsights", false); put("v2.deleteScopesRestriction", false); put("v2.getScopesRestriction", false); put("v2.registerOAuthClient", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/NetworkHealthInsightsApi.java b/src/main/java/com/datadog/api/client/v2/api/NetworkHealthInsightsApi.java new file mode 100644 index 00000000000..db84675580a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/NetworkHealthInsightsApi.java @@ -0,0 +1,264 @@ +package com.datadog.api.client.v2.api; + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.ApiResponse; +import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.NetworkHealthInsightsResponse; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class NetworkHealthInsightsApi { + private ApiClient apiClient; + + public NetworkHealthInsightsApi() { + this(ApiClient.getDefaultApiClient()); + } + + public NetworkHealthInsightsApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client. + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client. + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** Manage optional parameters to listNetworkHealthInsights. */ + public static class ListNetworkHealthInsightsOptionalParameters { + private String from; + private String to; + + /** + * 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 will be 15 minutes before the to + * timestamp. If neither from nor to are provided, the + * query window will be [now - 15m, now]. (optional) + * @return ListNetworkHealthInsightsOptionalParameters + */ + public ListNetworkHealthInsightsOptionalParameters from(String 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 will be the current time. If neither from + * nor to are provided, the query window will be [now - 15m, now] + * . (optional) + * @return ListNetworkHealthInsightsOptionalParameters + */ + public ListNetworkHealthInsightsOptionalParameters to(String to) { + this.to = to; + return this; + } + } + + /** + * List network health insights. + * + *

See {@link #listNetworkHealthInsightsWithHttpInfo}. + * + * @return NetworkHealthInsightsResponse + * @throws ApiException if fails to make API call + */ + public NetworkHealthInsightsResponse listNetworkHealthInsights() throws ApiException { + return listNetworkHealthInsightsWithHttpInfo(new ListNetworkHealthInsightsOptionalParameters()) + .getData(); + } + + /** + * List network health insights. + * + *

See {@link #listNetworkHealthInsightsWithHttpInfoAsync}. + * + * @return CompletableFuture<NetworkHealthInsightsResponse> + */ + public CompletableFuture listNetworkHealthInsightsAsync() { + return listNetworkHealthInsightsWithHttpInfoAsync( + new ListNetworkHealthInsightsOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List network health insights. + * + *

See {@link #listNetworkHealthInsightsWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return NetworkHealthInsightsResponse + * @throws ApiException if fails to make API call + */ + public NetworkHealthInsightsResponse listNetworkHealthInsights( + ListNetworkHealthInsightsOptionalParameters parameters) throws ApiException { + return listNetworkHealthInsightsWithHttpInfo(parameters).getData(); + } + + /** + * List network health insights. + * + *

See {@link #listNetworkHealthInsightsWithHttpInfoAsync}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<NetworkHealthInsightsResponse> + */ + public CompletableFuture listNetworkHealthInsightsAsync( + ListNetworkHealthInsightsOptionalParameters parameters) { + return listNetworkHealthInsightsWithHttpInfoAsync(parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Return network health insights for the organization within the given time window. Insights are + * produced by analyzing DNS failures pre-classified by network-dns-logger, TLS + * certificate metrics, and denied security group connections. Each insight identifies the client + * and server services involved, the type of issue, and the magnitude of the failure observed + * during the query window. + * + * @param parameters Optional parameters for the request. + * @return ApiResponse<NetworkHealthInsightsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
429 Too many requests -
500 Internal Server Error -
+ */ + public ApiResponse listNetworkHealthInsightsWithHttpInfo( + ListNetworkHealthInsightsOptionalParameters parameters) throws ApiException { + // Check if unstable operation is enabled + String operationId = "listNetworkHealthInsights"; + 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; + String from = parameters.from; + String to = parameters.to; + // create path and map variables + String localVarPath = "/api/v2/network-health-insights"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "from", from)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "to", to)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.NetworkHealthInsightsApi.listNetworkHealthInsights", + 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() {}); + } + + /** + * List network health insights. + * + *

See {@link #listNetworkHealthInsightsWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<NetworkHealthInsightsResponse>> + */ + public CompletableFuture> + listNetworkHealthInsightsWithHttpInfoAsync( + ListNetworkHealthInsightsOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "listNetworkHealthInsights"; + 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; + String from = parameters.from; + String to = parameters.to; + // create path and map variables + String localVarPath = "/api/v2/network-health-insights"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "from", from)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "to", to)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.NetworkHealthInsightsApi.listNetworkHealthInsights", + 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/NetworkHealthInsight.java b/src/main/java/com/datadog/api/client/v2/model/NetworkHealthInsight.java new file mode 100644 index 00000000000..3cbda958128 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/NetworkHealthInsight.java @@ -0,0 +1,209 @@ +/* + * 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.JsonCreator; +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; + +/** A single network health insight describing a service-to-service connectivity issue. */ +@JsonPropertyOrder({ + NetworkHealthInsight.JSON_PROPERTY_ATTRIBUTES, + NetworkHealthInsight.JSON_PROPERTY_ID, + NetworkHealthInsight.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class NetworkHealthInsight { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private NetworkHealthInsightAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private NetworkHealthInsightsType type = NetworkHealthInsightsType.NETWORK_HEALTH_INSIGHTS; + + public NetworkHealthInsight() {} + + @JsonCreator + public NetworkHealthInsight( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + NetworkHealthInsightAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) NetworkHealthInsightsType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public NetworkHealthInsight attributes(NetworkHealthInsightAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Detailed attributes of a network health insight. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public NetworkHealthInsightAttributes getAttributes() { + return attributes; + } + + public void setAttributes(NetworkHealthInsightAttributes attributes) { + this.attributes = attributes; + } + + public NetworkHealthInsight id(String id) { + this.id = id; + return this; + } + + /** + * Unique identifier for this network health insight. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public NetworkHealthInsight type(NetworkHealthInsightsType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The resource type for network health insights. Always network-health-insights. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public NetworkHealthInsightsType getType() { + return type; + } + + public void setType(NetworkHealthInsightsType 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 NetworkHealthInsight + */ + @JsonAnySetter + public NetworkHealthInsight 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 NetworkHealthInsight object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NetworkHealthInsight networkHealthInsight = (NetworkHealthInsight) o; + return Objects.equals(this.attributes, networkHealthInsight.attributes) + && Objects.equals(this.id, networkHealthInsight.id) + && Objects.equals(this.type, networkHealthInsight.type) + && Objects.equals(this.additionalProperties, networkHealthInsight.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NetworkHealthInsight {\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/NetworkHealthInsightAttributes.java b/src/main/java/com/datadog/api/client/v2/model/NetworkHealthInsightAttributes.java new file mode 100644 index 00000000000..fcda5593ff0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/NetworkHealthInsightAttributes.java @@ -0,0 +1,652 @@ +/* + * 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; + +/** Detailed attributes of a network health insight. */ +@JsonPropertyOrder({ + NetworkHealthInsightAttributes.JSON_PROPERTY_ACCOUNT_ID, + NetworkHealthInsightAttributes.JSON_PROPERTY_CERTIFICATE_ID, + NetworkHealthInsightAttributes.JSON_PROPERTY_CERTIFICATE_LIFETIME_PERCENT, + NetworkHealthInsightAttributes.JSON_PROPERTY_CLIENT_REGION, + NetworkHealthInsightAttributes.JSON_PROPERTY_CLIENT_SERVICE, + NetworkHealthInsightAttributes.JSON_PROPERTY_DAYS_UNTIL_EXPIRATION, + NetworkHealthInsightAttributes.JSON_PROPERTY_DNS_QUERY, + NetworkHealthInsightAttributes.JSON_PROPERTY_DNS_SERVER, + NetworkHealthInsightAttributes.JSON_PROPERTY_DOMAIN_NAME, + NetworkHealthInsightAttributes.JSON_PROPERTY_FAILURE_MAGNITUDE, + NetworkHealthInsightAttributes.JSON_PROPERTY_FAILURE_RATE, + NetworkHealthInsightAttributes.JSON_PROPERTY_FAILURE_TYPE, + NetworkHealthInsightAttributes.JSON_PROPERTY_LOADBALANCER_ID, + NetworkHealthInsightAttributes.JSON_PROPERTY_SERVER_REGION, + NetworkHealthInsightAttributes.JSON_PROPERTY_SERVER_SERVICE, + NetworkHealthInsightAttributes.JSON_PROPERTY_TOTAL_REQUESTS, + NetworkHealthInsightAttributes.JSON_PROPERTY_TRAFFIC_VOLUME, + NetworkHealthInsightAttributes.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class NetworkHealthInsightAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACCOUNT_ID = "account_id"; + private String accountId; + + public static final String JSON_PROPERTY_CERTIFICATE_ID = "certificate_id"; + private String certificateId; + + public static final String JSON_PROPERTY_CERTIFICATE_LIFETIME_PERCENT = + "certificate_lifetime_percent"; + private Double certificateLifetimePercent; + + public static final String JSON_PROPERTY_CLIENT_REGION = "client_region"; + private String clientRegion; + + public static final String JSON_PROPERTY_CLIENT_SERVICE = "client_service"; + private String clientService; + + public static final String JSON_PROPERTY_DAYS_UNTIL_EXPIRATION = "days_until_expiration"; + private Long daysUntilExpiration; + + public static final String JSON_PROPERTY_DNS_QUERY = "dns_query"; + private String dnsQuery; + + public static final String JSON_PROPERTY_DNS_SERVER = "dns_server"; + private String dnsServer; + + public static final String JSON_PROPERTY_DOMAIN_NAME = "domain_name"; + private String domainName; + + public static final String JSON_PROPERTY_FAILURE_MAGNITUDE = "failure_magnitude"; + private Long failureMagnitude; + + public static final String JSON_PROPERTY_FAILURE_RATE = "failure_rate"; + private Double failureRate; + + public static final String JSON_PROPERTY_FAILURE_TYPE = "failure_type"; + private NetworkHealthInsightFailureType failureType; + + public static final String JSON_PROPERTY_LOADBALANCER_ID = "loadbalancer_id"; + private String loadbalancerId; + + public static final String JSON_PROPERTY_SERVER_REGION = "server_region"; + private String serverRegion; + + public static final String JSON_PROPERTY_SERVER_SERVICE = "server_service"; + private String serverService; + + public static final String JSON_PROPERTY_TOTAL_REQUESTS = "total_requests"; + private Long totalRequests; + + public static final String JSON_PROPERTY_TRAFFIC_VOLUME = "traffic_volume"; + private NetworkHealthInsightTrafficVolume trafficVolume; + + public static final String JSON_PROPERTY_TYPE = "type"; + private NetworkHealthInsightCategory type; + + public NetworkHealthInsightAttributes accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * AWS account identifier where the certificate is located. Only set for tls-cert + * insights. + * + * @return accountId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAccountId() { + return accountId; + } + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public NetworkHealthInsightAttributes certificateId(String certificateId) { + this.certificateId = certificateId; + return this; + } + + /** + * ARN or identifier of the certificate. Only set for tls-cert insights. + * + * @return certificateId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CERTIFICATE_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCertificateId() { + return certificateId; + } + + public void setCertificateId(String certificateId) { + this.certificateId = certificateId; + } + + public NetworkHealthInsightAttributes certificateLifetimePercent( + Double certificateLifetimePercent) { + this.certificateLifetimePercent = certificateLifetimePercent; + return this; + } + + /** + * Percentage of the certificate's validity period that has elapsed, ranging from 0 to 100. Only + * set for tls-cert insights. + * + * @return certificateLifetimePercent + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CERTIFICATE_LIFETIME_PERCENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Double getCertificateLifetimePercent() { + return certificateLifetimePercent; + } + + public void setCertificateLifetimePercent(Double certificateLifetimePercent) { + this.certificateLifetimePercent = certificateLifetimePercent; + } + + public NetworkHealthInsightAttributes clientRegion(String clientRegion) { + this.clientRegion = clientRegion; + return this; + } + + /** + * AWS region where the client is located. Only set for tls-cert insights. + * + * @return clientRegion + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CLIENT_REGION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getClientRegion() { + return clientRegion; + } + + public void setClientRegion(String clientRegion) { + this.clientRegion = clientRegion; + } + + public NetworkHealthInsightAttributes clientService(String clientService) { + this.clientService = clientService; + return this; + } + + /** + * Name of the service making the request (DNS query or TLS-secured connection). Set to N/A + * when the client service cannot be determined. + * + * @return clientService + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CLIENT_SERVICE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getClientService() { + return clientService; + } + + public void setClientService(String clientService) { + this.clientService = clientService; + } + + public NetworkHealthInsightAttributes daysUntilExpiration(Long daysUntilExpiration) { + this.daysUntilExpiration = daysUntilExpiration; + return this; + } + + /** + * Number of days remaining until the certificate expires. Negative values indicate the + * certificate has already expired. Only set for tls-cert insights. + * + * @return daysUntilExpiration + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DAYS_UNTIL_EXPIRATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getDaysUntilExpiration() { + return daysUntilExpiration; + } + + public void setDaysUntilExpiration(Long daysUntilExpiration) { + this.daysUntilExpiration = daysUntilExpiration; + } + + public NetworkHealthInsightAttributes dnsQuery(String dnsQuery) { + this.dnsQuery = dnsQuery; + return this; + } + + /** + * Domain name that was being resolved when the DNS failure occurred. Only set for dns + * insights. + * + * @return dnsQuery + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DNS_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDnsQuery() { + return dnsQuery; + } + + public void setDnsQuery(String dnsQuery) { + this.dnsQuery = dnsQuery; + } + + public NetworkHealthInsightAttributes dnsServer(String dnsServer) { + this.dnsServer = dnsServer; + return this; + } + + /** + * DNS server that received the failing query. Only set for dns insights. + * + * @return dnsServer + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DNS_SERVER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDnsServer() { + return dnsServer; + } + + public void setDnsServer(String dnsServer) { + this.dnsServer = dnsServer; + } + + public NetworkHealthInsightAttributes domainName(String domainName) { + this.domainName = domainName; + return this; + } + + /** + * Domain name covered by the certificate. Only set for tls-cert insights. + * + * @return domainName + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DOMAIN_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDomainName() { + return domainName; + } + + public void setDomainName(String domainName) { + this.domainName = domainName; + } + + public NetworkHealthInsightAttributes failureMagnitude(Long failureMagnitude) { + this.failureMagnitude = failureMagnitude; + return this; + } + + /** + * Count of failed events observed during the query window. Only set for dns, + * tcp, and security-group insights. minimum: 0 + * + * @return failureMagnitude + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FAILURE_MAGNITUDE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getFailureMagnitude() { + return failureMagnitude; + } + + public void setFailureMagnitude(Long failureMagnitude) { + this.failureMagnitude = failureMagnitude; + } + + public NetworkHealthInsightAttributes failureRate(Double failureRate) { + this.failureRate = failureRate; + return this; + } + + /** + * Percentage of requests that failed during the query window, ranging from 0 to 100. Only set for + * dns, tcp, and security-group insights. minimum: 0 + * maximum: 100 + * + * @return failureRate + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FAILURE_RATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Double getFailureRate() { + return failureRate; + } + + public void setFailureRate(Double failureRate) { + this.failureRate = failureRate; + } + + public NetworkHealthInsightAttributes failureType(NetworkHealthInsightFailureType failureType) { + this.failureType = failureType; + this.unparsed |= !failureType.isValid(); + return this; + } + + /** + * Specific failure type within the insight category. For DNS insights: timeout, + * nxdomain, servfail, or general_failure. For TLS + * certificate insights: expired or expiring_soon. For security group + * insights: denied. + * + * @return failureType + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FAILURE_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public NetworkHealthInsightFailureType getFailureType() { + return failureType; + } + + public void setFailureType(NetworkHealthInsightFailureType failureType) { + if (!failureType.isValid()) { + this.unparsed = true; + } + this.failureType = failureType; + } + + public NetworkHealthInsightAttributes loadbalancerId(String loadbalancerId) { + this.loadbalancerId = loadbalancerId; + return this; + } + + /** + * ARN of the load balancer using the certificate. Only set for tls-cert insights. + * + * @return loadbalancerId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LOADBALANCER_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getLoadbalancerId() { + return loadbalancerId; + } + + public void setLoadbalancerId(String loadbalancerId) { + this.loadbalancerId = loadbalancerId; + } + + public NetworkHealthInsightAttributes serverRegion(String serverRegion) { + this.serverRegion = serverRegion; + return this; + } + + /** + * AWS region where the server or load balancer is located. Only set for tls-cert + * insights. + * + * @return serverRegion + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SERVER_REGION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getServerRegion() { + return serverRegion; + } + + public void setServerRegion(String serverRegion) { + this.serverRegion = serverRegion; + } + + public NetworkHealthInsightAttributes serverService(String serverService) { + this.serverService = serverService; + return this; + } + + /** + * Name of the target service the client was trying to reach. + * + * @return serverService + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SERVER_SERVICE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getServerService() { + return serverService; + } + + public void setServerService(String serverService) { + this.serverService = serverService; + } + + public NetworkHealthInsightAttributes totalRequests(Long totalRequests) { + this.totalRequests = totalRequests; + return this; + } + + /** + * Total number of requests observed during the query window. Provides context for + * failure_magnitude and failure_rate. Only set for dns, + * tcp, and security-group insights. minimum: 0 + * + * @return totalRequests + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TOTAL_REQUESTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getTotalRequests() { + return totalRequests; + } + + public void setTotalRequests(Long totalRequests) { + this.totalRequests = totalRequests; + } + + public NetworkHealthInsightAttributes trafficVolume( + NetworkHealthInsightTrafficVolume trafficVolume) { + this.trafficVolume = trafficVolume; + this.unparsed |= trafficVolume.unparsed; + return this; + } + + /** + * Network traffic volume metrics between the client and server services during the query window. + * + * @return trafficVolume + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TRAFFIC_VOLUME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public NetworkHealthInsightTrafficVolume getTrafficVolume() { + return trafficVolume; + } + + public void setTrafficVolume(NetworkHealthInsightTrafficVolume trafficVolume) { + this.trafficVolume = trafficVolume; + } + + public NetworkHealthInsightAttributes type(NetworkHealthInsightCategory type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Category of network health insight. Indicates whether the insight relates to a DNS issue ( + * dns), a TCP issue (tcp), a TLS certificate issue (tls-cert + * ), or a security group denial (security-group). + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public NetworkHealthInsightCategory getType() { + return type; + } + + public void setType(NetworkHealthInsightCategory 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 NetworkHealthInsightAttributes + */ + @JsonAnySetter + public NetworkHealthInsightAttributes 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 NetworkHealthInsightAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NetworkHealthInsightAttributes networkHealthInsightAttributes = + (NetworkHealthInsightAttributes) o; + return Objects.equals(this.accountId, networkHealthInsightAttributes.accountId) + && Objects.equals(this.certificateId, networkHealthInsightAttributes.certificateId) + && Objects.equals( + this.certificateLifetimePercent, + networkHealthInsightAttributes.certificateLifetimePercent) + && Objects.equals(this.clientRegion, networkHealthInsightAttributes.clientRegion) + && Objects.equals(this.clientService, networkHealthInsightAttributes.clientService) + && Objects.equals( + this.daysUntilExpiration, networkHealthInsightAttributes.daysUntilExpiration) + && Objects.equals(this.dnsQuery, networkHealthInsightAttributes.dnsQuery) + && Objects.equals(this.dnsServer, networkHealthInsightAttributes.dnsServer) + && Objects.equals(this.domainName, networkHealthInsightAttributes.domainName) + && Objects.equals(this.failureMagnitude, networkHealthInsightAttributes.failureMagnitude) + && Objects.equals(this.failureRate, networkHealthInsightAttributes.failureRate) + && Objects.equals(this.failureType, networkHealthInsightAttributes.failureType) + && Objects.equals(this.loadbalancerId, networkHealthInsightAttributes.loadbalancerId) + && Objects.equals(this.serverRegion, networkHealthInsightAttributes.serverRegion) + && Objects.equals(this.serverService, networkHealthInsightAttributes.serverService) + && Objects.equals(this.totalRequests, networkHealthInsightAttributes.totalRequests) + && Objects.equals(this.trafficVolume, networkHealthInsightAttributes.trafficVolume) + && Objects.equals(this.type, networkHealthInsightAttributes.type) + && Objects.equals( + this.additionalProperties, networkHealthInsightAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + accountId, + certificateId, + certificateLifetimePercent, + clientRegion, + clientService, + daysUntilExpiration, + dnsQuery, + dnsServer, + domainName, + failureMagnitude, + failureRate, + failureType, + loadbalancerId, + serverRegion, + serverService, + totalRequests, + trafficVolume, + type, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NetworkHealthInsightAttributes {\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" certificateId: ").append(toIndentedString(certificateId)).append("\n"); + sb.append(" certificateLifetimePercent: ") + .append(toIndentedString(certificateLifetimePercent)) + .append("\n"); + sb.append(" clientRegion: ").append(toIndentedString(clientRegion)).append("\n"); + sb.append(" clientService: ").append(toIndentedString(clientService)).append("\n"); + sb.append(" daysUntilExpiration: ") + .append(toIndentedString(daysUntilExpiration)) + .append("\n"); + sb.append(" dnsQuery: ").append(toIndentedString(dnsQuery)).append("\n"); + sb.append(" dnsServer: ").append(toIndentedString(dnsServer)).append("\n"); + sb.append(" domainName: ").append(toIndentedString(domainName)).append("\n"); + sb.append(" failureMagnitude: ").append(toIndentedString(failureMagnitude)).append("\n"); + sb.append(" failureRate: ").append(toIndentedString(failureRate)).append("\n"); + sb.append(" failureType: ").append(toIndentedString(failureType)).append("\n"); + sb.append(" loadbalancerId: ").append(toIndentedString(loadbalancerId)).append("\n"); + sb.append(" serverRegion: ").append(toIndentedString(serverRegion)).append("\n"); + sb.append(" serverService: ").append(toIndentedString(serverService)).append("\n"); + sb.append(" totalRequests: ").append(toIndentedString(totalRequests)).append("\n"); + sb.append(" trafficVolume: ").append(toIndentedString(trafficVolume)).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/NetworkHealthInsightCategory.java b/src/main/java/com/datadog/api/client/v2/model/NetworkHealthInsightCategory.java new file mode 100644 index 00000000000..20ef1fb5d91 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/NetworkHealthInsightCategory.java @@ -0,0 +1,65 @@ +/* + * 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; + +/** + * Category of network health insight. Indicates whether the insight relates to a DNS issue ( + * dns), a TCP issue (tcp), a TLS certificate issue (tls-cert), or + * a security group denial (security-group). + */ +@JsonSerialize(using = NetworkHealthInsightCategory.NetworkHealthInsightCategorySerializer.class) +public class NetworkHealthInsightCategory extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("dns", "tcp", "tls-cert", "security-group")); + + public static final NetworkHealthInsightCategory DNS = new NetworkHealthInsightCategory("dns"); + public static final NetworkHealthInsightCategory TCP = new NetworkHealthInsightCategory("tcp"); + public static final NetworkHealthInsightCategory TLS_CERT = + new NetworkHealthInsightCategory("tls-cert"); + public static final NetworkHealthInsightCategory SECURITY_GROUP = + new NetworkHealthInsightCategory("security-group"); + + NetworkHealthInsightCategory(String value) { + super(value, allowedValues); + } + + public static class NetworkHealthInsightCategorySerializer + extends StdSerializer { + public NetworkHealthInsightCategorySerializer(Class t) { + super(t); + } + + public NetworkHealthInsightCategorySerializer() { + this(null); + } + + @Override + public void serialize( + NetworkHealthInsightCategory value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static NetworkHealthInsightCategory fromValue(String value) { + return new NetworkHealthInsightCategory(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/NetworkHealthInsightFailureType.java b/src/main/java/com/datadog/api/client/v2/model/NetworkHealthInsightFailureType.java new file mode 100644 index 00000000000..a788b54906a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/NetworkHealthInsightFailureType.java @@ -0,0 +1,83 @@ +/* + * 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; + +/** + * Specific failure type within the insight category. For DNS insights: timeout, + * nxdomain, servfail, or general_failure. For TLS certificate + * insights: expired or expiring_soon. For security group insights: + * denied. + */ +@JsonSerialize( + using = NetworkHealthInsightFailureType.NetworkHealthInsightFailureTypeSerializer.class) +public class NetworkHealthInsightFailureType extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList( + "timeout", + "nxdomain", + "servfail", + "general_failure", + "expired", + "expiring_soon", + "denied")); + + public static final NetworkHealthInsightFailureType TIMEOUT = + new NetworkHealthInsightFailureType("timeout"); + public static final NetworkHealthInsightFailureType NXDOMAIN = + new NetworkHealthInsightFailureType("nxdomain"); + public static final NetworkHealthInsightFailureType SERVFAIL = + new NetworkHealthInsightFailureType("servfail"); + public static final NetworkHealthInsightFailureType GENERAL_FAILURE = + new NetworkHealthInsightFailureType("general_failure"); + public static final NetworkHealthInsightFailureType EXPIRED = + new NetworkHealthInsightFailureType("expired"); + public static final NetworkHealthInsightFailureType EXPIRING_SOON = + new NetworkHealthInsightFailureType("expiring_soon"); + public static final NetworkHealthInsightFailureType DENIED = + new NetworkHealthInsightFailureType("denied"); + + NetworkHealthInsightFailureType(String value) { + super(value, allowedValues); + } + + public static class NetworkHealthInsightFailureTypeSerializer + extends StdSerializer { + public NetworkHealthInsightFailureTypeSerializer(Class t) { + super(t); + } + + public NetworkHealthInsightFailureTypeSerializer() { + this(null); + } + + @Override + public void serialize( + NetworkHealthInsightFailureType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static NetworkHealthInsightFailureType fromValue(String value) { + return new NetworkHealthInsightFailureType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/NetworkHealthInsightTrafficVolume.java b/src/main/java/com/datadog/api/client/v2/model/NetworkHealthInsightTrafficVolume.java new file mode 100644 index 00000000000..2d7925d78f0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/NetworkHealthInsightTrafficVolume.java @@ -0,0 +1,195 @@ +/* + * 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; + +/** + * Network traffic volume metrics between the client and server services during the query window. + */ +@JsonPropertyOrder({ + NetworkHealthInsightTrafficVolume.JSON_PROPERTY_BYTES_READ, + NetworkHealthInsightTrafficVolume.JSON_PROPERTY_BYTES_WRITTEN, + NetworkHealthInsightTrafficVolume.JSON_PROPERTY_TOTAL_TRAFFIC +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class NetworkHealthInsightTrafficVolume { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_BYTES_READ = "bytes_read"; + private Long bytesRead; + + public static final String JSON_PROPERTY_BYTES_WRITTEN = "bytes_written"; + private Long bytesWritten; + + public static final String JSON_PROPERTY_TOTAL_TRAFFIC = "total_traffic"; + private Long totalTraffic; + + public NetworkHealthInsightTrafficVolume bytesRead(Long bytesRead) { + this.bytesRead = bytesRead; + return this; + } + + /** + * Total bytes read from the server to the client during the query window. + * + * @return bytesRead + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_BYTES_READ) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getBytesRead() { + return bytesRead; + } + + public void setBytesRead(Long bytesRead) { + this.bytesRead = bytesRead; + } + + public NetworkHealthInsightTrafficVolume bytesWritten(Long bytesWritten) { + this.bytesWritten = bytesWritten; + return this; + } + + /** + * Total bytes written from the client to the server during the query window. + * + * @return bytesWritten + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_BYTES_WRITTEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getBytesWritten() { + return bytesWritten; + } + + public void setBytesWritten(Long bytesWritten) { + this.bytesWritten = bytesWritten; + } + + public NetworkHealthInsightTrafficVolume totalTraffic(Long totalTraffic) { + this.totalTraffic = totalTraffic; + return this; + } + + /** + * Sum of bytes written and bytes read across the query window. + * + * @return totalTraffic + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TOTAL_TRAFFIC) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getTotalTraffic() { + return totalTraffic; + } + + public void setTotalTraffic(Long totalTraffic) { + this.totalTraffic = totalTraffic; + } + + /** + * 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 NetworkHealthInsightTrafficVolume + */ + @JsonAnySetter + public NetworkHealthInsightTrafficVolume 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 NetworkHealthInsightTrafficVolume object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NetworkHealthInsightTrafficVolume networkHealthInsightTrafficVolume = + (NetworkHealthInsightTrafficVolume) o; + return Objects.equals(this.bytesRead, networkHealthInsightTrafficVolume.bytesRead) + && Objects.equals(this.bytesWritten, networkHealthInsightTrafficVolume.bytesWritten) + && Objects.equals(this.totalTraffic, networkHealthInsightTrafficVolume.totalTraffic) + && Objects.equals( + this.additionalProperties, networkHealthInsightTrafficVolume.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(bytesRead, bytesWritten, totalTraffic, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NetworkHealthInsightTrafficVolume {\n"); + sb.append(" bytesRead: ").append(toIndentedString(bytesRead)).append("\n"); + sb.append(" bytesWritten: ").append(toIndentedString(bytesWritten)).append("\n"); + sb.append(" totalTraffic: ").append(toIndentedString(totalTraffic)).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/NetworkHealthInsightsResponse.java b/src/main/java/com/datadog/api/client/v2/model/NetworkHealthInsightsResponse.java new file mode 100644 index 00000000000..4a6b15050e1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/NetworkHealthInsightsResponse.java @@ -0,0 +1,155 @@ +/* + * 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.JsonCreator; +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; + +/** Response containing a list of network health insights for the organization. */ +@JsonPropertyOrder({NetworkHealthInsightsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class NetworkHealthInsightsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public NetworkHealthInsightsResponse() {} + + @JsonCreator + public NetworkHealthInsightsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) List data) { + this.data = data; + } + + public NetworkHealthInsightsResponse data(List data) { + this.data = data; + for (NetworkHealthInsight item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public NetworkHealthInsightsResponse addDataItem(NetworkHealthInsight dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * Array of network health insights returned for the query window. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + 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 NetworkHealthInsightsResponse + */ + @JsonAnySetter + public NetworkHealthInsightsResponse 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 NetworkHealthInsightsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NetworkHealthInsightsResponse networkHealthInsightsResponse = (NetworkHealthInsightsResponse) o; + return Objects.equals(this.data, networkHealthInsightsResponse.data) + && Objects.equals( + this.additionalProperties, networkHealthInsightsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NetworkHealthInsightsResponse {\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/NetworkHealthInsightsType.java b/src/main/java/com/datadog/api/client/v2/model/NetworkHealthInsightsType.java new file mode 100644 index 00000000000..fb39edd7147 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/NetworkHealthInsightsType.java @@ -0,0 +1,57 @@ +/* + * 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 resource type for network health insights. Always network-health-insights. */ +@JsonSerialize(using = NetworkHealthInsightsType.NetworkHealthInsightsTypeSerializer.class) +public class NetworkHealthInsightsType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("network-health-insights")); + + public static final NetworkHealthInsightsType NETWORK_HEALTH_INSIGHTS = + new NetworkHealthInsightsType("network-health-insights"); + + NetworkHealthInsightsType(String value) { + super(value, allowedValues); + } + + public static class NetworkHealthInsightsTypeSerializer + extends StdSerializer { + public NetworkHealthInsightsTypeSerializer(Class t) { + super(t); + } + + public NetworkHealthInsightsTypeSerializer() { + this(null); + } + + @Override + public void serialize( + NetworkHealthInsightsType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static NetworkHealthInsightsType fromValue(String value) { + return new NetworkHealthInsightsType(value); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/network_health_insights.feature b/src/test/resources/com/datadog/api/client/v2/api/network_health_insights.feature new file mode 100644 index 00000000000..d3b8c5c8e69 --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/network_health_insights.feature @@ -0,0 +1,23 @@ +@endpoint(network-health-insights) @endpoint(network-health-insights-v2) +Feature: Network Health Insights + Analyze network health by surfacing actionable insights for services + experiencing connectivity issues. Insights are derived from DNS failure + data (timeouts, NXDOMAIN, SERVFAIL, general failures), TLS certificate + health (expired, expiring soon), and security group denials. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "NetworkHealthInsights" API + And operation "ListNetworkHealthInsights" enabled + And new "ListNetworkHealthInsights" request + + @generated @skip @team:Datadog/cloud-network-monitoring + Scenario: List network health insights returns "Bad Request" response + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:Datadog/cloud-network-monitoring + Scenario: List network health insights returns "OK" response + 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 211637b2390..5acd27403fe 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 @@ -4926,6 +4926,12 @@ "type": "idempotent" } }, + "ListNetworkHealthInsights": { + "tag": "Network Health Insights", + "undo": { + "type": "safe" + } + }, "GetAggregatedConnections": { "tag": "Cloud Network Monitoring", "undo": {