forked from meraki/dashboard-api-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevices.py
More file actions
141 lines (98 loc) · 4.74 KB
/
Copy pathdevices.py
File metadata and controls
141 lines (98 loc) · 4.74 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
import urllib
class ActionBatchDevices(object):
def __init__(self):
super(ActionBatchDevices, self).__init__()
def updateDevice(self, serial: str, **kwargs):
"""
**Update the attributes of a device**
https://developer.cisco.com/meraki/api-v1/#!update-device
- serial (string): Serial
- name (string): The name of a device
- tags (array): The list of tags of a device
- lat (number): The latitude of a device
- lng (number): The longitude of a device
- address (string): The address of a device
- notes (string): The notes for the device. String. Limited to 255 characters.
- moveMapMarker (boolean): Whether or not to set the latitude and longitude of a device based on the new address. Only applies when lat and lng are not specified.
- switchProfileId (string): The ID of a switch template to bind to the device (for available switch templates, see the 'Switch Templates' endpoint). Use null to unbind the switch device from the current profile. For a device to be bindable to a switch template, it must (1) be a switch, and (2) belong to a network that is bound to a configuration template.
- floorPlanId (string): The floor plan to associate to this device. null disassociates the device from the floorplan.
"""
kwargs.update(locals())
metadata = {
'tags': ['devices', 'configure'],
'operation': 'updateDevice'
}
resource = f'/devices/{serial}'
body_params = ['name', 'tags', 'lat', 'lng', 'address', 'notes', 'moveMapMarker', 'switchProfileId', 'floorPlanId', ]
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
"operation": "update",
"body": payload
}
return action
def createDeviceLiveToolsLedsBlink(self, serial: str, duration: int, **kwargs):
"""
**Enqueue a job to blink LEDs on a device**
https://developer.cisco.com/meraki/api-v1/#!create-device-live-tools-leds-blink
- serial (string): Serial
- duration (integer): The duration in seconds to blink LEDs.
- callback (object): Details for the callback. Please include either an httpServerId OR url and sharedSecret
"""
kwargs.update(locals())
metadata = {
'tags': ['devices', 'liveTools', 'leds', 'blink'],
'operation': 'createDeviceLiveToolsLedsBlink'
}
resource = f'/devices/{serial}/liveTools/leds/blink'
body_params = ['duration', 'callback', ]
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
"operation": "blink",
"body": payload
}
return action
def createDeviceLiveToolsThroughputTest(self, serial: str, **kwargs):
"""
**Enqueue a job to test a device throughput, the test will run for 10 secs to test throughput**
https://developer.cisco.com/meraki/api-v1/#!create-device-live-tools-throughput-test
- serial (string): Serial
- callback (object): Details for the callback. Please include either an httpServerId OR url and sharedSecret
"""
kwargs.update(locals())
metadata = {
'tags': ['devices', 'liveTools', 'throughputTest'],
'operation': 'createDeviceLiveToolsThroughputTest'
}
resource = f'/devices/{serial}/liveTools/throughputTest'
body_params = ['callback', ]
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
"operation": "test",
"body": payload
}
return action
def updateDeviceManagementInterface(self, serial: str, **kwargs):
"""
**Update the management interface settings for a device**
https://developer.cisco.com/meraki/api-v1/#!update-device-management-interface
- serial (string): Serial
- wan1 (object): WAN 1 settings
- wan2 (object): WAN 2 settings (only for MX devices)
"""
kwargs.update(locals())
metadata = {
'tags': ['devices', 'configure', 'managementInterface'],
'operation': 'updateDeviceManagementInterface'
}
resource = f'/devices/{serial}/managementInterface'
body_params = ['wan1', 'wan2', ]
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
action = {
"resource": resource,
"operation": "update",
"body": payload
}
return action