Skip to content

Commit c1ecc56

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Documentation for new device tags endpoints (#2072)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 6440f9d commit c1ecc56

21 files changed

+526
-5
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
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": "2024-08-02 13:54:00.520765",
8-
"spec_repo_commit": "74b2ffcb"
7+
"regenerated": "2024-08-05 16:34:56.168477",
8+
"spec_repo_commit": "578f6c8c"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-08-02 13:54:00.538746",
13-
"spec_repo_commit": "74b2ffcb"
12+
"regenerated": "2024-08-05 16:34:56.186208",
13+
"spec_repo_commit": "578f6c8c"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11330,6 +11330,37 @@ components:
1133011330
example: /api/v2/scorecard/rules?page%5Blimit%5D=2&page%5Boffset%5D=2&page%5Bsize%5D=2
1133111331
type: string
1133211332
type: object
11333+
ListTagsResponse:
11334+
description: List tags response.
11335+
properties:
11336+
data:
11337+
$ref: '#/components/schemas/ListTagsResponseData'
11338+
type: object
11339+
ListTagsResponseData:
11340+
description: The list tags response data.
11341+
properties:
11342+
attributes:
11343+
$ref: '#/components/schemas/ListTagsResponseDataAttributes'
11344+
id:
11345+
description: The device ID
11346+
example: example:1.2.3.4
11347+
type: string
11348+
type:
11349+
description: The type of the resource. The value should always be tags.
11350+
type: string
11351+
type: object
11352+
ListTagsResponseDataAttributes:
11353+
description: The definition of ListTagsResponseDataAttributes object.
11354+
properties:
11355+
tags:
11356+
description: The list of tags
11357+
example:
11358+
- tag:test
11359+
- tag:testbis
11360+
items:
11361+
type: string
11362+
type: array
11363+
type: object
1133311364
ListTeamsInclude:
1133411365
description: Included related resources optionally requested.
1133511366
enum:
@@ -31582,6 +31613,67 @@ paths:
3158231613
summary: Get the list of interfaces of the device
3158331614
tags:
3158431615
- Network Device Monitoring
31616+
/api/v2/ndm/tags/devices/{device_id}:
31617+
get:
31618+
description: Get the list of tags for a device.
31619+
operationId: ListDeviceUserTags
31620+
parameters:
31621+
- description: The id of the device to fetch tags for.
31622+
example: example:1.2.3.4
31623+
in: path
31624+
name: device_id
31625+
required: true
31626+
schema:
31627+
type: string
31628+
responses:
31629+
'200':
31630+
content:
31631+
application/json:
31632+
schema:
31633+
$ref: '#/components/schemas/ListTagsResponse'
31634+
description: OK
31635+
'403':
31636+
$ref: '#/components/responses/ForbiddenResponse'
31637+
'404':
31638+
$ref: '#/components/responses/NotFoundResponse'
31639+
'429':
31640+
$ref: '#/components/responses/TooManyRequestsResponse'
31641+
summary: Get the list of tags for a device
31642+
tags:
31643+
- Network Device Monitoring
31644+
patch:
31645+
description: Update the tags for a device.
31646+
operationId: UpdateDeviceUserTags
31647+
parameters:
31648+
- description: The id of the device to update tags for.
31649+
example: example:1.2.3.4
31650+
in: path
31651+
name: device_id
31652+
required: true
31653+
schema:
31654+
type: string
31655+
requestBody:
31656+
content:
31657+
application/json:
31658+
schema:
31659+
$ref: '#/components/schemas/ListTagsResponse'
31660+
required: true
31661+
responses:
31662+
'200':
31663+
content:
31664+
application/json:
31665+
schema:
31666+
$ref: '#/components/schemas/ListTagsResponse'
31667+
description: OK
31668+
'403':
31669+
$ref: '#/components/responses/ForbiddenResponse'
31670+
'404':
31671+
$ref: '#/components/responses/NotFoundResponse'
31672+
'429':
31673+
$ref: '#/components/responses/TooManyRequestsResponse'
31674+
summary: Update the tags for a device
31675+
tags:
31676+
- Network Device Monitoring
3158531677
/api/v2/org_configs:
3158631678
get:
3158731679
description: Returns all Org Configs (name, description, and value).

docs/datadog_api_client.v2.model.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4771,6 +4771,27 @@ datadog\_api\_client.v2.model.list\_rules\_response\_links module
47714771
:members:
47724772
:show-inheritance:
47734773

4774+
datadog\_api\_client.v2.model.list\_tags\_response module
4775+
---------------------------------------------------------
4776+
4777+
.. automodule:: datadog_api_client.v2.model.list_tags_response
4778+
:members:
4779+
:show-inheritance:
4780+
4781+
datadog\_api\_client.v2.model.list\_tags\_response\_data module
4782+
---------------------------------------------------------------
4783+
4784+
.. automodule:: datadog_api_client.v2.model.list_tags_response_data
4785+
:members:
4786+
:show-inheritance:
4787+
4788+
datadog\_api\_client.v2.model.list\_tags\_response\_data\_attributes module
4789+
---------------------------------------------------------------------------
4790+
4791+
.. automodule:: datadog_api_client.v2.model.list_tags_response_data_attributes
4792+
:members:
4793+
:show-inheritance:
4794+
47744795
datadog\_api\_client.v2.model.list\_teams\_include module
47754796
---------------------------------------------------------
47764797

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"""
2+
Get the list of tags for a device returns "OK" response
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v2.api.network_device_monitoring_api import NetworkDeviceMonitoringApi
7+
8+
configuration = Configuration()
9+
with ApiClient(configuration) as api_client:
10+
api_instance = NetworkDeviceMonitoringApi(api_client)
11+
response = api_instance.list_device_user_tags(
12+
device_id="default_device",
13+
)
14+
15+
print(response)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"""
2+
Update the tags for a device returns "OK" response
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v2.api.network_device_monitoring_api import NetworkDeviceMonitoringApi
7+
from datadog_api_client.v2.model.list_tags_response import ListTagsResponse
8+
from datadog_api_client.v2.model.list_tags_response_data import ListTagsResponseData
9+
from datadog_api_client.v2.model.list_tags_response_data_attributes import ListTagsResponseDataAttributes
10+
11+
body = ListTagsResponse(
12+
data=ListTagsResponseData(
13+
attributes=ListTagsResponseDataAttributes(
14+
tags=[
15+
"tag:test",
16+
"tag:testbis",
17+
],
18+
),
19+
id="default_device",
20+
type="tags",
21+
),
22+
)
23+
24+
configuration = Configuration()
25+
with ApiClient(configuration) as api_client:
26+
api_instance = NetworkDeviceMonitoringApi(api_client)
27+
response = api_instance.update_device_user_tags(device_id="default_device", body=body)
28+
29+
print(response)

src/datadog_api_client/v2/api/network_device_monitoring_api.py

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from datadog_api_client.v2.model.list_devices_response import ListDevicesResponse
1515
from datadog_api_client.v2.model.get_device_response import GetDeviceResponse
1616
from datadog_api_client.v2.model.get_interfaces_response import GetInterfacesResponse
17+
from datadog_api_client.v2.model.list_tags_response import ListTagsResponse
1718

1819

1920
class NetworkDeviceMonitoringApi:
@@ -109,6 +110,55 @@ def __init__(self, api_client=None):
109110
api_client=api_client,
110111
)
111112

113+
self._list_device_user_tags_endpoint = _Endpoint(
114+
settings={
115+
"response_type": (ListTagsResponse,),
116+
"auth": ["apiKeyAuth", "appKeyAuth"],
117+
"endpoint_path": "/api/v2/ndm/tags/devices/{device_id}",
118+
"operation_id": "list_device_user_tags",
119+
"http_method": "GET",
120+
"version": "v2",
121+
},
122+
params_map={
123+
"device_id": {
124+
"required": True,
125+
"openapi_types": (str,),
126+
"attribute": "device_id",
127+
"location": "path",
128+
},
129+
},
130+
headers_map={
131+
"accept": ["application/json"],
132+
},
133+
api_client=api_client,
134+
)
135+
136+
self._update_device_user_tags_endpoint = _Endpoint(
137+
settings={
138+
"response_type": (ListTagsResponse,),
139+
"auth": ["apiKeyAuth", "appKeyAuth"],
140+
"endpoint_path": "/api/v2/ndm/tags/devices/{device_id}",
141+
"operation_id": "update_device_user_tags",
142+
"http_method": "PATCH",
143+
"version": "v2",
144+
},
145+
params_map={
146+
"device_id": {
147+
"required": True,
148+
"openapi_types": (str,),
149+
"attribute": "device_id",
150+
"location": "path",
151+
},
152+
"body": {
153+
"required": True,
154+
"openapi_types": (ListTagsResponse,),
155+
"location": "body",
156+
},
157+
},
158+
headers_map={"accept": ["application/json"], "content_type": ["application/json"]},
159+
api_client=api_client,
160+
)
161+
112162
def get_device(
113163
self,
114164
device_id: str,
@@ -179,3 +229,41 @@ def list_devices(
179229
kwargs["filter_tag"] = filter_tag
180230

181231
return self._list_devices_endpoint.call_with_http_info(**kwargs)
232+
233+
def list_device_user_tags(
234+
self,
235+
device_id: str,
236+
) -> ListTagsResponse:
237+
"""Get the list of tags for a device.
238+
239+
Get the list of tags for a device.
240+
241+
:param device_id: The id of the device to fetch tags for.
242+
:type device_id: str
243+
:rtype: ListTagsResponse
244+
"""
245+
kwargs: Dict[str, Any] = {}
246+
kwargs["device_id"] = device_id
247+
248+
return self._list_device_user_tags_endpoint.call_with_http_info(**kwargs)
249+
250+
def update_device_user_tags(
251+
self,
252+
device_id: str,
253+
body: ListTagsResponse,
254+
) -> ListTagsResponse:
255+
"""Update the tags for a device.
256+
257+
Update the tags for a device.
258+
259+
:param device_id: The id of the device to update tags for.
260+
:type device_id: str
261+
:type body: ListTagsResponse
262+
:rtype: ListTagsResponse
263+
"""
264+
kwargs: Dict[str, Any] = {}
265+
kwargs["device_id"] = device_id
266+
267+
kwargs["body"] = body
268+
269+
return self._update_device_user_tags_endpoint.call_with_http_info(**kwargs)
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2019-Present Datadog, Inc.
4+
from __future__ import annotations
5+
6+
from typing import Union, TYPE_CHECKING
7+
8+
from datadog_api_client.model_utils import (
9+
ModelNormal,
10+
cached_property,
11+
unset,
12+
UnsetType,
13+
)
14+
15+
16+
if TYPE_CHECKING:
17+
from datadog_api_client.v2.model.list_tags_response_data import ListTagsResponseData
18+
19+
20+
class ListTagsResponse(ModelNormal):
21+
@cached_property
22+
def openapi_types(_):
23+
from datadog_api_client.v2.model.list_tags_response_data import ListTagsResponseData
24+
25+
return {
26+
"data": (ListTagsResponseData,),
27+
}
28+
29+
attribute_map = {
30+
"data": "data",
31+
}
32+
33+
def __init__(self_, data: Union[ListTagsResponseData, UnsetType] = unset, **kwargs):
34+
"""
35+
List tags response.
36+
37+
:param data: The list tags response data.
38+
:type data: ListTagsResponseData, optional
39+
"""
40+
if data is not unset:
41+
kwargs["data"] = data
42+
super().__init__(kwargs)

0 commit comments

Comments
 (0)