Skip to content

Commit c5089f0

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit c0287407 of spec repo
1 parent ab68c89 commit c5089f0

8 files changed

+55
-10
lines changed

.apigentools-info

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2025-04-14 08:41:51.365494",
8-
"spec_repo_commit": "e73254d7"
7+
"regenerated": "2025-04-14 16:33:06.797040",
8+
"spec_repo_commit": "c0287407"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-04-14 08:41:51.382445",
13-
"spec_repo_commit": "e73254d7"
12+
"regenerated": "2025-04-14 16:33:06.813573",
13+
"spec_repo_commit": "c0287407"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -46074,6 +46074,13 @@ paths:
4607446074
required: true
4607546075
schema:
4607646076
type: string
46077+
- description: Whether to get the IP addresses of the interfaces.
46078+
example: true
46079+
in: query
46080+
name: get_ip_addresses
46081+
required: false
46082+
schema:
46083+
type: boolean
4607746084
responses:
4607846085
'200':
4607946086
content:

examples/v2_network-device-monitoring_GetInterfaces.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
// Get the list of interfaces of the device returns "OK" response
22
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_network_device_monitoring::GetInterfacesOptionalParams;
34
use datadog_api_client::datadogV2::api_network_device_monitoring::NetworkDeviceMonitoringAPI;
45

56
#[tokio::main]
67
async fn main() {
78
let configuration = datadog::Configuration::new();
89
let api = NetworkDeviceMonitoringAPI::with_config(configuration);
9-
let resp = api.get_interfaces("default:1.2.3.4".to_string()).await;
10+
let resp = api
11+
.get_interfaces(
12+
"default:1.2.3.4".to_string(),
13+
GetInterfacesOptionalParams::default().get_ip_addresses(true),
14+
)
15+
.await;
1016
if let Ok(value) = resp {
1117
println!("{:#?}", value);
1218
} else {

src/datadogV2/api/api_network_device_monitoring.rs

+26-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,22 @@ use reqwest::header::{HeaderMap, HeaderValue};
1010
use serde::{Deserialize, Serialize};
1111
use std::io::Write;
1212

13+
/// GetInterfacesOptionalParams is a struct for passing parameters to the method [`NetworkDeviceMonitoringAPI::get_interfaces`]
14+
#[non_exhaustive]
15+
#[derive(Clone, Default, Debug)]
16+
pub struct GetInterfacesOptionalParams {
17+
/// Whether to get the IP addresses of the interfaces.
18+
pub get_ip_addresses: Option<bool>,
19+
}
20+
21+
impl GetInterfacesOptionalParams {
22+
/// Whether to get the IP addresses of the interfaces.
23+
pub fn get_ip_addresses(mut self, value: bool) -> Self {
24+
self.get_ip_addresses = Some(value);
25+
self
26+
}
27+
}
28+
1329
/// ListDevicesOptionalParams is a struct for passing parameters to the method [`NetworkDeviceMonitoringAPI::list_devices`]
1430
#[non_exhaustive]
1531
#[derive(Clone, Default, Debug)]
@@ -260,9 +276,10 @@ impl NetworkDeviceMonitoringAPI {
260276
pub async fn get_interfaces(
261277
&self,
262278
device_id: String,
279+
params: GetInterfacesOptionalParams,
263280
) -> Result<crate::datadogV2::model::GetInterfacesResponse, datadog::Error<GetInterfacesError>>
264281
{
265-
match self.get_interfaces_with_http_info(device_id).await {
282+
match self.get_interfaces_with_http_info(device_id, params).await {
266283
Ok(response_content) => {
267284
if let Some(e) = response_content.entity {
268285
Ok(e)
@@ -280,13 +297,17 @@ impl NetworkDeviceMonitoringAPI {
280297
pub async fn get_interfaces_with_http_info(
281298
&self,
282299
device_id: String,
300+
params: GetInterfacesOptionalParams,
283301
) -> Result<
284302
datadog::ResponseContent<crate::datadogV2::model::GetInterfacesResponse>,
285303
datadog::Error<GetInterfacesError>,
286304
> {
287305
let local_configuration = &self.config;
288306
let operation_id = "v2.get_interfaces";
289307

308+
// unbox and build optional parameters
309+
let get_ip_addresses = params.get_ip_addresses;
310+
290311
let local_client = &self.client;
291312

292313
let local_uri_str = format!(
@@ -297,6 +318,10 @@ impl NetworkDeviceMonitoringAPI {
297318
local_client.request(reqwest::Method::GET, local_uri_str.as_str());
298319

299320
local_req_builder = local_req_builder.query(&[("device_id", &device_id.to_string())]);
321+
if let Some(ref local_query_param) = get_ip_addresses {
322+
local_req_builder =
323+
local_req_builder.query(&[("get_ip_addresses", &local_query_param.to_string())]);
324+
};
300325

301326
// build headers
302327
let mut headers = HeaderMap::new();
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2024-07-05T14:25:54.313Z
1+
2025-04-09T22:39:12.378Z

tests/scenarios/cassettes/v2/network_device_monitoring/Get-the-list-of-interfaces-of-the-device-returns-OK-response.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
]
1010
},
1111
"method": "get",
12-
"uri": "https://api.datadoghq.com/api/v2/ndm/interfaces?device_id=default:1.2.3.4"
12+
"uri": "https://api.datadoghq.com/api/v2/ndm/interfaces?device_id=default%3A1.2.3.4&get_ip_addresses=true"
1313
},
1414
"response": {
1515
"body": {
@@ -26,7 +26,7 @@
2626
"message": "OK"
2727
}
2828
},
29-
"recorded_at": "Fri, 05 Jul 2024 14:25:54 GMT"
29+
"recorded_at": "Wed, 09 Apr 2025 22:39:12 GMT"
3030
}
3131
],
3232
"recorded_with": "VCR 6.0.0"

tests/scenarios/features/v2/network_device_monitoring.feature

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ Feature: Network Device Monitoring
7979
Scenario: Get the list of interfaces of the device returns "OK" response
8080
Given new "GetInterfaces" request
8181
And request contains "device_id" parameter with value "default:1.2.3.4"
82+
And request contains "get_ip_addresses" parameter with value true
8283
When the request is sent
8384
Then the response status is 200 OK
8485
And the response "data[0].type" is equal to "interface"

tests/scenarios/function_mappings.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -19630,7 +19630,13 @@ fn test_v2_get_interfaces(world: &mut DatadogWorld, _parameters: &HashMap<String
1963019630
.as_ref()
1963119631
.expect("api instance not found");
1963219632
let device_id = serde_json::from_value(_parameters.get("device_id").unwrap().clone()).unwrap();
19633-
let response = match block_on(api.get_interfaces_with_http_info(device_id)) {
19633+
let get_ip_addresses = _parameters
19634+
.get("get_ip_addresses")
19635+
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
19636+
let mut params =
19637+
datadogV2::api_network_device_monitoring::GetInterfacesOptionalParams::default();
19638+
params.get_ip_addresses = get_ip_addresses;
19639+
let response = match block_on(api.get_interfaces_with_http_info(device_id, params)) {
1963419640
Ok(response) => response,
1963519641
Err(error) => {
1963619642
return match error {

0 commit comments

Comments
 (0)