Skip to content
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
80 changes: 80 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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.
Expand Down
14 changes: 14 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14578,6 +14578,20 @@ datadog\_api\_client.v2.model.list\_findings\_response module
:members:
:show-inheritance:

datadog\_api\_client.v2.model.list\_interface\_tags\_response module
--------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.list_interface_tags_response
:members:
:show-inheritance:

datadog\_api\_client.v2.model.list\_interface\_tags\_response\_data module
--------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.list_interface_tags_response_data
:members:
:show-inheritance:

datadog\_api\_client.v2.model.list\_kind\_catalog\_response module
------------------------------------------------------------------

Expand Down
15 changes: 15 additions & 0 deletions examples/v2/network-device-monitoring/ListInterfaceUserTags.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
List tags for an interface returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.network_device_monitoring_api import NetworkDeviceMonitoringApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = NetworkDeviceMonitoringApi(api_client)
response = api_instance.list_interface_user_tags(
interface_id="example:1.2.3.4:1",
)

print(response)
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""
Update the tags for an interface returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.network_device_monitoring_api import NetworkDeviceMonitoringApi
from datadog_api_client.v2.model.list_interface_tags_response import ListInterfaceTagsResponse
from datadog_api_client.v2.model.list_interface_tags_response_data import ListInterfaceTagsResponseData
from datadog_api_client.v2.model.list_tags_response_data_attributes import ListTagsResponseDataAttributes

body = ListInterfaceTagsResponse(
data=ListInterfaceTagsResponseData(
attributes=ListTagsResponseDataAttributes(
tags=[
"tag:test",
"tag:testbis",
],
),
id="example:1.2.3.4:1",
type="tags",
),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = NetworkDeviceMonitoringApi(api_client)
response = api_instance.update_interface_user_tags(interface_id="example:1.2.3.4:1", body=body)

print(response)
88 changes: 88 additions & 0 deletions src/datadog_api_client/v2/api/network_device_monitoring_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from datadog_api_client.v2.model.get_device_response import GetDeviceResponse
from datadog_api_client.v2.model.get_interfaces_response import GetInterfacesResponse
from datadog_api_client.v2.model.list_tags_response import ListTagsResponse
from datadog_api_client.v2.model.list_interface_tags_response import ListInterfaceTagsResponse


class NetworkDeviceMonitoringApi:
Expand Down Expand Up @@ -142,6 +143,29 @@ def __init__(self, api_client=None):
api_client=api_client,
)

self._list_interface_user_tags_endpoint = _Endpoint(
settings={
"response_type": (ListInterfaceTagsResponse,),
"auth": ["apiKeyAuth", "appKeyAuth"],
"endpoint_path": "/api/v2/ndm/tags/interfaces/{interface_id}",
"operation_id": "list_interface_user_tags",
"http_method": "GET",
"version": "v2",
},
params_map={
"interface_id": {
"required": True,
"openapi_types": (str,),
"attribute": "interface_id",
"location": "path",
},
},
headers_map={
"accept": ["application/json"],
},
api_client=api_client,
)

self._update_device_user_tags_endpoint = _Endpoint(
settings={
"response_type": (ListTagsResponse,),
Expand All @@ -168,6 +192,32 @@ def __init__(self, api_client=None):
api_client=api_client,
)

self._update_interface_user_tags_endpoint = _Endpoint(
settings={
"response_type": (ListInterfaceTagsResponse,),
"auth": ["apiKeyAuth", "appKeyAuth"],
"endpoint_path": "/api/v2/ndm/tags/interfaces/{interface_id}",
"operation_id": "update_interface_user_tags",
"http_method": "PATCH",
"version": "v2",
},
params_map={
"interface_id": {
"required": True,
"openapi_types": (str,),
"attribute": "interface_id",
"location": "path",
},
"body": {
"required": True,
"openapi_types": (ListInterfaceTagsResponse,),
"location": "body",
},
},
headers_map={"accept": ["application/json"], "content_type": ["application/json"]},
api_client=api_client,
)

def get_device(
self,
device_id: str,
Expand Down Expand Up @@ -312,6 +362,23 @@ def list_device_user_tags(

return self._list_device_user_tags_endpoint.call_with_http_info(**kwargs)

def list_interface_user_tags(
self,
interface_id: str,
) -> ListInterfaceTagsResponse:
"""List tags for an interface.

Returns the tags associated with the specified interface.

:param interface_id: The ID of the interface for which to retrieve tags.
:type interface_id: str
:rtype: ListInterfaceTagsResponse
"""
kwargs: Dict[str, Any] = {}
kwargs["interface_id"] = interface_id

return self._list_interface_user_tags_endpoint.call_with_http_info(**kwargs)

def update_device_user_tags(
self,
device_id: str,
Expand All @@ -332,3 +399,24 @@ def update_device_user_tags(
kwargs["body"] = body

return self._update_device_user_tags_endpoint.call_with_http_info(**kwargs)

def update_interface_user_tags(
self,
interface_id: str,
body: ListInterfaceTagsResponse,
) -> ListInterfaceTagsResponse:
"""Update the tags for an interface.

Updates the tags associated with the specified interface.

:param interface_id: The ID of the interface for which to update tags.
:type interface_id: str
:type body: ListInterfaceTagsResponse
:rtype: ListInterfaceTagsResponse
"""
kwargs: Dict[str, Any] = {}
kwargs["interface_id"] = interface_id

kwargs["body"] = body

return self._update_interface_user_tags_endpoint.call_with_http_info(**kwargs)
42 changes: 42 additions & 0 deletions src/datadog_api_client/v2/model/list_interface_tags_response.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# 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.
from __future__ import annotations

from typing import Union, TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
unset,
UnsetType,
)


if TYPE_CHECKING:
from datadog_api_client.v2.model.list_interface_tags_response_data import ListInterfaceTagsResponseData


class ListInterfaceTagsResponse(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.list_interface_tags_response_data import ListInterfaceTagsResponseData

return {
"data": (ListInterfaceTagsResponseData,),
}

attribute_map = {
"data": "data",
}

def __init__(self_, data: Union[ListInterfaceTagsResponseData, UnsetType] = unset, **kwargs):
"""
Response for listing interface tags.

:param data: Response data for listing interface tags.
:type data: ListInterfaceTagsResponseData, optional
"""
if data is not unset:
kwargs["data"] = data
super().__init__(kwargs)
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# 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.
from __future__ import annotations

from typing import Union, TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
unset,
UnsetType,
)


if TYPE_CHECKING:
from datadog_api_client.v2.model.list_tags_response_data_attributes import ListTagsResponseDataAttributes


class ListInterfaceTagsResponseData(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.list_tags_response_data_attributes import ListTagsResponseDataAttributes

return {
"attributes": (ListTagsResponseDataAttributes,),
"id": (str,),
"type": (str,),
}

attribute_map = {
"attributes": "attributes",
"id": "id",
"type": "type",
}

def __init__(
self_,
attributes: Union[ListTagsResponseDataAttributes, UnsetType] = unset,
id: Union[str, UnsetType] = unset,
type: Union[str, UnsetType] = unset,
**kwargs,
):
"""
Response data for listing interface tags.

:param attributes: The definition of ListTagsResponseDataAttributes object.
:type attributes: ListTagsResponseDataAttributes, optional

:param id: The interface ID
:type id: str, optional

:param type: The type of the resource. The value should always be tags.
:type type: str, optional
"""
if attributes is not unset:
kwargs["attributes"] = attributes
if id is not unset:
kwargs["id"] = id
if type is not unset:
kwargs["type"] = type
super().__init__(kwargs)
Loading