diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 2d470c8f2f02..51a0fc352535 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -58040,6 +58040,191 @@ components: - type - attributes 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. @@ -144715,6 +144900,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. @@ -181385,6 +181682,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.rb b/examples/v2/network-health-insights/ListNetworkHealthInsights.rb new file mode 100644 index 000000000000..2ba6c2b6b050 --- /dev/null +++ b/examples/v2/network-health-insights/ListNetworkHealthInsights.rb @@ -0,0 +1,8 @@ +# List network health insights returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.list_network_health_insights".to_sym] = true +end +api_instance = DatadogAPIClient::V2::NetworkHealthInsightsAPI.new +p api_instance.list_network_health_insights() diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index f9c320310581..456ecf38c7c3 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -4061,6 +4061,10 @@ "interface_id" => "String", "body" => "ListInterfaceTagsResponse", }, + "v2.ListNetworkHealthInsights" => { + "from" => "String", + "to" => "String", + }, "v2.GetAggregatedConnections" => { "from" => "Integer", "to" => "Integer", diff --git a/features/v2/network_health_insights.feature b/features/v2/network_health_insights.feature new file mode 100644 index 000000000000..c5036b6af542 --- /dev/null +++ b/features/v2/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/features/v2/undo.json b/features/v2/undo.json index 9101d0155cbe..462e12c0ea4f 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -5041,6 +5041,12 @@ "type": "idempotent" } }, + "ListNetworkHealthInsights": { + "tag": "Network Health Insights", + "undo": { + "type": "safe" + } + }, "GetAggregatedConnections": { "tag": "Cloud Network Monitoring", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 832ee7adb038..4414f7249a48 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -538,6 +538,7 @@ def initialize "v2.update_monitor_user_template": false, "v2.validate_existing_monitor_user_template": false, "v2.validate_monitor_user_template": false, + "v2.list_network_health_insights": false, "v2.delete_scopes_restriction": false, "v2.get_o_auth2_well_known_sites": false, "v2.get_scopes_restriction": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 6bcb0f8a7651..07d91e8ade69 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -4597,6 +4597,13 @@ def overrides "v2.mute_findings_response_data" => "MuteFindingsResponseData", "v2.ndk_sourcemap_attributes" => "NDKSourcemapAttributes", "v2.ndk_sourcemap_data" => "NDKSourcemapData", + "v2.network_health_insight" => "NetworkHealthInsight", + "v2.network_health_insight_attributes" => "NetworkHealthInsightAttributes", + "v2.network_health_insight_category" => "NetworkHealthInsightCategory", + "v2.network_health_insight_failure_type" => "NetworkHealthInsightFailureType", + "v2.network_health_insights_response" => "NetworkHealthInsightsResponse", + "v2.network_health_insights_type" => "NetworkHealthInsightsType", + "v2.network_health_insight_traffic_volume" => "NetworkHealthInsightTrafficVolume", "v2.node_types_response" => "NodeTypesResponse", "v2.node_types_response_data" => "NodeTypesResponseData", "v2.node_types_response_data_attributes" => "NodeTypesResponseDataAttributes", @@ -7522,6 +7529,7 @@ def overrides "v2.model_lab_api_api" => "ModelLabAPIAPI", "v2.monitors_api" => "MonitorsAPI", "v2.network_device_monitoring_api" => "NetworkDeviceMonitoringAPI", + "v2.network_health_insights_api" => "NetworkHealthInsightsAPI", "v2.o_auth2_client_public_api" => "OAuth2ClientPublicAPI", "v2.observability_pipelines_api" => "ObservabilityPipelinesAPI", "v2.oci_integration_api" => "OCIIntegrationAPI", diff --git a/lib/datadog_api_client/v2/api/network_health_insights_api.rb b/lib/datadog_api_client/v2/api/network_health_insights_api.rb new file mode 100644 index 000000000000..142376839c97 --- /dev/null +++ b/lib/datadog_api_client/v2/api/network_health_insights_api.rb @@ -0,0 +1,100 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'cgi' + +module DatadogAPIClient::V2 + class NetworkHealthInsightsAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # List network health insights. + # + # @see #list_network_health_insights_with_http_info + def list_network_health_insights(opts = {}) + data, _status_code, _headers = list_network_health_insights_with_http_info(opts) + data + end + + # List network health insights. + # + # 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 opts [Hash] the optional parameters + # @option opts [String] :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]`. + # @option opts [String] :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]`. + # @return [Array<(NetworkHealthInsightsResponse, Integer, Hash)>] NetworkHealthInsightsResponse data, response status code and response headers + def list_network_health_insights_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_network_health_insights".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_network_health_insights") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_network_health_insights")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: NetworkHealthInsightsAPI.list_network_health_insights ...' + end + # resource path + local_var_path = '/api/v2/network-health-insights' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil? + query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'NetworkHealthInsightsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :list_network_health_insights, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: NetworkHealthInsightsAPI#list_network_health_insights\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/datadog_api_client/v2/models/network_health_insight.rb b/lib/datadog_api_client/v2/models/network_health_insight.rb new file mode 100644 index 000000000000..bc460a6c21ff --- /dev/null +++ b/lib/datadog_api_client/v2/models/network_health_insight.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A single network health insight describing a service-to-service connectivity issue. + class NetworkHealthInsight + include BaseGenericModel + + # Detailed attributes of a network health insight. + attr_reader :attributes + + # Unique identifier for this network health insight. + attr_reader :id + + # The resource type for network health insights. Always `network-health-insights`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'NetworkHealthInsightAttributes', + :'id' => :'String', + :'type' => :'NetworkHealthInsightsType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::NetworkHealthInsight` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/network_health_insight_attributes.rb b/lib/datadog_api_client/v2/models/network_health_insight_attributes.rb new file mode 100644 index 000000000000..7bdfdbd58c0a --- /dev/null +++ b/lib/datadog_api_client/v2/models/network_health_insight_attributes.rb @@ -0,0 +1,328 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Detailed attributes of a network health insight. + class NetworkHealthInsightAttributes + include BaseGenericModel + + # AWS account identifier where the certificate is located. Only set for `tls-cert` insights. + attr_accessor :account_id + + # ARN or identifier of the certificate. Only set for `tls-cert` insights. + attr_accessor :certificate_id + + # Percentage of the certificate's validity period that has elapsed, ranging from 0 to 100. + # Only set for `tls-cert` insights. + attr_accessor :certificate_lifetime_percent + + # AWS region where the client is located. Only set for `tls-cert` insights. + attr_accessor :client_region + + # Name of the service making the request (DNS query or TLS-secured connection). + # Set to `N/A` when the client service cannot be determined. + attr_accessor :client_service + + # Number of days remaining until the certificate expires. Negative values indicate the + # certificate has already expired. Only set for `tls-cert` insights. + attr_accessor :days_until_expiration + + # Domain name that was being resolved when the DNS failure occurred. Only set for `dns` insights. + attr_accessor :dns_query + + # DNS server that received the failing query. Only set for `dns` insights. + attr_accessor :dns_server + + # Domain name covered by the certificate. Only set for `tls-cert` insights. + attr_accessor :domain_name + + # Count of failed events observed during the query window. Only set for `dns`, `tcp`, + # and `security-group` insights. + attr_reader :failure_magnitude + + # Percentage of requests that failed during the query window, ranging from 0 to 100. + # Only set for `dns`, `tcp`, and `security-group` insights. + attr_reader :failure_rate + + # 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`. + attr_accessor :failure_type + + # ARN of the load balancer using the certificate. Only set for `tls-cert` insights. + attr_accessor :loadbalancer_id + + # AWS region where the server or load balancer is located. Only set for `tls-cert` insights. + attr_accessor :server_region + + # Name of the target service the client was trying to reach. + attr_accessor :server_service + + # 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. + attr_reader :total_requests + + # Network traffic volume metrics between the client and server services during the query window. + attr_accessor :traffic_volume + + # 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`). + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'account_id' => :'account_id', + :'certificate_id' => :'certificate_id', + :'certificate_lifetime_percent' => :'certificate_lifetime_percent', + :'client_region' => :'client_region', + :'client_service' => :'client_service', + :'days_until_expiration' => :'days_until_expiration', + :'dns_query' => :'dns_query', + :'dns_server' => :'dns_server', + :'domain_name' => :'domain_name', + :'failure_magnitude' => :'failure_magnitude', + :'failure_rate' => :'failure_rate', + :'failure_type' => :'failure_type', + :'loadbalancer_id' => :'loadbalancer_id', + :'server_region' => :'server_region', + :'server_service' => :'server_service', + :'total_requests' => :'total_requests', + :'traffic_volume' => :'traffic_volume', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'account_id' => :'String', + :'certificate_id' => :'String', + :'certificate_lifetime_percent' => :'Float', + :'client_region' => :'String', + :'client_service' => :'String', + :'days_until_expiration' => :'Integer', + :'dns_query' => :'String', + :'dns_server' => :'String', + :'domain_name' => :'String', + :'failure_magnitude' => :'Integer', + :'failure_rate' => :'Float', + :'failure_type' => :'NetworkHealthInsightFailureType', + :'loadbalancer_id' => :'String', + :'server_region' => :'String', + :'server_service' => :'String', + :'total_requests' => :'Integer', + :'traffic_volume' => :'NetworkHealthInsightTrafficVolume', + :'type' => :'NetworkHealthInsightCategory' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::NetworkHealthInsightAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'certificate_id') + self.certificate_id = attributes[:'certificate_id'] + end + + if attributes.key?(:'certificate_lifetime_percent') + self.certificate_lifetime_percent = attributes[:'certificate_lifetime_percent'] + end + + if attributes.key?(:'client_region') + self.client_region = attributes[:'client_region'] + end + + if attributes.key?(:'client_service') + self.client_service = attributes[:'client_service'] + end + + if attributes.key?(:'days_until_expiration') + self.days_until_expiration = attributes[:'days_until_expiration'] + end + + if attributes.key?(:'dns_query') + self.dns_query = attributes[:'dns_query'] + end + + if attributes.key?(:'dns_server') + self.dns_server = attributes[:'dns_server'] + end + + if attributes.key?(:'domain_name') + self.domain_name = attributes[:'domain_name'] + end + + if attributes.key?(:'failure_magnitude') + self.failure_magnitude = attributes[:'failure_magnitude'] + end + + if attributes.key?(:'failure_rate') + self.failure_rate = attributes[:'failure_rate'] + end + + if attributes.key?(:'failure_type') + self.failure_type = attributes[:'failure_type'] + end + + if attributes.key?(:'loadbalancer_id') + self.loadbalancer_id = attributes[:'loadbalancer_id'] + end + + if attributes.key?(:'server_region') + self.server_region = attributes[:'server_region'] + end + + if attributes.key?(:'server_service') + self.server_service = attributes[:'server_service'] + end + + if attributes.key?(:'total_requests') + self.total_requests = attributes[:'total_requests'] + end + + if attributes.key?(:'traffic_volume') + self.traffic_volume = attributes[:'traffic_volume'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if !@failure_magnitude.nil? && @failure_magnitude < 0 + return false if !@failure_rate.nil? && @failure_rate > 100 + return false if !@failure_rate.nil? && @failure_rate < 0 + return false if !@total_requests.nil? && @total_requests < 0 + true + end + + # Custom attribute writer method with validation + # @param failure_magnitude [Object] Object to be assigned + # @!visibility private + def failure_magnitude=(failure_magnitude) + if !failure_magnitude.nil? && failure_magnitude < 0 + fail ArgumentError, 'invalid value for "failure_magnitude", must be greater than or equal to 0.' + end + @failure_magnitude = failure_magnitude + end + + # Custom attribute writer method with validation + # @param failure_rate [Object] Object to be assigned + # @!visibility private + def failure_rate=(failure_rate) + if !failure_rate.nil? && failure_rate > 100 + fail ArgumentError, 'invalid value for "failure_rate", must be smaller than or equal to 100.' + end + if !failure_rate.nil? && failure_rate < 0 + fail ArgumentError, 'invalid value for "failure_rate", must be greater than or equal to 0.' + end + @failure_rate = failure_rate + end + + # Custom attribute writer method with validation + # @param total_requests [Object] Object to be assigned + # @!visibility private + def total_requests=(total_requests) + if !total_requests.nil? && total_requests < 0 + fail ArgumentError, 'invalid value for "total_requests", must be greater than or equal to 0.' + end + @total_requests = total_requests + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + account_id == o.account_id && + certificate_id == o.certificate_id && + certificate_lifetime_percent == o.certificate_lifetime_percent && + client_region == o.client_region && + client_service == o.client_service && + days_until_expiration == o.days_until_expiration && + dns_query == o.dns_query && + dns_server == o.dns_server && + domain_name == o.domain_name && + failure_magnitude == o.failure_magnitude && + failure_rate == o.failure_rate && + failure_type == o.failure_type && + loadbalancer_id == o.loadbalancer_id && + server_region == o.server_region && + server_service == o.server_service && + total_requests == o.total_requests && + traffic_volume == o.traffic_volume && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [account_id, certificate_id, certificate_lifetime_percent, client_region, client_service, days_until_expiration, dns_query, dns_server, domain_name, failure_magnitude, failure_rate, failure_type, loadbalancer_id, server_region, server_service, total_requests, traffic_volume, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/network_health_insight_category.rb b/lib/datadog_api_client/v2/models/network_health_insight_category.rb new file mode 100644 index 000000000000..91b72338e201 --- /dev/null +++ b/lib/datadog_api_client/v2/models/network_health_insight_category.rb @@ -0,0 +1,30 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # 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`). + class NetworkHealthInsightCategory + include BaseEnumModel + + DNS = "dns".freeze + TCP = "tcp".freeze + TLS_CERT = "tls-cert".freeze + SECURITY_GROUP = "security-group".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/network_health_insight_failure_type.rb b/lib/datadog_api_client/v2/models/network_health_insight_failure_type.rb new file mode 100644 index 000000000000..5d67c1bccf27 --- /dev/null +++ b/lib/datadog_api_client/v2/models/network_health_insight_failure_type.rb @@ -0,0 +1,34 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # 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`. + class NetworkHealthInsightFailureType + include BaseEnumModel + + TIMEOUT = "timeout".freeze + NXDOMAIN = "nxdomain".freeze + SERVFAIL = "servfail".freeze + GENERAL_FAILURE = "general_failure".freeze + EXPIRED = "expired".freeze + EXPIRING_SOON = "expiring_soon".freeze + DENIED = "denied".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/network_health_insight_traffic_volume.rb b/lib/datadog_api_client/v2/models/network_health_insight_traffic_volume.rb new file mode 100644 index 000000000000..a0f75570f2e3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/network_health_insight_traffic_volume.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Network traffic volume metrics between the client and server services during the query window. + class NetworkHealthInsightTrafficVolume + include BaseGenericModel + + # Total bytes read from the server to the client during the query window. + attr_accessor :bytes_read + + # Total bytes written from the client to the server during the query window. + attr_accessor :bytes_written + + # Sum of bytes written and bytes read across the query window. + attr_accessor :total_traffic + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'bytes_read' => :'bytes_read', + :'bytes_written' => :'bytes_written', + :'total_traffic' => :'total_traffic' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'bytes_read' => :'Integer', + :'bytes_written' => :'Integer', + :'total_traffic' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::NetworkHealthInsightTrafficVolume` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'bytes_read') + self.bytes_read = attributes[:'bytes_read'] + end + + if attributes.key?(:'bytes_written') + self.bytes_written = attributes[:'bytes_written'] + end + + if attributes.key?(:'total_traffic') + self.total_traffic = attributes[:'total_traffic'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + bytes_read == o.bytes_read && + bytes_written == o.bytes_written && + total_traffic == o.total_traffic && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [bytes_read, bytes_written, total_traffic, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/network_health_insights_response.rb b/lib/datadog_api_client/v2/models/network_health_insights_response.rb new file mode 100644 index 000000000000..8f8f86a0be70 --- /dev/null +++ b/lib/datadog_api_client/v2/models/network_health_insights_response.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing a list of network health insights for the organization. + class NetworkHealthInsightsResponse + include BaseGenericModel + + # Array of network health insights returned for the query window. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::NetworkHealthInsightsResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/network_health_insights_type.rb b/lib/datadog_api_client/v2/models/network_health_insights_type.rb new file mode 100644 index 000000000000..61e365d23b18 --- /dev/null +++ b/lib/datadog_api_client/v2/models/network_health_insights_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The resource type for network health insights. Always `network-health-insights`. + class NetworkHealthInsightsType + include BaseEnumModel + + NETWORK_HEALTH_INSIGHTS = "network-health-insights".freeze + end +end