From d3f5f779de52f00ec09a04c39ac1684f142f3a27 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 17 Feb 2026 13:37:35 +0000 Subject: [PATCH] Regenerate client from commit 38784f5 of spec repo --- .generator/schemas/v2/openapi.yaml | 80 +++++ .../ListInterfaceUserTags.java | 24 ++ .../UpdateInterfaceUserTags.java | 39 +++ .../v2/api/NetworkDeviceMonitoringApi.java | 299 ++++++++++++++++++ .../v2/model/ListInterfaceTagsResponse.java | 137 ++++++++ .../model/ListInterfaceTagsResponseData.java | 193 +++++++++++ ...nterface_returns_Not_Found_response.freeze | 1 + ..._interface_returns_Not_Found_response.json | 28 ++ ...or_an_interface_returns_OK_response.freeze | 1 + ..._for_an_interface_returns_OK_response.json | 28 ++ ...nterface_returns_Not_Found_response.freeze | 1 + ..._interface_returns_Not_Found_response.json | 32 ++ ...or_an_interface_returns_OK_response.freeze | 1 + ..._for_an_interface_returns_OK_response.json | 32 ++ .../v2/api/network_device_monitoring.feature | 38 +++ .../com/datadog/api/client/v2/api/undo.json | 12 + 16 files changed, 946 insertions(+) create mode 100644 examples/v2/network-device-monitoring/ListInterfaceUserTags.java create mode 100644 examples/v2/network-device-monitoring/UpdateInterfaceUserTags.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ListInterfaceTagsResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ListInterfaceTagsResponseData.java create mode 100644 src/test/resources/cassettes/features/v2/List_tags_for_an_interface_returns_Not_Found_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/List_tags_for_an_interface_returns_Not_Found_response.json create mode 100644 src/test/resources/cassettes/features/v2/List_tags_for_an_interface_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/List_tags_for_an_interface_returns_OK_response.json create mode 100644 src/test/resources/cassettes/features/v2/Update_the_tags_for_an_interface_returns_Not_Found_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Update_the_tags_for_an_interface_returns_Not_Found_response.json create mode 100644 src/test/resources/cassettes/features/v2/Update_the_tags_for_an_interface_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Update_the_tags_for_an_interface_returns_OK_response.json diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 093a28a0b5b..72945c2c0fd 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -33939,6 +33939,25 @@ components: - data - meta type: object + ListInterfaceTagsResponse: + description: Response for listing interface tags. + properties: + data: + $ref: '#/components/schemas/ListInterfaceTagsResponseData' + type: object + ListInterfaceTagsResponseData: + description: Response data for listing interface tags. + properties: + attributes: + $ref: '#/components/schemas/ListTagsResponseDataAttributes' + id: + description: The interface ID + example: example:1.2.3.4:1 + type: string + type: + description: The type of the resource. The value should always be tags. + type: string + type: object ListKindCatalogResponse: description: List kind response. properties: @@ -86637,6 +86656,67 @@ paths: summary: Update the tags for a device tags: - Network Device Monitoring + /api/v2/ndm/tags/interfaces/{interface_id}: + get: + description: Returns the tags associated with the specified interface. + operationId: ListInterfaceUserTags + parameters: + - description: The ID of the interface for which to retrieve tags. + example: example:1.2.3.4:1 + in: path + name: interface_id + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ListInterfaceTagsResponse' + description: OK + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: List tags for an interface + tags: + - Network Device Monitoring + patch: + description: Updates the tags associated with the specified interface. + operationId: UpdateInterfaceUserTags + parameters: + - description: The ID of the interface for which to update tags. + example: example:1.2.3.4:1 + in: path + name: interface_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ListInterfaceTagsResponse' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ListInterfaceTagsResponse' + description: OK + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Update the tags for an interface + tags: + - Network Device Monitoring /api/v2/network/connections/aggregate: get: description: Get all aggregated connections. diff --git a/examples/v2/network-device-monitoring/ListInterfaceUserTags.java b/examples/v2/network-device-monitoring/ListInterfaceUserTags.java new file mode 100644 index 00000000000..d002c97d201 --- /dev/null +++ b/examples/v2/network-device-monitoring/ListInterfaceUserTags.java @@ -0,0 +1,24 @@ +// List tags for an interface returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.NetworkDeviceMonitoringApi; +import com.datadog.api.client.v2.model.ListInterfaceTagsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + NetworkDeviceMonitoringApi apiInstance = new NetworkDeviceMonitoringApi(defaultClient); + + try { + ListInterfaceTagsResponse result = apiInstance.listInterfaceUserTags("example:1.2.3.4:1"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling NetworkDeviceMonitoringApi#listInterfaceUserTags"); + 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/examples/v2/network-device-monitoring/UpdateInterfaceUserTags.java b/examples/v2/network-device-monitoring/UpdateInterfaceUserTags.java new file mode 100644 index 00000000000..a23c97de6ba --- /dev/null +++ b/examples/v2/network-device-monitoring/UpdateInterfaceUserTags.java @@ -0,0 +1,39 @@ +// Update the tags for an interface returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.NetworkDeviceMonitoringApi; +import com.datadog.api.client.v2.model.ListInterfaceTagsResponse; +import com.datadog.api.client.v2.model.ListInterfaceTagsResponseData; +import com.datadog.api.client.v2.model.ListTagsResponseDataAttributes; +import java.util.Arrays; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + NetworkDeviceMonitoringApi apiInstance = new NetworkDeviceMonitoringApi(defaultClient); + + ListInterfaceTagsResponse body = + new ListInterfaceTagsResponse() + .data( + new ListInterfaceTagsResponseData() + .attributes( + new ListTagsResponseDataAttributes() + .tags(Arrays.asList("tag:test", "tag:testbis"))) + .id("example:1.2.3.4:1") + .type("tags")); + + try { + ListInterfaceTagsResponse result = + apiInstance.updateInterfaceUserTags("example:1.2.3.4:1", body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling NetworkDeviceMonitoringApi#updateInterfaceUserTags"); + 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/v2/api/NetworkDeviceMonitoringApi.java b/src/main/java/com/datadog/api/client/v2/api/NetworkDeviceMonitoringApi.java index aa88ba02e62..c97dcaa5368 100644 --- a/src/main/java/com/datadog/api/client/v2/api/NetworkDeviceMonitoringApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/NetworkDeviceMonitoringApi.java @@ -9,6 +9,7 @@ import com.datadog.api.client.v2.model.GetDeviceResponse; import com.datadog.api.client.v2.model.GetInterfacesResponse; import com.datadog.api.client.v2.model.ListDevicesResponse; +import com.datadog.api.client.v2.model.ListInterfaceTagsResponse; import com.datadog.api.client.v2.model.ListTagsResponse; import jakarta.ws.rs.client.Invocation; import jakarta.ws.rs.core.GenericType; @@ -782,6 +783,145 @@ public CompletableFuture> listDeviceUserTagsWithHt new GenericType() {}); } + /** + * List tags for an interface. + * + *

See {@link #listInterfaceUserTagsWithHttpInfo}. + * + * @param interfaceId The ID of the interface for which to retrieve tags. (required) + * @return ListInterfaceTagsResponse + * @throws ApiException if fails to make API call + */ + public ListInterfaceTagsResponse listInterfaceUserTags(String interfaceId) throws ApiException { + return listInterfaceUserTagsWithHttpInfo(interfaceId).getData(); + } + + /** + * List tags for an interface. + * + *

See {@link #listInterfaceUserTagsWithHttpInfoAsync}. + * + * @param interfaceId The ID of the interface for which to retrieve tags. (required) + * @return CompletableFuture<ListInterfaceTagsResponse> + */ + public CompletableFuture listInterfaceUserTagsAsync( + String interfaceId) { + return listInterfaceUserTagsWithHttpInfoAsync(interfaceId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Returns the tags associated with the specified interface. + * + * @param interfaceId The ID of the interface for which to retrieve tags. (required) + * @return ApiResponse<ListInterfaceTagsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse listInterfaceUserTagsWithHttpInfo( + String interfaceId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'interfaceId' is set + if (interfaceId == null) { + throw new ApiException( + 400, "Missing the required parameter 'interfaceId' when calling listInterfaceUserTags"); + } + // create path and map variables + String localVarPath = + "/api/v2/ndm/tags/interfaces/{interface_id}" + .replaceAll( + "\\{" + "interface_id" + "\\}", apiClient.escapeString(interfaceId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.NetworkDeviceMonitoringApi.listInterfaceUserTags", + localVarPath, + new ArrayList(), + 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 tags for an interface. + * + *

See {@link #listInterfaceUserTagsWithHttpInfo}. + * + * @param interfaceId The ID of the interface for which to retrieve tags. (required) + * @return CompletableFuture<ApiResponse<ListInterfaceTagsResponse>> + */ + public CompletableFuture> + listInterfaceUserTagsWithHttpInfoAsync(String interfaceId) { + Object localVarPostBody = null; + + // verify the required parameter 'interfaceId' is set + if (interfaceId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'interfaceId' when calling listInterfaceUserTags")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/ndm/tags/interfaces/{interface_id}" + .replaceAll( + "\\{" + "interface_id" + "\\}", apiClient.escapeString(interfaceId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.NetworkDeviceMonitoringApi.listInterfaceUserTags", + localVarPath, + new ArrayList(), + 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() {}); + } + /** * Update the tags for a device. * @@ -937,4 +1077,163 @@ public CompletableFuture> updateDeviceUserTagsWith false, new GenericType() {}); } + + /** + * Update the tags for an interface. + * + *

See {@link #updateInterfaceUserTagsWithHttpInfo}. + * + * @param interfaceId The ID of the interface for which to update tags. (required) + * @param body (required) + * @return ListInterfaceTagsResponse + * @throws ApiException if fails to make API call + */ + public ListInterfaceTagsResponse updateInterfaceUserTags( + String interfaceId, ListInterfaceTagsResponse body) throws ApiException { + return updateInterfaceUserTagsWithHttpInfo(interfaceId, body).getData(); + } + + /** + * Update the tags for an interface. + * + *

See {@link #updateInterfaceUserTagsWithHttpInfoAsync}. + * + * @param interfaceId The ID of the interface for which to update tags. (required) + * @param body (required) + * @return CompletableFuture<ListInterfaceTagsResponse> + */ + public CompletableFuture updateInterfaceUserTagsAsync( + String interfaceId, ListInterfaceTagsResponse body) { + return updateInterfaceUserTagsWithHttpInfoAsync(interfaceId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Updates the tags associated with the specified interface. + * + * @param interfaceId The ID of the interface for which to update tags. (required) + * @param body (required) + * @return ApiResponse<ListInterfaceTagsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse updateInterfaceUserTagsWithHttpInfo( + String interfaceId, ListInterfaceTagsResponse body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'interfaceId' is set + if (interfaceId == null) { + throw new ApiException( + 400, "Missing the required parameter 'interfaceId' when calling updateInterfaceUserTags"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling updateInterfaceUserTags"); + } + // create path and map variables + String localVarPath = + "/api/v2/ndm/tags/interfaces/{interface_id}" + .replaceAll( + "\\{" + "interface_id" + "\\}", apiClient.escapeString(interfaceId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.NetworkDeviceMonitoringApi.updateInterfaceUserTags", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update the tags for an interface. + * + *

See {@link #updateInterfaceUserTagsWithHttpInfo}. + * + * @param interfaceId The ID of the interface for which to update tags. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<ListInterfaceTagsResponse>> + */ + public CompletableFuture> + updateInterfaceUserTagsWithHttpInfoAsync(String interfaceId, ListInterfaceTagsResponse body) { + Object localVarPostBody = body; + + // verify the required parameter 'interfaceId' is set + if (interfaceId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'interfaceId' when calling updateInterfaceUserTags")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling updateInterfaceUserTags")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/ndm/tags/interfaces/{interface_id}" + .replaceAll( + "\\{" + "interface_id" + "\\}", apiClient.escapeString(interfaceId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.NetworkDeviceMonitoringApi.updateInterfaceUserTags", + localVarPath, + new ArrayList(), + 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( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } } diff --git a/src/main/java/com/datadog/api/client/v2/model/ListInterfaceTagsResponse.java b/src/main/java/com/datadog/api/client/v2/model/ListInterfaceTagsResponse.java new file mode 100644 index 00000000000..85e2ad68429 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ListInterfaceTagsResponse.java @@ -0,0 +1,137 @@ +/* + * 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; + +/** Response for listing interface tags. */ +@JsonPropertyOrder({ListInterfaceTagsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ListInterfaceTagsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private ListInterfaceTagsResponseData data; + + public ListInterfaceTagsResponse data(ListInterfaceTagsResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Response data for listing interface tags. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ListInterfaceTagsResponseData getData() { + return data; + } + + public void setData(ListInterfaceTagsResponseData 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 ListInterfaceTagsResponse + */ + @JsonAnySetter + public ListInterfaceTagsResponse 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 ListInterfaceTagsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListInterfaceTagsResponse listInterfaceTagsResponse = (ListInterfaceTagsResponse) o; + return Objects.equals(this.data, listInterfaceTagsResponse.data) + && Objects.equals( + this.additionalProperties, listInterfaceTagsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListInterfaceTagsResponse {\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/ListInterfaceTagsResponseData.java b/src/main/java/com/datadog/api/client/v2/model/ListInterfaceTagsResponseData.java new file mode 100644 index 00000000000..d719bbfc4b8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ListInterfaceTagsResponseData.java @@ -0,0 +1,193 @@ +/* + * 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; + +/** Response data for listing interface tags. */ +@JsonPropertyOrder({ + ListInterfaceTagsResponseData.JSON_PROPERTY_ATTRIBUTES, + ListInterfaceTagsResponseData.JSON_PROPERTY_ID, + ListInterfaceTagsResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ListInterfaceTagsResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private ListTagsResponseDataAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public ListInterfaceTagsResponseData attributes(ListTagsResponseDataAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The definition of ListTagsResponseDataAttributes object. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ListTagsResponseDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(ListTagsResponseDataAttributes attributes) { + this.attributes = attributes; + } + + public ListInterfaceTagsResponseData id(String id) { + this.id = id; + return this; + } + + /** + * The interface ID + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public ListInterfaceTagsResponseData type(String type) { + this.type = type; + return this; + } + + /** + * The type of the resource. The value should always be tags. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getType() { + return type; + } + + public void setType(String type) { + 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 ListInterfaceTagsResponseData + */ + @JsonAnySetter + public ListInterfaceTagsResponseData 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 ListInterfaceTagsResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListInterfaceTagsResponseData listInterfaceTagsResponseData = (ListInterfaceTagsResponseData) o; + return Objects.equals(this.attributes, listInterfaceTagsResponseData.attributes) + && Objects.equals(this.id, listInterfaceTagsResponseData.id) + && Objects.equals(this.type, listInterfaceTagsResponseData.type) + && Objects.equals( + this.additionalProperties, listInterfaceTagsResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListInterfaceTagsResponseData {\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/test/resources/cassettes/features/v2/List_tags_for_an_interface_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/List_tags_for_an_interface_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..a695995fbb6 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/List_tags_for_an_interface_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2026-02-17T10:20:35.870Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/List_tags_for_an_interface_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/List_tags_for_an_interface_returns_Not_Found_response.json new file mode 100644 index 00000000000..568a66ffec1 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/List_tags_for_an_interface_returns_Not_Found_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/ndm/tags/interfaces/unknown_interface_id", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"404\",\"title\":\"Not Found\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "94b7b6f4-0420-4394-bc2f-3a6085e34f25" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/List_tags_for_an_interface_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/List_tags_for_an_interface_returns_OK_response.freeze new file mode 100644 index 00000000000..e67a3791527 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/List_tags_for_an_interface_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-02-17T10:20:36.480Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/List_tags_for_an_interface_returns_OK_response.json b/src/test/resources/cassettes/features/v2/List_tags_for_an_interface_returns_OK_response.json new file mode 100644 index 00000000000..606ee24997c --- /dev/null +++ b/src/test/resources/cassettes/features/v2/List_tags_for_an_interface_returns_OK_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/ndm/tags/interfaces/example%3A1.2.3.4%3A1", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"example:1.2.3.4:1\",\"type\":\"tags\",\"attributes\":{\"tags\":[\"tag:test\",\"tag:testbis\"]}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "984680f7-fd2d-bf04-400e-46d0eb4be6d7" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_the_tags_for_an_interface_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Update_the_tags_for_an_interface_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..b5d1d980bf4 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_the_tags_for_an_interface_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2026-02-17T10:20:36.989Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_the_tags_for_an_interface_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/Update_the_tags_for_an_interface_returns_Not_Found_response.json new file mode 100644 index 00000000000..568002e28a3 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_the_tags_for_an_interface_returns_Not_Found_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"tags\":[\"tag:test\",\"tag:testbis\"]},\"id\":\"unknown_interface_id\",\"type\":\"tags\"}}" + }, + "headers": {}, + "method": "PATCH", + "path": "/api/v2/ndm/tags/interfaces/unknown_interface_id", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"404\",\"title\":\"Not Found\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "5307a138-eda8-d7fc-c5cd-2c716ae769aa" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_the_tags_for_an_interface_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Update_the_tags_for_an_interface_returns_OK_response.freeze new file mode 100644 index 00000000000..66efae74120 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_the_tags_for_an_interface_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-02-17T10:20:37.189Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_the_tags_for_an_interface_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Update_the_tags_for_an_interface_returns_OK_response.json new file mode 100644 index 00000000000..5a1724be0aa --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_the_tags_for_an_interface_returns_OK_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"tags\":[\"tag:test\",\"tag:testbis\"]},\"id\":\"example:1.2.3.4:1\",\"type\":\"tags\"}}" + }, + "headers": {}, + "method": "PATCH", + "path": "/api/v2/ndm/tags/interfaces/example%3A1.2.3.4%3A1", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"example:1.2.3.4:1\",\"type\":\"tags\",\"attributes\":{\"tags\":[\"tag:test\",\"tag:testbis\"]}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "471b978a-bd0a-aa8e-3829-526b91a99a4b" + } +] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v2/api/network_device_monitoring.feature b/src/test/resources/com/datadog/api/client/v2/api/network_device_monitoring.feature index f6f7a78f257..165564dc39c 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/network_device_monitoring.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/network_device_monitoring.feature @@ -124,6 +124,24 @@ Feature: Network Device Monitoring And the response "data.attributes.tags[0]" is equal to "tag:test" And the response "data.attributes.tags[1]" is equal to "tag:testbis" + @replay-only @team:DataDog/network-device-monitoring + Scenario: List tags for an interface returns "Not Found" response + Given new "ListInterfaceUserTags" request + And request contains "interface_id" parameter with value "unknown_interface_id" + When the request is sent + Then the response status is 404 Not Found + + @replay-only @team:DataDog/network-device-monitoring + Scenario: List tags for an interface returns "OK" response + Given new "ListInterfaceUserTags" request + And request contains "interface_id" parameter with value "example:1.2.3.4:1" + When the request is sent + Then the response status is 200 OK + And the response "data.id" is equal to "example:1.2.3.4:1" + And the response "data.type" is equal to "tags" + And the response "data.attributes.tags[0]" is equal to "tag:test" + And the response "data.attributes.tags[1]" is equal to "tag:testbis" + @replay-only @team:DataDog/network-device-monitoring Scenario: Update the tags for a device returns "Not Found" response Given new "UpdateDeviceUserTags" request @@ -143,3 +161,23 @@ Feature: Network Device Monitoring And the response "data.type" is equal to "tags" And the response "data.attributes.tags[0]" is equal to "tag:test" And the response "data.attributes.tags[1]" is equal to "tag:testbis" + + @replay-only @team:DataDog/network-device-monitoring + Scenario: Update the tags for an interface returns "Not Found" response + Given new "UpdateInterfaceUserTags" request + And request contains "interface_id" parameter with value "unknown_interface_id" + And body with value {"data": {"attributes": {"tags": ["tag:test", "tag:testbis"]}, "id": "unknown_interface_id", "type":"tags"}} + When the request is sent + Then the response status is 404 Not Found + + @replay-only @team:DataDog/network-device-monitoring + Scenario: Update the tags for an interface returns "OK" response + Given new "UpdateInterfaceUserTags" request + And request contains "interface_id" parameter with value "example:1.2.3.4:1" + And body with value {"data": {"attributes": {"tags": ["tag:test", "tag:testbis"]}, "id": "example:1.2.3.4:1", "type":"tags"}} + When the request is sent + Then the response status is 200 OK + And the response "data.id" is equal to "example:1.2.3.4:1" + And the response "data.type" is equal to "tags" + And the response "data.attributes.tags[0]" is equal to "tag:test" + And the response "data.attributes.tags[1]" is equal to "tag:testbis" 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 ef9246c8e64..5758d28e036 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 @@ -3197,6 +3197,18 @@ "type": "idempotent" } }, + "ListInterfaceUserTags": { + "tag": "Network Device Monitoring", + "undo": { + "type": "safe" + } + }, + "UpdateInterfaceUserTags": { + "tag": "Network Device Monitoring", + "undo": { + "type": "idempotent" + } + }, "GetAggregatedConnections": { "tag": "Cloud Network Monitoring", "undo": {