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
75 lines (54 loc) · 2.77 KB
/
Copy pathdevices.py
File metadata and controls
75 lines (54 loc) · 2.77 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
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): (required)
- 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 profile to bind to the device (for available switch profiles, see the 'Switch Profiles' endpoint). Use null to unbind the switch device from the current profile. For a device to be bindable to a switch profile, 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 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): (required)
- 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