-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdns.py
More file actions
84 lines (72 loc) · 2.69 KB
/
Copy pathdns.py
File metadata and controls
84 lines (72 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
"""
--------------------------------------------------------------------------------
------------------------- Mist API Python CLI Session --------------------------
Written by: Thomas Munzer (tmunzer@juniper.net)
Github : https://github.com/tmunzer/mistapi_python
This package is licensed under the MIT License.
--------------------------------------------------------------------------------
"""
from enum import Enum
class Node(Enum):
"""Node Enum for specifying node information in DNS commands."""
NODE0 = "node0"
NODE1 = "node1"
## NO DATA
# def test_resolution(
# apissession: _APISession,
# site_id: str,
# device_id: str,
# node: Node | None = None,
# hostname: str | None = None,
# timeout=5,
# on_message: Callable[[dict], None] | None = None,
# ) -> UtilResponse:
# """
# DEVICES: SSR
# Initiates a DNS resolution command on the gateway and streams the results.
# PARAMS
# -----------
# apissession : _APISession
# The API session to use for the request.
# site_id : str
# UUID of the site where the gateway is located.
# device_id : str
# UUID of the gateway to perform the DNS resolution command on.
# node : Node, optional
# Node information for the DNS resolution command.
# hostname : str, optional
# Hostname to resolve.
# timeout : int, optional
# Timeout for the command in seconds.
# on_message : Callable, optional
# Callback invoked with each extracted raw message as it arrives.
# RETURNS
# -----------
# UtilResponse
# A UtilResponse object containing the API response and a list of raw messages received
# from the WebSocket stream.
# """
# body: dict[str, str | list | int] = {}
# if node:
# body["node"] = node.value
# if hostname:
# body["hostname"] = hostname
# trigger = devices.testSiteSsrDnsResolution(
# apissession,
# site_id=site_id,
# device_id=device_id,
# body=body,
# )
# util_response = UtilResponse(trigger)
# if trigger.status_code == 200:
# LOGGER.info(trigger.data)
# print(f"SSR DNS resolution command triggered for device {device_id}")
# ws = DeviceCmdEvents(apissession, site_id=site_id, device_ids=[device_id])
# util_response = await WebSocketWrapper(
# apissession, util_response, timeout=timeout, on_message=on_message
# ).start(ws)
# else:
# LOGGER.error(
# f"Failed to trigger SSR DNS resolution command: {trigger.status_code} - {trigger.data}"
# ) # Give the SSR DNS resolution command a moment to take effect
# return util_response