|
| 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 Any, Dict, List, Union |
| 7 | + |
| 8 | +from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint |
| 9 | +from datadog_api_client.configuration import Configuration |
| 10 | +from datadog_api_client.model_utils import ( |
| 11 | + UnsetType, |
| 12 | + unset, |
| 13 | +) |
| 14 | +from datadog_api_client.v2.model.device_base_array import DeviceBaseArray |
| 15 | +from datadog_api_client.v2.model.device_details import DeviceDetails |
| 16 | + |
| 17 | + |
| 18 | +class EndUserDeviceMonitoringApi: |
| 19 | + """ |
| 20 | + Inspect devices reported by the Datadog Agent on end-user laptops, desktops, |
| 21 | + and mobile devices, including their health, hardware, and connectivity attributes. |
| 22 | + """ |
| 23 | + |
| 24 | + def __init__(self, api_client=None): |
| 25 | + if api_client is None: |
| 26 | + api_client = ApiClient(Configuration()) |
| 27 | + self.api_client = api_client |
| 28 | + |
| 29 | + self._get_eudm_device_endpoint = _Endpoint( |
| 30 | + settings={ |
| 31 | + "response_type": (DeviceDetails,), |
| 32 | + "auth": ["apiKeyAuth", "appKeyAuth"], |
| 33 | + "endpoint_path": "/api/v2/eudm/devices/{device_id}", |
| 34 | + "operation_id": "get_eudm_device", |
| 35 | + "http_method": "GET", |
| 36 | + "version": "v2", |
| 37 | + }, |
| 38 | + params_map={ |
| 39 | + "device_id": { |
| 40 | + "required": True, |
| 41 | + "openapi_types": (str,), |
| 42 | + "attribute": "device_id", |
| 43 | + "location": "path", |
| 44 | + }, |
| 45 | + }, |
| 46 | + headers_map={ |
| 47 | + "accept": ["application/json"], |
| 48 | + }, |
| 49 | + api_client=api_client, |
| 50 | + ) |
| 51 | + |
| 52 | + self._get_eudm_devices_endpoint = _Endpoint( |
| 53 | + settings={ |
| 54 | + "response_type": (DeviceBaseArray,), |
| 55 | + "auth": ["apiKeyAuth", "appKeyAuth"], |
| 56 | + "endpoint_path": "/api/v2/eudm/devices", |
| 57 | + "operation_id": "get_eudm_devices", |
| 58 | + "http_method": "GET", |
| 59 | + "version": "v2", |
| 60 | + }, |
| 61 | + params_map={ |
| 62 | + "bssid": { |
| 63 | + "openapi_types": ([str],), |
| 64 | + "attribute": "bssid", |
| 65 | + "location": "query", |
| 66 | + "collection_format": "multi", |
| 67 | + }, |
| 68 | + "page_limit": { |
| 69 | + "validation": { |
| 70 | + "inclusive_minimum": 1, |
| 71 | + }, |
| 72 | + "openapi_types": (int,), |
| 73 | + "attribute": "page[limit]", |
| 74 | + "location": "query", |
| 75 | + }, |
| 76 | + "page_cursor": { |
| 77 | + "openapi_types": (str,), |
| 78 | + "attribute": "page[cursor]", |
| 79 | + "location": "query", |
| 80 | + }, |
| 81 | + }, |
| 82 | + headers_map={ |
| 83 | + "accept": ["application/json"], |
| 84 | + }, |
| 85 | + api_client=api_client, |
| 86 | + ) |
| 87 | + |
| 88 | + def get_eudm_device( |
| 89 | + self, |
| 90 | + device_id: str, |
| 91 | + ) -> DeviceDetails: |
| 92 | + """Get a device. |
| 93 | +
|
| 94 | + :param device_id: Unique identifier of the device to fetch. Matches the Datadog host identifier. |
| 95 | + :type device_id: str |
| 96 | + :rtype: DeviceDetails |
| 97 | + """ |
| 98 | + kwargs: Dict[str, Any] = {} |
| 99 | + kwargs["device_id"] = device_id |
| 100 | + |
| 101 | + return self._get_eudm_device_endpoint.call_with_http_info(**kwargs) |
| 102 | + |
| 103 | + def get_eudm_devices( |
| 104 | + self, |
| 105 | + *, |
| 106 | + bssid: Union[List[str], UnsetType] = unset, |
| 107 | + page_limit: Union[int, UnsetType] = unset, |
| 108 | + page_cursor: Union[str, UnsetType] = unset, |
| 109 | + ) -> DeviceBaseArray: |
| 110 | + """Get all devices. |
| 111 | +
|
| 112 | + :param bssid: Filter devices to those currently associated with any of the given BSSID values. |
| 113 | + Each value must be a MAC-48 address; repeat the parameter to pass several values. |
| 114 | + :type bssid: [str], optional |
| 115 | + :param page_limit: Maximum number of devices to return in one page. Must be a positive integer. |
| 116 | + If not set, the response contains all matching devices. |
| 117 | + :type page_limit: int, optional |
| 118 | + :param page_cursor: Opaque cursor that selects the next page. Use the ``meta.page.after`` value |
| 119 | + of the previous response. Devices are ordered by ID. |
| 120 | + :type page_cursor: str, optional |
| 121 | + :rtype: DeviceBaseArray |
| 122 | + """ |
| 123 | + kwargs: Dict[str, Any] = {} |
| 124 | + if bssid is not unset: |
| 125 | + kwargs["bssid"] = bssid |
| 126 | + |
| 127 | + if page_limit is not unset: |
| 128 | + kwargs["page_limit"] = page_limit |
| 129 | + |
| 130 | + if page_cursor is not unset: |
| 131 | + kwargs["page_cursor"] = page_cursor |
| 132 | + |
| 133 | + return self._get_eudm_devices_endpoint.call_with_http_info(**kwargs) |
0 commit comments