Skip to content

Commit

Permalink
Regenerate client from commit 9b2cbc49 of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Jul 30, 2024
1 parent f33e892 commit f1f30ad
Show file tree
Hide file tree
Showing 21 changed files with 526 additions and 5 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-07-26 19:58:47.789565",
"spec_repo_commit": "2c4b4e85"
"regenerated": "2024-07-30 13:51:04.051733",
"spec_repo_commit": "9b2cbc49"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-07-26 19:58:47.806497",
"spec_repo_commit": "2c4b4e85"
"regenerated": "2024-07-30 13:51:04.068699",
"spec_repo_commit": "9b2cbc49"
}
}
}
92 changes: 92 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11316,6 +11316,37 @@ components:
example: /api/v2/scorecard/rules?page%5Blimit%5D=2&page%5Boffset%5D=2&page%5Bsize%5D=2
type: string
type: object
ListTagsResponse:
description: List tags response.
properties:
data:
$ref: '#/components/schemas/ListTagsResponseData'
type: object
ListTagsResponseData:
description: The list tags response data.
properties:
attributes:
$ref: '#/components/schemas/ListTagsResponseDataAttributes'
id:
description: The device ID
example: example:1.2.3.4
type: string
type:
description: The type of the resource. The value should always be tags.
type: string
type: object
ListTagsResponseDataAttributes:
description: The definition of ListTagsResponseDataAttributes object.
properties:
tags:
description: The list of tags
example:
- tag:test
- tag:testbis
items:
type: string
type: array
type: object
ListTeamsInclude:
description: Included related resources optionally requested.
enum:
Expand Down Expand Up @@ -31426,6 +31457,67 @@ paths:
summary: Get the list of interfaces of the device
tags:
- Network Device Monitoring
/api/v2/ndm/tags/devices/{device_id}:
get:
description: Get the list of tags for a device.
operationId: ListDeviceUserTags
parameters:
- description: The id of the device to fetch tags for.
example: example:1.2.3.4
in: path
name: device_id
required: true
schema:
type: string
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ListTagsResponse'
description: OK
'403':
$ref: '#/components/responses/ForbiddenResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
summary: Get the list of tags for a device
tags:
- Network Device Monitoring
patch:
description: Update the tags for a device.
operationId: UpdateDeviceUserTags
parameters:
- description: The id of the device to update tags for.
example: example:1.2.3.4
in: path
name: device_id
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ListTagsResponse'
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ListTagsResponse'
description: OK
'403':
$ref: '#/components/responses/ForbiddenResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
summary: Update the tags for a device
tags:
- Network Device Monitoring
/api/v2/org_configs:
get:
description: Returns all Org Configs (name, description, and value).
Expand Down
21 changes: 21 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4771,6 +4771,27 @@ datadog\_api\_client.v2.model.list\_rules\_response\_links module
:members:
:show-inheritance:

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

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

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

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

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

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

datadog\_api\_client.v2.model.list\_teams\_include module
---------------------------------------------------------

Expand Down
15 changes: 15 additions & 0 deletions examples/v2/network-device-monitoring/ListDeviceUserTags.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
Get the list of tags for a device 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_device_user_tags(
device_id="default_device",
)

print(response)
29 changes: 29 additions & 0 deletions examples/v2/network-device-monitoring/UpdateDeviceUserTags.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""
Update the tags for a device 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_tags_response import ListTagsResponse
from datadog_api_client.v2.model.list_tags_response_data import ListTagsResponseData
from datadog_api_client.v2.model.list_tags_response_data_attributes import ListTagsResponseDataAttributes

body = ListTagsResponse(
data=ListTagsResponseData(
attributes=ListTagsResponseDataAttributes(
tags=[
"tag:test",
"tag:testbis",
],
),
id="default_device",
type="tags",
),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = NetworkDeviceMonitoringApi(api_client)
response = api_instance.update_device_user_tags(device_id="default_device", 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 @@ -14,6 +14,7 @@
from datadog_api_client.v2.model.list_devices_response import ListDevicesResponse
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


class NetworkDeviceMonitoringApi:
Expand Down Expand Up @@ -109,6 +110,55 @@ def __init__(self, api_client=None):
api_client=api_client,
)

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

self._update_device_user_tags_endpoint = _Endpoint(
settings={
"response_type": (ListTagsResponse,),
"auth": ["apiKeyAuth", "appKeyAuth"],
"endpoint_path": "/api/v2/ndm/tags/devices/{device_id}",
"operation_id": "update_device_user_tags",
"http_method": "PATCH",
"version": "v2",
},
params_map={
"device_id": {
"required": True,
"openapi_types": (str,),
"attribute": "device_id",
"location": "path",
},
"body": {
"required": True,
"openapi_types": (ListTagsResponse,),
"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 @@ -179,3 +229,41 @@ def list_devices(
kwargs["filter_tag"] = filter_tag

return self._list_devices_endpoint.call_with_http_info(**kwargs)

def list_device_user_tags(
self,
device_id: str,
) -> ListTagsResponse:
"""Get the list of tags for a device.
Get the list of tags for a device.
:param device_id: The id of the device to fetch tags for.
:type device_id: str
:rtype: ListTagsResponse
"""
kwargs: Dict[str, Any] = {}
kwargs["device_id"] = device_id

return self._list_device_user_tags_endpoint.call_with_http_info(**kwargs)

def update_device_user_tags(
self,
device_id: str,
body: ListTagsResponse,
) -> ListTagsResponse:
"""Update the tags for a device.
Update the tags for a device.
:param device_id: The id of the device to update tags for.
:type device_id: str
:type body: ListTagsResponse
:rtype: ListTagsResponse
"""
kwargs: Dict[str, Any] = {}
kwargs["device_id"] = device_id

kwargs["body"] = body

return self._update_device_user_tags_endpoint.call_with_http_info(**kwargs)
42 changes: 42 additions & 0 deletions src/datadog_api_client/v2/model/list_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_tags_response_data import ListTagsResponseData


class ListTagsResponse(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.list_tags_response_data import ListTagsResponseData

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

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

def __init__(self_, data: Union[ListTagsResponseData, UnsetType] = unset, **kwargs):
"""
List tags response.
:param data: The list tags response data.
:type data: ListTagsResponseData, optional
"""
if data is not unset:
kwargs["data"] = data
super().__init__(kwargs)
Loading

0 comments on commit f1f30ad

Please sign in to comment.