Skip to content

Add specs for Cloud Network Monitoring API #2310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2025-03-31 17:39:58.222884",
"spec_repo_commit": "3826157e"
"regenerated": "2025-04-01 20:55:53.888631",
"spec_repo_commit": "f629f10b"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-03-31 17:39:58.238226",
"spec_repo_commit": "3826157e"
"regenerated": "2025-04-01 20:55:53.904596",
"spec_repo_commit": "f629f10b"
}
}
}
185 changes: 185 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30188,6 +30188,125 @@ components:
description: Link to the Incident created on ServiceNow
type: string
type: object
SingleAggregatedConnectionResponseArray:
description: The definition of `SingleAggregatedConnectionResponseArray` object.
example:
data:
- attributes:
bytes_sent_by_client: 100
bytes_sent_by_server: 200
group_bys:
client_team:
- networks
server_service:
- hucklebuck
packets_sent_by_client: 10
packets_sent_by_server: 20
rtt_micro_seconds: 800
tcp_closed_connections: 30
tcp_established_connections: 40
tcp_refusals: 7
tcp_resets: 5
tcp_retransmits: 30
tcp_timeouts: 6
id: client_team:networks, server_service:hucklebuck
type: aggregated_connection
properties:
data:
description: The `SingleAggregatedConnectionResponseArray` `data`.
items:
$ref: '#/components/schemas/SingleAggregatedConnectionResponseData'
type: array
type: object
SingleAggregatedConnectionResponseData:
description: The definition of `SingleAggregatedConnectionResponseData` object.
properties:
attributes:
$ref: '#/components/schemas/SingleAggregatedConnectionResponseDataAttributes'
id:
description: The `SingleAggregatedConnectionResponseData` `id`.
type: string
type:
$ref: '#/components/schemas/SingleAggregatedConnectionResponseDataType'
type: object
SingleAggregatedConnectionResponseDataAttributes:
description: The definition of `SingleAggregatedConnectionResponseDataAttributes`
object.
properties:
bytes_sent_by_client:
description: The total number of bytes sent by the client over the given
period.
format: int64
type: integer
bytes_sent_by_server:
description: The total number of bytes sent by the server over the given
period.
format: int64
type: integer
group_bys:
additionalProperties:
items:
type: string
type: array
description: The `attributes` `group_bys`.
type: object
packets_sent_by_client:
description: The total number of packets sent by the client over the given
period.
format: int64
type: integer
packets_sent_by_server:
description: The total number of packets sent by the server over the given
period.
format: int64
type: integer
rtt_micro_seconds:
description: Measured as TCP smoothed roundtrip time in microseconds (the
time between a TCP frame being sent and acknowledged).
format: int64
type: integer
tcp_closed_connections:
description: The number of TCP connections in a closed state. Measured in
connections per second from the client.
format: int64
type: integer
tcp_established_connections:
description: The number of TCP connections in an established state. Measured
in connections per second from the client.
format: int64
type: integer
tcp_refusals:
description: The number of TCP connections that were refused by the server.
Typically this indicates an attempt to connect to an IP/port that is not
receiving connections, or a firewall/security misconfiguration.
format: int64
type: integer
tcp_resets:
description: The number of TCP connections that were reset by the server.
format: int64
type: integer
tcp_retransmits:
description: TCP Retransmits represent detected failures that are retransmitted
to ensure delivery. Measured in count of retransmits from the client.
format: int64
type: integer
tcp_timeouts:
description: The number of TCP connections that timed out from the perspective
of the operating system. This can indicate general connectivity and latency
issues.
format: int64
type: integer
type: object
SingleAggregatedConnectionResponseDataType:
default: aggregated_connection
description: 'Aggregated connection resource type. Allowed enum values: `aggregated_connection`.

default: `aggregated_connection`'
enum:
- aggregated_connection
type: string
x-enum-varnames:
- AGGREGATED_CONNECTION
SlackIntegrationMetadata:
description: Incident integration metadata for the Slack integration.
properties:
Expand Down Expand Up @@ -44282,6 +44401,68 @@ paths:
summary: Update the tags for a device
tags:
- Network Device Monitoring
/api/v2/network/connections/aggregate:
get:
description: Get aggregated connections
operationId: GetAggregatedConnections
parameters:
- description: Unix timestamp (number of seconds since epoch) of the start of
the query window. If not provided, the start of the query window is 15 minutes
before the "to" timestamp. If neither "from" nor "to" are provided, the
query window is [now - 15m, now].
in: query
name: from
schema:
format: int64
type: integer
- description: Unix timestamp (number of seconds since epoch) of the end of
the query window. If not provided, the end of the query window is the current
time. If neither "from" nor "to" are provided, the query window is [now
- 15m, now].
in: query
name: to
schema:
format: int64
type: integer
- description: Comma-separated list of fields to group connections by.
in: query
name: group_by
schema:
type: string
- description: Comma-separated list of tags to filter connections by.
in: query
name: tags
schema:
type: string
- description: The number of connections to be returned. The maximum value is
5000.
in: query
name: limit
schema:
default: 100
format: int32
maximum: 5000
minimum: 1
type: integer
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/SingleAggregatedConnectionResponseArray'
description: OK
'400':
$ref: '#/components/responses/BadRequestResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
summary: Get aggregated connections
tags:
- Cloud Network Monitoring
x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback,

contact [Datadog support](https://docs.datadoghq.com/help/).

type: safe'
/api/v2/org_configs:
get:
description: Returns all Org Configs (name, description, and value).
Expand Down Expand Up @@ -53624,6 +53805,10 @@ tags:
and the `cloud_cost` data source. For more information, see the [Cloud Cost Management
documentation](https://docs.datadoghq.com/cloud_cost_management/).
name: Cloud Cost Management
- description: The Cloud Network Monitoring API allows you to fetch aggregated connections
and their attributes. See the [Cloud Network Monitoring page](https://docs.datadoghq.com/network_monitoring/cloud_network_monitoring/)
for more information.
name: Cloud Network Monitoring
- description: Manage your Datadog Cloudflare integration directly through the Datadog
API. See the [Cloudflare integration page](https://docs.datadoghq.com/integrations/cloudflare/)
for more information.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2025-03-31T18:18:50.338Z

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2025-03-31T18:18:50.770Z

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Get aggregated connections returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.unstable_operations["v2.get_aggregated_connections".to_sym] = true
end
api_instance = DatadogAPIClient::V2::CloudNetworkMonitoringAPI.new
p api_instance.get_aggregated_connections()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Quality Violation

Suggested change
p api_instance.get_aggregated_connections()
p api_instance.get_aggregated_connections
Do not use parentheses with methods that take no arguments (...read more)

The rule "Avoid parentheses when methods take no arguments" is part of the Ruby style guide. It suggests that when a method takes no arguments, you should not use parentheses. This is because the use of parentheses in such a case is redundant and unnecessary, and it can make your code more difficult to read and understand.

This rule is important because it promotes cleaner, more readable code. In Ruby, clean and readable code is highly valued. By following this rule, you can ensure your code is easier to understand and maintain, which is crucial for long-term project success.

To adhere to this rule, remove the parentheses when calling a method that does not require any arguments. For example, instead of writing 'test'.upcase(), you should write 'test'.upcase. Similarly, instead of Kernel.exit!(), write Kernel.exit!. However, note that there is an exception for super - super by itself is different from super(), so in this case, parentheses may be necessary.

View in Datadog  Leave us feedback  Documentation

7 changes: 7 additions & 0 deletions features/scenarios_model_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1765,6 +1765,13 @@
"device_id" => "String",
"body" => "ListTagsResponse",
},
"v2.GetAggregatedConnections" => {
"from" => "Integer",
"to" => "Integer",
"group_by" => "String",
"tags" => "String",
"limit" => "Integer",
},
Comment on lines +1768 to +1774

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Quality Violation

Consider using symbols instead of string hash keys (...read more)

In Ruby, it is a best practice to use symbols instead of strings as hash keys. This rule emphasizes that it's more efficient and idiomatic to use symbols for this purpose. Symbols are immutable and unique, which makes them ideal for identifying things, whereas strings are mutable and can create multiple objects for the same sequence of characters.

The importance of this rule lies in the performance and memory usage of your Ruby application. Using symbols as hash keys reduces memory usage because they are stored in memory only once during a Ruby process. This can make a significant difference in the efficiency of your application, especially when dealing with large data sets.

To ensure you're following good coding practices, always use symbols for hash keys unless there's a specific reason to use a string. A simple refactoring from values = { 'foo' => 42, 'bar' => 99, 'baz' => 123 } to values = { foo: 42, bar: 99, baz: 123 } will make your code compliant with this rule. This not only improves your code's performance but also makes it more readable and consistent with Ruby's conventions.

View in Datadog  Leave us feedback  Documentation

"v2.GetOrgConfig" => {
"org_config_name" => "String",
},
Expand Down
29 changes: 29 additions & 0 deletions features/v2/cloud_network_monitoring.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@endpoint(cloud-network-monitoring) @endpoint(cloud-network-monitoring-v2)
Feature: Cloud Network Monitoring
The Cloud Network Monitoring API allows you to fetch aggregated
connections and their attributes. See the [Cloud Network Monitoring page](
https://docs.datadoghq.com/network_monitoring/cloud_network_monitoring/)
for more information.

Background:
Given a valid "apiKeyAuth" key in the system
And a valid "appKeyAuth" key in the system
And an instance of "CloudNetworkMonitoring" API
And operation "GetAggregatedConnections" enabled
And new "GetAggregatedConnections" request

@generated @skip @team:Datadog/networks
Scenario: Get aggregated connections returns "Bad Request" response
When the request is sent
Then the response status is 400 Bad Request

@team:Datadog/networks
Scenario: Get aggregated connections returns "OK" response
When the request is sent
Then the response status is 200 OK

@skip-python @skip-ruby @team:Datadog/networks
Scenario: Get all aggregated connections returns "Bad Request" response
Given request contains "limit" parameter with value 6000
When the request is sent
Then the response status is 400 Bad Request
6 changes: 6 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -1744,6 +1744,12 @@
"type": "idempotent"
}
},
"GetAggregatedConnections": {
"tag": "Cloud Network Monitoring",
"undo": {
"type": "safe"
}
},
"ListOrgConfigs": {
"tag": "Organizations",
"undo": {
Expand Down
1 change: 1 addition & 0 deletions lib/datadog_api_client/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ def initialize
"v2.list_aws_namespaces": false,
"v2.update_aws_account": false,
"v2.list_aws_logs_services": false,
"v2.get_aggregated_connections": false,
"v2.cancel_historical_job": false,
"v2.convert_job_result_to_signal": false,
"v2.delete_historical_job": false,
Expand Down
5 changes: 5 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2793,6 +2793,10 @@ def overrides
"v2.service_definition_v2_version" => "ServiceDefinitionV2Version",
"v2.service_now_ticket" => "ServiceNowTicket",
"v2.service_now_ticket_result" => "ServiceNowTicketResult",
"v2.single_aggregated_connection_response_array" => "SingleAggregatedConnectionResponseArray",
"v2.single_aggregated_connection_response_data" => "SingleAggregatedConnectionResponseData",
"v2.single_aggregated_connection_response_data_attributes" => "SingleAggregatedConnectionResponseDataAttributes",
"v2.single_aggregated_connection_response_data_type" => "SingleAggregatedConnectionResponseDataType",
"v2.slack_integration_metadata" => "SlackIntegrationMetadata",
"v2.slack_integration_metadata_channel_item" => "SlackIntegrationMetadataChannelItem",
"v2.slack_trigger_wrapper" => "SlackTriggerWrapper",
Expand Down Expand Up @@ -3087,6 +3091,7 @@ def overrides
"v2.ci_visibility_pipelines_api" => "CIVisibilityPipelinesAPI",
"v2.ci_visibility_tests_api" => "CIVisibilityTestsAPI",
"v2.cloud_cost_management_api" => "CloudCostManagementAPI",
"v2.cloud_network_monitoring_api" => "CloudNetworkMonitoringAPI",
"v2.cloudflare_integration_api" => "CloudflareIntegrationAPI",
"v2.confluent_cloud_api" => "ConfluentCloudAPI",
"v2.container_images_api" => "ContainerImagesAPI",
Expand Down
Loading
Loading