Skip to content

Commit 184d6cf

Browse files
author
Shiyue Cheng
committed
updated w/ release 1.1.0b1
1 parent 090ec54 commit 184d6cf

9 files changed

Lines changed: 425 additions & 9 deletions

File tree

meraki/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
SUPPRESS_LOGGING, SIMULATE_API_CALLS, BE_GEO_ID, MERAKI_PYTHON_SDK_CALLER
2121
)
2222

23-
__version__ = '1.1.0'
23+
__version__ = '1.1.0b1'
2424

2525
class DashboardAPI(object):
2626
"""

meraki/aio/api/networks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ def getNetworkMerakiAuthUser(self, networkId: str, merakiAuthUserId: str):
828828

829829
def deleteNetworkMerakiAuthUser(self, networkId: str, merakiAuthUserId: str):
830830
"""
831-
**Delete a user configured with Meraki Authentication (currently only 802.1X RADIUS users can be deleted)**
831+
**Delete a user configured with Meraki Authentication (currently, 802.1X RADIUS and Splash Guest users can be deleted)**
832832
https://developer.cisco.com/meraki/api-v1/#!delete-network-meraki-auth-user
833833
834834
- networkId (string): (required)
@@ -845,7 +845,7 @@ def deleteNetworkMerakiAuthUser(self, networkId: str, merakiAuthUserId: str):
845845

846846
def updateNetworkMerakiAuthUser(self, networkId: str, merakiAuthUserId: str, **kwargs):
847847
"""
848-
**Update a user configured with Meraki Authentication (currently only 802.1X RADIUS users can be updated)**
848+
**Update a user configured with Meraki Authentication (currently, 802.1X RADIUS and Splash Guest users can be updated)**
849849
https://developer.cisco.com/meraki/api-v1/#!update-network-meraki-auth-user
850850
851851
- networkId (string): (required)

meraki/aio/api/sm.py

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,74 @@ def getNetworkSmBypassActivationLockAttempt(self, networkId: str, attemptId: str
4242

4343
return self._session.get(metadata, resource)
4444

45+
def getNetworkSmDevices(self, networkId: str, total_pages=1, direction='next', **kwargs):
46+
"""
47+
**List the devices enrolled in an SM network with various specified fields and filters**
48+
https://developer.cisco.com/meraki/api-v1/#!get-network-sm-devices
49+
50+
- networkId (string): (required)
51+
- total_pages (integer or string): use with perPage to get total results up to total_pages*perPage; -1 or "all" for all pages
52+
- direction (string): direction to paginate, either "next" (default) or "prev" page
53+
- fields (array): Additional fields that will be displayed for each device.
54+
The default fields are: id, name, tags, ssid, wifiMac, osName, systemModel, uuid, and serialNumber. The additional fields are: ip,
55+
systemType, availableDeviceCapacity, kioskAppName, biosVersion, lastConnected, missingAppsCount, userSuppliedAddress, location, lastUser,
56+
ownerEmail, ownerUsername, osBuild, publicIp, phoneNumber, diskInfoJson, deviceCapacity, isManaged, hadMdm, isSupervised, meid, imei, iccid,
57+
simCarrierNetwork, cellularDataUsed, isHotspotEnabled, createdAt, batteryEstCharge, quarantined, avName, avRunning, asName, fwName,
58+
isRooted, loginRequired, screenLockEnabled, screenLockDelay, autoLoginDisabled, autoTags, hasMdm, hasDesktopAgent, diskEncryptionEnabled,
59+
hardwareEncryptionCaps, passCodeLock, usesHardwareKeystore, and androidSecurityPatchVersion.
60+
- wifiMacs (array): Filter devices by wifi mac(s).
61+
- serials (array): Filter devices by serial(s).
62+
- ids (array): Filter devices by id(s).
63+
- scope (array): Specify a scope (one of all, none, withAny, withAll, withoutAny, or withoutAll) and a set of tags.
64+
- perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000. Default is 1000.
65+
- startingAfter (string): A token used by the server to indicate the start of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it.
66+
- endingBefore (string): A token used by the server to indicate the end of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it.
67+
"""
68+
69+
kwargs.update(locals())
70+
71+
metadata = {
72+
'tags': ['sm', 'configure', 'devices'],
73+
'operation': 'getNetworkSmDevices'
74+
}
75+
resource = f'/networks/{networkId}/sm/devices'
76+
77+
query_params = ['fields', 'wifiMacs', 'serials', 'ids', 'scope', 'perPage', 'startingAfter', 'endingBefore', ]
78+
params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params}
79+
80+
array_params = ['fields', 'wifiMacs', 'serials', 'ids', 'scope', ]
81+
for k, v in kwargs.items():
82+
if k.strip() in array_params:
83+
params[f'{k.strip()}[]'] = kwargs[f'{k}']
84+
params.pop(k.strip())
85+
86+
return self._session.get_pages(metadata, resource, params, total_pages, direction)
87+
88+
def checkinNetworkSmDevices(self, networkId: str, **kwargs):
89+
"""
90+
**Force check-in a set of devices**
91+
https://developer.cisco.com/meraki/api-v1/#!checkin-network-sm-devices
92+
93+
- networkId (string): (required)
94+
- wifiMacs (array): The wifiMacs of the devices to be checked-in.
95+
- ids (array): The ids of the devices to be checked-in.
96+
- serials (array): The serials of the devices to be checked-in.
97+
- scope (array): The scope (one of all, none, withAny, withAll, withoutAny, or withoutAll) and a set of tags of the devices to be checked-in.
98+
"""
99+
100+
kwargs.update(locals())
101+
102+
metadata = {
103+
'tags': ['sm', 'configure', 'devices'],
104+
'operation': 'checkinNetworkSmDevices'
105+
}
106+
resource = f'/networks/{networkId}/sm/devices/checkin'
107+
108+
body_params = ['wifiMacs', 'ids', 'serials', 'scope', ]
109+
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
110+
111+
return self._session.post(metadata, resource, payload)
112+
45113
def updateNetworkSmDevicesFields(self, networkId: str, deviceFields: dict, **kwargs):
46114
"""
47115
**Modify the fields of a device**
@@ -67,6 +135,85 @@ def updateNetworkSmDevicesFields(self, networkId: str, deviceFields: dict, **kwa
67135

68136
return self._session.put(metadata, resource, payload)
69137

138+
def lockNetworkSmDevices(self, networkId: str, **kwargs):
139+
"""
140+
**Lock a set of devices**
141+
https://developer.cisco.com/meraki/api-v1/#!lock-network-sm-devices
142+
143+
- networkId (string): (required)
144+
- wifiMacs (array): The wifiMacs of the devices to be locked.
145+
- ids (array): The ids of the devices to be locked.
146+
- serials (array): The serials of the devices to be locked.
147+
- scope (array): The scope (one of all, none, withAny, withAll, withoutAny, or withoutAll) and a set of tags of the devices to be wiped.
148+
- pin (integer): The pin number for locking macOS devices (a six digit number). Required only for macOS devices.
149+
"""
150+
151+
kwargs.update(locals())
152+
153+
metadata = {
154+
'tags': ['sm', 'configure', 'devices'],
155+
'operation': 'lockNetworkSmDevices'
156+
}
157+
resource = f'/networks/{networkId}/sm/devices/lock'
158+
159+
body_params = ['wifiMacs', 'ids', 'serials', 'scope', 'pin', ]
160+
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
161+
162+
return self._session.post(metadata, resource, payload)
163+
164+
def modifyNetworkSmDevicesTags(self, networkId: str, tags: list, updateAction: str, **kwargs):
165+
"""
166+
**Add, delete, or update the tags of a set of devices**
167+
https://developer.cisco.com/meraki/api-v1/#!modify-network-sm-devices-tags
168+
169+
- networkId (string): (required)
170+
- tags (array): The tags to be added, deleted, or updated.
171+
- updateAction (string): One of add, delete, or update. Only devices that have been modified will be returned.
172+
- wifiMacs (array): The wifiMacs of the devices to be modified.
173+
- ids (array): The ids of the devices to be modified.
174+
- serials (array): The serials of the devices to be modified.
175+
- scope (array): The scope (one of all, none, withAny, withAll, withoutAny, or withoutAll) and a set of tags of the devices to be modified.
176+
"""
177+
178+
kwargs.update(locals())
179+
180+
metadata = {
181+
'tags': ['sm', 'configure', 'devices'],
182+
'operation': 'modifyNetworkSmDevicesTags'
183+
}
184+
resource = f'/networks/{networkId}/sm/devices/modifyTags'
185+
186+
body_params = ['wifiMacs', 'ids', 'serials', 'scope', 'tags', 'updateAction', ]
187+
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
188+
189+
return self._session.post(metadata, resource, payload)
190+
191+
def moveNetworkSmDevices(self, networkId: str, newNetwork: str, **kwargs):
192+
"""
193+
**Move a set of devices to a new network**
194+
https://developer.cisco.com/meraki/api-v1/#!move-network-sm-devices
195+
196+
- networkId (string): (required)
197+
- newNetwork (string): The new network to which the devices will be moved.
198+
- wifiMacs (array): The wifiMacs of the devices to be moved.
199+
- ids (array): The ids of the devices to be moved.
200+
- serials (array): The serials of the devices to be moved.
201+
- scope (array): The scope (one of all, none, withAny, withAll, withoutAny, or withoutAll) and a set of tags of the devices to be moved.
202+
"""
203+
204+
kwargs.update(locals())
205+
206+
metadata = {
207+
'tags': ['sm', 'configure', 'devices'],
208+
'operation': 'moveNetworkSmDevices'
209+
}
210+
resource = f'/networks/{networkId}/sm/devices/move'
211+
212+
body_params = ['wifiMacs', 'ids', 'serials', 'scope', 'newNetwork', ]
213+
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
214+
215+
return self._session.post(metadata, resource, payload)
216+
70217
def wipeNetworkSmDevices(self, networkId: str, **kwargs):
71218
"""
72219
**Wipe a device**
@@ -499,6 +646,37 @@ def deleteNetworkSmTargetGroup(self, networkId: str, targetGroupId: str):
499646

500647
return self._session.delete(metadata, resource)
501648

649+
def getNetworkSmUsers(self, networkId: str, **kwargs):
650+
"""
651+
**List the owners in an SM network with various specified fields and filters**
652+
https://developer.cisco.com/meraki/api-v1/#!get-network-sm-users
653+
654+
- networkId (string): (required)
655+
- ids (array): Filter users by id(s).
656+
- usernames (array): Filter users by username(s).
657+
- emails (array): Filter users by email(s).
658+
- scope (array): Specifiy a scope (one of all, none, withAny, withAll, withoutAny, withoutAll) and a set of tags.
659+
"""
660+
661+
kwargs.update(locals())
662+
663+
metadata = {
664+
'tags': ['sm', 'configure', 'users'],
665+
'operation': 'getNetworkSmUsers'
666+
}
667+
resource = f'/networks/{networkId}/sm/users'
668+
669+
query_params = ['ids', 'usernames', 'emails', 'scope', ]
670+
params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params}
671+
672+
array_params = ['ids', 'usernames', 'emails', 'scope', ]
673+
for k, v in kwargs.items():
674+
if k.strip() in array_params:
675+
params[f'{k.strip()}[]'] = kwargs[f'{k}']
676+
params.pop(k.strip())
677+
678+
return self._session.get(metadata, resource, params)
679+
502680
def getNetworkSmUserDeviceProfiles(self, networkId: str, userId: str):
503681
"""
504682
**Get the profiles associated with a user**

meraki/aio/api/switch.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1770,4 +1770,27 @@ def updateOrganizationConfigTemplateSwitchProfilePort(self, organizationId: str,
17701770
body_params = ['name', 'tags', 'enabled', 'type', 'vlan', 'voiceVlan', 'allowedVlans', 'poeEnabled', 'isolationEnabled', 'rstpEnabled', 'stpGuard', 'linkNegotiation', 'portScheduleId', 'udld', 'accessPolicyType', 'accessPolicyNumber', 'macAllowList', 'stickyMacAllowList', 'stickyMacAllowListLimit', 'stormControlEnabled', 'flexibleStackingEnabled', ]
17711771
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
17721772

1773-
return self._session.put(metadata, resource, payload)
1773+
return self._session.put(metadata, resource, payload)
1774+
1775+
def cloneOrganizationSwitchDevices(self, organizationId: str, sourceSerial: str, targetSerials: list):
1776+
"""
1777+
**Clone port-level and some switch-level configuration settings (Aggregation Groups, Power Settings, Multicast Settings, MTU Configuration, STP Bridge priority, Port Mirroring) from a source switch to one or more target switches**
1778+
https://developer.cisco.com/meraki/api-v1/#!clone-organization-switch-devices
1779+
1780+
- organizationId (string): (required)
1781+
- sourceSerial (string): Serial number of the source switch (must be on a network not bound to a template)
1782+
- targetSerials (array): Array of serial numbers of one or more target switches (must be on a network not bound to a template)
1783+
"""
1784+
1785+
kwargs = locals()
1786+
1787+
metadata = {
1788+
'tags': ['switch', 'configure', 'devices'],
1789+
'operation': 'cloneOrganizationSwitchDevices'
1790+
}
1791+
resource = f'/organizations/{organizationId}/switch/devices/clone'
1792+
1793+
body_params = ['sourceSerial', 'targetSerials', ]
1794+
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
1795+
1796+
return self._session.post(metadata, resource, payload)

meraki/aio/api/wireless.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1356,6 +1356,13 @@ def updateNetworkWirelessSsidSplashSettings(self, networkId: str, number: str, *
13561356
- number (string): (required)
13571357
- splashUrl (string): [optional] The custom splash URL of the click-through splash page. Note that the URL can be configured without necessarily being used. In order to enable the custom URL, see 'useSplashUrl'
13581358
- useSplashUrl (boolean): [optional] Boolean indicating whether the users will be redirected to the custom splash url. A custom splash URL must be set if this is true. Note that depending on your SSID's access control settings, it may not be possible to use the custom splash URL.
1359+
- splashTimeout (integer): Splash timeout in minutes. This will determine how often users will see the splash page.
1360+
- redirectUrl (string): The custom redirect URL where the users will go after the splash page.
1361+
- useRedirectUrl (boolean): The Boolean indicating whether the the user will be redirected to the custom redirect URL after the splash page. A custom redirect URL must be set if this is true.
1362+
- welcomeMessage (string): The welcome message for the users on the splash page.
1363+
- splashLogo (object): The logo used in the splash page.
1364+
- splashImage (object): The image used in the splash page.
1365+
- splashPrepaidFront (object): The prepaid front image used in the splash page.
13591366
"""
13601367

13611368
kwargs.update(locals())
@@ -1366,7 +1373,7 @@ def updateNetworkWirelessSsidSplashSettings(self, networkId: str, number: str, *
13661373
}
13671374
resource = f'/networks/{networkId}/wireless/ssids/{number}/splash/settings'
13681375

1369-
body_params = ['splashUrl', 'useSplashUrl', ]
1376+
body_params = ['splashUrl', 'useSplashUrl', 'splashTimeout', 'redirectUrl', 'useRedirectUrl', 'welcomeMessage', 'splashLogo', 'splashImage', 'splashPrepaidFront', ]
13701377
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
13711378

13721379
return self._session.put(metadata, resource, payload)

meraki/api/networks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ def getNetworkMerakiAuthUser(self, networkId: str, merakiAuthUserId: str):
828828

829829
def deleteNetworkMerakiAuthUser(self, networkId: str, merakiAuthUserId: str):
830830
"""
831-
**Delete a user configured with Meraki Authentication (currently only 802.1X RADIUS users can be deleted)**
831+
**Delete a user configured with Meraki Authentication (currently, 802.1X RADIUS and Splash Guest users can be deleted)**
832832
https://developer.cisco.com/meraki/api-v1/#!delete-network-meraki-auth-user
833833
834834
- networkId (string): (required)
@@ -845,7 +845,7 @@ def deleteNetworkMerakiAuthUser(self, networkId: str, merakiAuthUserId: str):
845845

846846
def updateNetworkMerakiAuthUser(self, networkId: str, merakiAuthUserId: str, **kwargs):
847847
"""
848-
**Update a user configured with Meraki Authentication (currently only 802.1X RADIUS users can be updated)**
848+
**Update a user configured with Meraki Authentication (currently, 802.1X RADIUS and Splash Guest users can be updated)**
849849
https://developer.cisco.com/meraki/api-v1/#!update-network-meraki-auth-user
850850
851851
- networkId (string): (required)

0 commit comments

Comments
 (0)