forked from meraki/dashboard-api-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbluetooth_settings.py
More file actions
92 lines (70 loc) · 4.21 KB
/
Copy pathbluetooth_settings.py
File metadata and controls
92 lines (70 loc) · 4.21 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
class BluetoothSettings(object):
def __init__(self, session):
super(BluetoothSettings, self).__init__()
self._session = session
def getDeviceWirelessBluetoothSettings(self, serial: str):
"""
**Return the bluetooth settings for a wireless device**
https://developer.cisco.com/meraki/api/#!get-device-wireless-bluetooth-settings
- serial (string)
"""
metadata = {
'tags': ['Bluetooth settings'],
'operation': 'getDeviceWirelessBluetoothSettings',
}
resource = f'/devices/{serial}/wireless/bluetooth/settings'
return self._session.get(metadata, resource)
def updateDeviceWirelessBluetoothSettings(self, serial: str, **kwargs):
"""
**Update the bluetooth settings for a wireless device**
https://developer.cisco.com/meraki/api/#!update-device-wireless-bluetooth-settings
- serial (string)
- uuid (string): Desired UUID of the beacon. If the value is set to null it will reset to Dashboard's automatically generated value.
- major (integer): Desired major value of the beacon. If the value is set to null it will reset to Dashboard's automatically generated value.
- minor (integer): Desired minor value of the beacon. If the value is set to null it will reset to Dashboard's automatically generated value.
"""
kwargs.update(locals())
metadata = {
'tags': ['Bluetooth settings'],
'operation': 'updateDeviceWirelessBluetoothSettings',
}
resource = f'/devices/{serial}/wireless/bluetooth/settings'
body_params = ['uuid', 'major', 'minor']
payload = {k: v for (k, v) in kwargs.items() if k in body_params}
return self._session.put(metadata, resource, payload)
def getNetworkBluetoothSettings(self, networkId: str):
"""
**Return the Bluetooth settings for a network. <a href="https://documentation.meraki.com/MR/Bluetooth/Bluetooth_Low_Energy_(BLE)">Bluetooth settings</a> must be enabled on the network.**
https://developer.cisco.com/meraki/api/#!get-network-bluetooth-settings
- networkId (string)
"""
metadata = {
'tags': ['Bluetooth settings'],
'operation': 'getNetworkBluetoothSettings',
}
resource = f'/networks/{networkId}/bluetoothSettings'
return self._session.get(metadata, resource)
def updateNetworkBluetoothSettings(self, networkId: str, **kwargs):
"""
**Update the Bluetooth settings for a network. See the docs page for <a href="https://documentation.meraki.com/MR/Bluetooth/Bluetooth_Low_Energy_(BLE)">Bluetooth settings</a>.**
https://developer.cisco.com/meraki/api/#!update-network-bluetooth-settings
- networkId (string)
- scanningEnabled (boolean): Whether APs will scan for Bluetooth enabled clients. (true, false)
- advertisingEnabled (boolean): Whether APs will advertise beacons. (true, false)
- uuid (string): The UUID to be used in the beacon identifier.
- majorMinorAssignmentMode (string): The way major and minor number should be assigned to nodes in the network. ('Unique', 'Non-unique')
- major (integer): The major number to be used in the beacon identifier. Only valid in 'Non-unique' mode.
- minor (integer): The minor number to be used in the beacon identifier. Only valid in 'Non-unique' mode.
"""
kwargs.update(locals())
if 'majorMinorAssignmentMode' in kwargs:
options = ['Unique', 'Non-unique']
assert kwargs['majorMinorAssignmentMode'] in options, f'''"majorMinorAssignmentMode" cannot be "{kwargs['majorMinorAssignmentMode']}", & must be set to one of: {options}'''
metadata = {
'tags': ['Bluetooth settings'],
'operation': 'updateNetworkBluetoothSettings',
}
resource = f'/networks/{networkId}/bluetoothSettings'
body_params = ['scanningEnabled', 'advertisingEnabled', 'uuid', 'majorMinorAssignmentMode', 'major', 'minor']
payload = {k: v for (k, v) in kwargs.items() if k in body_params}
return self._session.put(metadata, resource, payload)