Skip to content

Commit 457818b

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
and
ci.datadog-api-spec
authored
Update NDM GetInterfaces documentation to add get_ip_addresses param (#2799)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 4f04fe0 commit 457818b

File tree

7 files changed

+81
-12
lines changed

7 files changed

+81
-12
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:58.256306",
8-
"spec_repo_commit": "e73254d7"
7+
"regenerated": "2025-04-14 16:33:07.855657",
8+
"spec_repo_commit": "c0287407"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-04-14 08:41:58.272064",
13-
"spec_repo_commit": "e73254d7"
12+
"regenerated": "2025-04-14 16:33:07.871722",
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.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.datadog.api.client.ApiClient;
44
import com.datadog.api.client.ApiException;
55
import com.datadog.api.client.v2.api.NetworkDeviceMonitoringApi;
6+
import com.datadog.api.client.v2.api.NetworkDeviceMonitoringApi.GetInterfacesOptionalParameters;
67
import com.datadog.api.client.v2.model.GetInterfacesResponse;
78

89
public class Example {
@@ -11,7 +12,9 @@ public static void main(String[] args) {
1112
NetworkDeviceMonitoringApi apiInstance = new NetworkDeviceMonitoringApi(defaultClient);
1213

1314
try {
14-
GetInterfacesResponse result = apiInstance.getInterfaces("default:1.2.3.4");
15+
GetInterfacesResponse result =
16+
apiInstance.getInterfaces(
17+
"default:1.2.3.4", new GetInterfacesOptionalParameters().getIpAddresses(true));
1518
System.out.println(result);
1619
} catch (ApiException e) {
1720
System.err.println("Exception when calling NetworkDeviceMonitoringApi#getInterfaces");

src/main/java/com/datadog/api/client/v2/api/NetworkDeviceMonitoringApi.java

+60-5
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,22 @@ public CompletableFuture<ApiResponse<GetDeviceResponse>> getDeviceWithHttpInfoAs
181181
new GenericType<GetDeviceResponse>() {});
182182
}
183183

184+
/** Manage optional parameters to getInterfaces. */
185+
public static class GetInterfacesOptionalParameters {
186+
private Boolean getIpAddresses;
187+
188+
/**
189+
* Set getIpAddresses.
190+
*
191+
* @param getIpAddresses Whether to get the IP addresses of the interfaces. (optional)
192+
* @return GetInterfacesOptionalParameters
193+
*/
194+
public GetInterfacesOptionalParameters getIpAddresses(Boolean getIpAddresses) {
195+
this.getIpAddresses = getIpAddresses;
196+
return this;
197+
}
198+
}
199+
184200
/**
185201
* Get the list of interfaces of the device.
186202
*
@@ -191,7 +207,7 @@ public CompletableFuture<ApiResponse<GetDeviceResponse>> getDeviceWithHttpInfoAs
191207
* @throws ApiException if fails to make API call
192208
*/
193209
public GetInterfacesResponse getInterfaces(String deviceId) throws ApiException {
194-
return getInterfacesWithHttpInfo(deviceId).getData();
210+
return getInterfacesWithHttpInfo(deviceId, new GetInterfacesOptionalParameters()).getData();
195211
}
196212

197213
/**
@@ -203,7 +219,7 @@ public GetInterfacesResponse getInterfaces(String deviceId) throws ApiException
203219
* @return CompletableFuture&lt;GetInterfacesResponse&gt;
204220
*/
205221
public CompletableFuture<GetInterfacesResponse> getInterfacesAsync(String deviceId) {
206-
return getInterfacesWithHttpInfoAsync(deviceId)
222+
return getInterfacesWithHttpInfoAsync(deviceId, new GetInterfacesOptionalParameters())
207223
.thenApply(
208224
response -> {
209225
return response.getData();
@@ -213,7 +229,41 @@ public CompletableFuture<GetInterfacesResponse> getInterfacesAsync(String device
213229
/**
214230
* Get the list of interfaces of the device.
215231
*
232+
* <p>See {@link #getInterfacesWithHttpInfo}.
233+
*
216234
* @param deviceId The ID of the device to get interfaces from. (required)
235+
* @param parameters Optional parameters for the request.
236+
* @return GetInterfacesResponse
237+
* @throws ApiException if fails to make API call
238+
*/
239+
public GetInterfacesResponse getInterfaces(
240+
String deviceId, GetInterfacesOptionalParameters parameters) throws ApiException {
241+
return getInterfacesWithHttpInfo(deviceId, parameters).getData();
242+
}
243+
244+
/**
245+
* Get the list of interfaces of the device.
246+
*
247+
* <p>See {@link #getInterfacesWithHttpInfoAsync}.
248+
*
249+
* @param deviceId The ID of the device to get interfaces from. (required)
250+
* @param parameters Optional parameters for the request.
251+
* @return CompletableFuture&lt;GetInterfacesResponse&gt;
252+
*/
253+
public CompletableFuture<GetInterfacesResponse> getInterfacesAsync(
254+
String deviceId, GetInterfacesOptionalParameters parameters) {
255+
return getInterfacesWithHttpInfoAsync(deviceId, parameters)
256+
.thenApply(
257+
response -> {
258+
return response.getData();
259+
});
260+
}
261+
262+
/**
263+
* Get the list of interfaces of the device.
264+
*
265+
* @param deviceId The ID of the device to get interfaces from. (required)
266+
* @param parameters Optional parameters for the request.
217267
* @return ApiResponse&lt;GetInterfacesResponse&gt;
218268
* @throws ApiException if fails to make API call
219269
* @http.response.details
@@ -225,22 +275,24 @@ public CompletableFuture<GetInterfacesResponse> getInterfacesAsync(String device
225275
* <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr>
226276
* </table>
227277
*/
228-
public ApiResponse<GetInterfacesResponse> getInterfacesWithHttpInfo(String deviceId)
229-
throws ApiException {
278+
public ApiResponse<GetInterfacesResponse> getInterfacesWithHttpInfo(
279+
String deviceId, GetInterfacesOptionalParameters parameters) throws ApiException {
230280
Object localVarPostBody = null;
231281

232282
// verify the required parameter 'deviceId' is set
233283
if (deviceId == null) {
234284
throw new ApiException(
235285
400, "Missing the required parameter 'deviceId' when calling getInterfaces");
236286
}
287+
Boolean getIpAddresses = parameters.getIpAddresses;
237288
// create path and map variables
238289
String localVarPath = "/api/v2/ndm/interfaces";
239290

240291
List<Pair> localVarQueryParams = new ArrayList<Pair>();
241292
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
242293

243294
localVarQueryParams.addAll(apiClient.parameterToPairs("", "device_id", deviceId));
295+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "get_ip_addresses", getIpAddresses));
244296

245297
Invocation.Builder builder =
246298
apiClient.createBuilder(
@@ -268,10 +320,11 @@ public ApiResponse<GetInterfacesResponse> getInterfacesWithHttpInfo(String devic
268320
* <p>See {@link #getInterfacesWithHttpInfo}.
269321
*
270322
* @param deviceId The ID of the device to get interfaces from. (required)
323+
* @param parameters Optional parameters for the request.
271324
* @return CompletableFuture&lt;ApiResponse&lt;GetInterfacesResponse&gt;&gt;
272325
*/
273326
public CompletableFuture<ApiResponse<GetInterfacesResponse>> getInterfacesWithHttpInfoAsync(
274-
String deviceId) {
327+
String deviceId, GetInterfacesOptionalParameters parameters) {
275328
Object localVarPostBody = null;
276329

277330
// verify the required parameter 'deviceId' is set
@@ -282,13 +335,15 @@ public CompletableFuture<ApiResponse<GetInterfacesResponse>> getInterfacesWithHt
282335
400, "Missing the required parameter 'deviceId' when calling getInterfaces"));
283336
return result;
284337
}
338+
Boolean getIpAddresses = parameters.getIpAddresses;
285339
// create path and map variables
286340
String localVarPath = "/api/v2/ndm/interfaces";
287341

288342
List<Pair> localVarQueryParams = new ArrayList<Pair>();
289343
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
290344

291345
localVarQueryParams.addAll(apiClient.parameterToPairs("", "device_id", deviceId));
346+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "get_ip_addresses", getIpAddresses));
292347

293348
Invocation.Builder builder;
294349
try {
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2024-07-05T14:25:54.313Z
1+
2025-04-09T22:39:12.378Z

src/test/resources/cassettes/features/v2/Get_the_list_of_interfaces_of_the_device_returns_OK_response.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
"queryStringParameters": {
88
"device_id": [
99
"default:1.2.3.4"
10+
],
11+
"get_ip_addresses": [
12+
"true"
1013
]
1114
},
1215
"keepAlive": false,
@@ -28,6 +31,6 @@
2831
"timeToLive": {
2932
"unlimited": true
3033
},
31-
"id": "5a6a117e-682a-544c-1c30-e0f45537c11a"
34+
"id": "6c05b199-6e29-df1a-c976-189f432c5396"
3235
}
3336
]

src/test/resources/com/datadog/api/client/v2/api/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"

0 commit comments

Comments
 (0)