Skip to content

Commit 6d7c28f

Browse files
author
Shiyue Cheng
committed
Dashboard API v1 release
1 parent e4f0a9d commit 6d7c28f

28 files changed

Lines changed: 599 additions & 817 deletions
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.0.0b15'
23+
__version__ = '1.0.0'
2424

2525
class DashboardAPI(object):
2626
"""
Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def getNetworkApplianceClientSecurityEvents(self, networkId: str, clientId: str,
4444
- clientId (string): (required)
4545
- total_pages (integer or string): use with perPage to get total results up to total_pages*perPage; -1 or "all" for all pages
4646
- direction (string): direction to paginate, either "next" (default) or "prev" page
47-
- t0 (string): The beginning of the timespan for the data. The maximum lookback period is 791 days from today.
47+
- t0 (string): The beginning of the timespan for the data. Data is gathered after the specified t0 value. The maximum lookback period is 791 days from today.
4848
- t1 (string): The end of the timespan for the data. t1 can be a maximum of 791 days after t0.
4949
- timespan (number): The timespan for which the information will be fetched. If specifying timespan, do not specify parameters t0 and t1. The value must be in seconds and be less than or equal to 791 days. The default is 31 days.
5050
- perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000. Default is 100.
@@ -583,7 +583,7 @@ def getNetworkApplianceSecurityEvents(self, networkId: str, total_pages=1, direc
583583
- networkId (string): (required)
584584
- total_pages (integer or string): use with perPage to get total results up to total_pages*perPage; -1 or "all" for all pages
585585
- direction (string): direction to paginate, either "next" (default) or "prev" page
586-
- t0 (string): The beginning of the timespan for the data. The maximum lookback period is 365 days from today.
586+
- t0 (string): The beginning of the timespan for the data. Data is gathered after the specified t0 value. The maximum lookback period is 365 days from today.
587587
- t1 (string): The end of the timespan for the data. t1 can be a maximum of 365 days after t0.
588588
- timespan (number): The timespan for which the information will be fetched. If specifying timespan, do not specify parameters t0 and t1. The value must be in seconds and be less than or equal to 365 days. The default is 31 days.
589589
- perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000. Default is 100.
@@ -1340,7 +1340,7 @@ def getOrganizationApplianceSecurityEvents(self, organizationId: str, total_page
13401340
- organizationId (string): (required)
13411341
- total_pages (integer or string): use with perPage to get total results up to total_pages*perPage; -1 or "all" for all pages
13421342
- direction (string): direction to paginate, either "next" (default) or "prev" page
1343-
- t0 (string): The beginning of the timespan for the data. The maximum lookback period is 365 days from today.
1343+
- t0 (string): The beginning of the timespan for the data. Data is gathered after the specified t0 value. The maximum lookback period is 365 days from today.
13441344
- t1 (string): The end of the timespan for the data. t1 can be a maximum of 365 days after t0.
13451345
- timespan (number): The timespan for which the information will be fetched. If specifying timespan, do not specify parameters t0 and t1. The value must be in seconds and be less than or equal to 365 days. The default is 31 days.
13461346
- perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000. Default is 100.
@@ -1382,13 +1382,13 @@ def getOrganizationApplianceSecurityIntrusion(self, organizationId: str):
13821382

13831383
return self._session.get(metadata, resource)
13841384

1385-
def updateOrganizationApplianceSecurityIntrusion(self, organizationId: str, whitelistedRules: list):
1385+
def updateOrganizationApplianceSecurityIntrusion(self, organizationId: str, allowedRules: list):
13861386
"""
13871387
**Sets supported intrusion settings for an organization**
13881388
https://developer.cisco.com/meraki/api-v1/#!update-organization-appliance-security-intrusion
13891389
13901390
- organizationId (string): (required)
1391-
- whitelistedRules (array): Sets a list of specific SNORT® signatures to whitelist
1391+
- allowedRules (array): Sets a list of specific SNORT® signatures to allow
13921392
"""
13931393

13941394
kwargs = locals()
@@ -1399,11 +1399,37 @@ def updateOrganizationApplianceSecurityIntrusion(self, organizationId: str, whit
13991399
}
14001400
resource = f'/organizations/{organizationId}/appliance/security/intrusion'
14011401

1402-
body_params = ['whitelistedRules', ]
1402+
body_params = ['allowedRules', ]
14031403
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
14041404

14051405
return self._session.put(metadata, resource, payload)
14061406

1407+
def getOrganizationApplianceUplinkStatuses(self, organizationId: str, total_pages=1, direction='next', **kwargs):
1408+
"""
1409+
**List the uplink status of every Meraki MX and Z series appliances in the organization**
1410+
https://developer.cisco.com/meraki/api-v1/#!get-organization-appliance-uplink-statuses
1411+
1412+
- organizationId (string): (required)
1413+
- total_pages (integer or string): use with perPage to get total results up to total_pages*perPage; -1 or "all" for all pages
1414+
- direction (string): direction to paginate, either "next" (default) or "prev" page
1415+
- perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000. Default is 1000.
1416+
- 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.
1417+
- 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.
1418+
"""
1419+
1420+
kwargs.update(locals())
1421+
1422+
metadata = {
1423+
'tags': ['appliance', 'monitor', 'uplink', 'statuses'],
1424+
'operation': 'getOrganizationApplianceUplinkStatuses'
1425+
}
1426+
resource = f'/organizations/{organizationId}/appliance/uplink/statuses'
1427+
1428+
query_params = ['perPage', 'startingAfter', 'endingBefore', ]
1429+
params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params}
1430+
1431+
return self._session.get_pages(metadata, resource, params, total_pages, direction)
1432+
14071433
def getOrganizationApplianceVpnStats(self, organizationId: str, total_pages=1, direction='next', **kwargs):
14081434
"""
14091435
**Show VPN history stat for networks in an organization**
Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,6 @@ def __init__(self, session):
33
super().__init__()
44
self._session = session
55

6-
def getNetworkClientsPolicies(self, networkID: str):
7-
"""
8-
**List the client policies within a wireless network.**
9-
https://developer.cisco.com/meraki/api-v1/#!get-network-clients-policies
10-
11-
- networkID (string): (required)
12-
"""
13-
14-
metadata = {
15-
'tags': ['networks', 'configure', 'clients', 'policies'],
16-
'operation': 'getNetworkClientsPolicies'
17-
}
18-
resource = f'/networks/{networkID}/clients/policies'
19-
20-
return self._session.get(metadata, resource)
21-
226
def getNetwork(self, networkId: str):
237
"""
248
**Return a network**
Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -251,13 +251,13 @@ def createOrganizationAdmin(self, organizationId: str, email: str, name: str, or
251251

252252
return self._session.post(metadata, resource, payload)
253253

254-
def updateOrganizationAdmin(self, organizationId: str, id: str, **kwargs):
254+
def updateOrganizationAdmin(self, organizationId: str, adminId: str, **kwargs):
255255
"""
256256
**Update an administrator**
257257
https://developer.cisco.com/meraki/api-v1/#!update-organization-admin
258258
259259
- organizationId (string): (required)
260-
- id (string): (required)
260+
- adminId (string): (required)
261261
- name (string): The name of the dashboard administrator
262262
- orgAccess (string): The privilege of the dashboard administrator on the organization. Can be one of 'full', 'read-only', 'enterprise' or 'none'
263263
- tags (array): The list of tags that the dashboard administrator has privileges on
@@ -274,27 +274,27 @@ def updateOrganizationAdmin(self, organizationId: str, id: str, **kwargs):
274274
'tags': ['organizations', 'configure', 'admins'],
275275
'operation': 'updateOrganizationAdmin'
276276
}
277-
resource = f'/organizations/{organizationId}/admins/{id}'
277+
resource = f'/organizations/{organizationId}/admins/{adminId}'
278278

279279
body_params = ['name', 'orgAccess', 'tags', 'networks', ]
280280
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
281281

282282
return self._session.put(metadata, resource, payload)
283283

284-
def deleteOrganizationAdmin(self, organizationId: str, id: str):
284+
def deleteOrganizationAdmin(self, organizationId: str, adminId: str):
285285
"""
286286
**Revoke all access for a dashboard administrator within this organization**
287287
https://developer.cisco.com/meraki/api-v1/#!delete-organization-admin
288288
289289
- organizationId (string): (required)
290-
- id (string): (required)
290+
- adminId (string): (required)
291291
"""
292292

293293
metadata = {
294294
'tags': ['organizations', 'configure', 'admins'],
295295
'operation': 'deleteOrganizationAdmin'
296296
}
297-
resource = f'/organizations/{organizationId}/admins/{id}'
297+
resource = f'/organizations/{organizationId}/admins/{adminId}'
298298

299299
return self._session.delete(metadata, resource)
300300

@@ -1231,20 +1231,24 @@ def getOrganizationSamlRoles(self, organizationId: str):
12311231

12321232
return self._session.get(metadata, resource)
12331233

1234-
def createOrganizationSamlRole(self, organizationId: str, **kwargs):
1234+
def createOrganizationSamlRole(self, organizationId: str, role: str, orgAccess: str, **kwargs):
12351235
"""
12361236
**Create a SAML role**
12371237
https://developer.cisco.com/meraki/api-v1/#!create-organization-saml-role
12381238
12391239
- organizationId (string): (required)
12401240
- role (string): The role of the SAML administrator
1241-
- orgAccess (string): The privilege of the SAML administrator on the organization
1241+
- orgAccess (string): The privilege of the SAML administrator on the organization. Can be one of 'none', 'read-only' or 'full'
12421242
- tags (array): The list of tags that the SAML administrator has privleges on
12431243
- networks (array): The list of networks that the SAML administrator has privileges on
12441244
"""
12451245

12461246
kwargs.update(locals())
12471247

1248+
if 'orgAccess' in kwargs:
1249+
options = ['none', 'read-only', 'full']
1250+
assert kwargs['orgAccess'] in options, f'''"orgAccess" cannot be "{kwargs['orgAccess']}", & must be set to one of: {options}'''
1251+
12481252
metadata = {
12491253
'tags': ['organizations', 'configure', 'samlRoles'],
12501254
'operation': 'createOrganizationSamlRole'
@@ -1281,13 +1285,17 @@ def updateOrganizationSamlRole(self, organizationId: str, samlRoleId: str, **kwa
12811285
- organizationId (string): (required)
12821286
- samlRoleId (string): (required)
12831287
- role (string): The role of the SAML administrator
1284-
- orgAccess (string): The privilege of the SAML administrator on the organization
1288+
- orgAccess (string): The privilege of the SAML administrator on the organization. Can be one of 'none', 'read-only' or 'full'
12851289
- tags (array): The list of tags that the SAML administrator has privleges on
12861290
- networks (array): The list of networks that the SAML administrator has privileges on
12871291
"""
12881292

12891293
kwargs.update(locals())
12901294

1295+
if 'orgAccess' in kwargs:
1296+
options = ['none', 'read-only', 'full']
1297+
assert kwargs['orgAccess'] in options, f'''"orgAccess" cannot be "{kwargs['orgAccess']}", & must be set to one of: {options}'''
1298+
12911299
metadata = {
12921300
'tags': ['organizations', 'configure', 'samlRoles'],
12931301
'operation': 'updateOrganizationSamlRole'

0 commit comments

Comments
 (0)