Skip to content

Commit fbdad01

Browse files
author
Shiyue Cheng
committed
updated w/ release 1.3.0b1
1 parent 14938ba commit fbdad01

7 files changed

Lines changed: 177 additions & 3 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.3.0'
23+
__version__ = '1.3.0b1'
2424

2525
class DashboardAPI(object):
2626
"""

meraki/aio/api/networks.py

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,76 @@ def __init__(self, session):
33
super().__init__()
44
self._session = session
55

6+
def getNetworkClientsApplicationUsage(self, networkID: str, clients: str, total_pages=1, direction='next', **kwargs):
7+
"""
8+
**Return the application usage data for clients**
9+
https://developer.cisco.com/meraki/api-v1/#!get-network-clients-application-usage
10+
11+
- networkID (string): (required)
12+
- clients (string): A list of client keys, MACs or IPs separated by comma.
13+
- total_pages (integer or string): use with perPage to get total results up to total_pages*perPage; -1 or "all" for all pages
14+
- direction (string): direction to paginate, either "next" (default) or "prev" page
15+
- ssidNumber (integer): An SSID number to include. If not specified, eveusage histories application usagents for all SSIDs will be returned.
16+
- perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000.
17+
- 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.
18+
- 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.
19+
- t0 (string): The beginning of the timespan for the data. The maximum lookback period is 31 days from today.
20+
- t1 (string): The end of the timespan for the data. t1 can be a maximum of 31 days after t0.
21+
- 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 31 days. The default is 1 day.
22+
"""
23+
24+
kwargs.update(locals())
25+
26+
if 'ssidNumber' in kwargs:
27+
options = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
28+
assert kwargs['ssidNumber'] in options, f'''"ssidNumber" cannot be "{kwargs['ssidNumber']}", & must be set to one of: {options}'''
29+
30+
metadata = {
31+
'tags': ['networks', 'monitor', 'clients', 'applicationUsage'],
32+
'operation': 'getNetworkClientsApplicationUsage'
33+
}
34+
resource = f'/networks/{networkID}/clients/applicationUsage'
35+
36+
query_params = ['clients', 'ssidNumber', 'perPage', 'startingAfter', 'endingBefore', 't0', 't1', 'timespan', ]
37+
params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params}
38+
39+
return self._session.get_pages(metadata, resource, params, total_pages, direction)
40+
41+
def getNetworkClientsUsageHistories(self, networkID: str, clients: str, total_pages=1, direction='next', **kwargs):
42+
"""
43+
**Return the usage histories for clients**
44+
https://developer.cisco.com/meraki/api-v1/#!get-network-clients-usage-histories
45+
46+
- networkID (string): (required)
47+
- clients (string): A list of client keys, MACs or IPs separated by comma.
48+
- total_pages (integer or string): use with perPage to get total results up to total_pages*perPage; -1 or "all" for all pages
49+
- direction (string): direction to paginate, either "next" (default) or "prev" page
50+
- ssidNumber (integer): An SSID number to include. If not specified, events for all SSIDs will be returned.
51+
- perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000.
52+
- 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.
53+
- 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.
54+
- t0 (string): The beginning of the timespan for the data. The maximum lookback period is 31 days from today.
55+
- t1 (string): The end of the timespan for the data. t1 can be a maximum of 31 days after t0.
56+
- 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 31 days. The default is 1 day.
57+
"""
58+
59+
kwargs.update(locals())
60+
61+
if 'ssidNumber' in kwargs:
62+
options = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
63+
assert kwargs['ssidNumber'] in options, f'''"ssidNumber" cannot be "{kwargs['ssidNumber']}", & must be set to one of: {options}'''
64+
65+
metadata = {
66+
'tags': ['networks', 'monitor', 'clients', 'usageHistories'],
67+
'operation': 'getNetworkClientsUsageHistories'
68+
}
69+
resource = f'/networks/{networkID}/clients/usageHistories'
70+
71+
query_params = ['clients', 'ssidNumber', 'perPage', 'startingAfter', 'endingBefore', 't0', 't1', 'timespan', ]
72+
params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params}
73+
74+
return self._session.get_pages(metadata, resource, params, total_pages, direction)
75+
676
def getNetwork(self, networkId: str):
777
"""
878
**Return a network**

meraki/aio/api/organizations.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,6 +1442,22 @@ def updateOrganizationSnmp(self, organizationId: str, **kwargs):
14421442

14431443
return self._session.put(metadata, resource, payload)
14441444

1445+
def getOrganizationWebhooksAlertTypes(self, organizationId: str):
1446+
"""
1447+
**Return a list of alert types to be used with managing webhook alerts**
1448+
https://developer.cisco.com/meraki/api-v1/#!get-organization-webhooks-alert-types
1449+
1450+
- organizationId (string): (required)
1451+
"""
1452+
1453+
metadata = {
1454+
'tags': ['organizations', 'monitor', 'webhooks', 'alertTypes'],
1455+
'operation': 'getOrganizationWebhooksAlertTypes'
1456+
}
1457+
resource = f'/organizations/{organizationId}/webhooks/alertTypes'
1458+
1459+
return self._session.get(metadata, resource)
1460+
14451461
def getOrganizationWebhooksLogs(self, organizationId: str, total_pages=1, direction='next', **kwargs):
14461462
"""
14471463
**Return the log of webhook POSTs sent**

meraki/aio/api/wireless.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1072,6 +1072,7 @@ def updateNetworkWirelessSsid(self, networkId: str, number: str, **kwargs):
10721072
- splashPage (string): The type of splash page for the SSID ('None', 'Click-through splash page', 'Billing', 'Password-protected with Meraki RADIUS', 'Password-protected with custom RADIUS', 'Password-protected with Active Directory', 'Password-protected with LDAP', 'SMS authentication', 'Systems Manager Sentry', 'Facebook Wi-Fi', 'Google OAuth', 'Sponsored guest' or 'Cisco ISE'). This attribute is not supported for template children.
10731073
- radiusServers (array): The RADIUS 802.1X servers to be used for authentication. This param is only valid if the authMode is 'open-with-radius', '8021x-radius' or 'ipsk-with-radius'
10741074
- radiusProxyEnabled (boolean): If true, Meraki devices will proxy RADIUS messages through the Meraki cloud to the configured RADIUS auth and accounting servers.
1075+
- radiusTestingEnabled (boolean): If true, Meraki devices will periodically send Access-Request messages to configured RADIUS servers using identity 'meraki_8021x_test' to ensure that the RADIUS servers are reachable.
10751076
- radiusCoaEnabled (boolean): If true, Meraki devices will act as a RADIUS Dynamic Authorization Server and will respond to RADIUS Change-of-Authorization and Disconnect messages sent by the RADIUS server.
10761077
- radiusFailoverPolicy (string): This policy determines how authentication requests should be handled in the event that all of the configured RADIUS servers are unreachable ('Deny access' or 'Allow access')
10771078
- radiusLoadBalancingPolicy (string): This policy determines which RADIUS server will be contacted first in an authentication attempt and the ordering of any necessary retry attempts ('Strict priority order' or 'Round robin')
@@ -1135,7 +1136,7 @@ def updateNetworkWirelessSsid(self, networkId: str, number: str, **kwargs):
11351136
}
11361137
resource = f'/networks/{networkId}/wireless/ssids/{number}'
11371138

1138-
body_params = ['name', 'enabled', 'authMode', 'enterpriseAdminAccess', 'encryptionMode', 'psk', 'wpaEncryptionMode', 'splashPage', 'radiusServers', 'radiusProxyEnabled', 'radiusCoaEnabled', 'radiusFailoverPolicy', 'radiusLoadBalancingPolicy', 'radiusAccountingEnabled', 'radiusAccountingServers', 'radiusAttributeForGroupPolicies', 'ipAssignmentMode', 'useVlanTagging', 'concentratorNetworkId', 'vlanId', 'defaultVlanId', 'apTagsAndVlanIds', 'walledGardenEnabled', 'walledGardenRanges', 'radiusOverride', 'radiusGuestVlanEnabled', 'radiusGuestVlanId', 'minBitrate', 'bandSelection', 'perClientBandwidthLimitUp', 'perClientBandwidthLimitDown', 'perSsidBandwidthLimitUp', 'perSsidBandwidthLimitDown', 'lanIsolationEnabled', 'visible', 'availableOnAllAps', 'availabilityTags', 'mandatoryDhcpEnabled', ]
1139+
body_params = ['name', 'enabled', 'authMode', 'enterpriseAdminAccess', 'encryptionMode', 'psk', 'wpaEncryptionMode', 'splashPage', 'radiusServers', 'radiusProxyEnabled', 'radiusTestingEnabled', 'radiusCoaEnabled', 'radiusFailoverPolicy', 'radiusLoadBalancingPolicy', 'radiusAccountingEnabled', 'radiusAccountingServers', 'radiusAttributeForGroupPolicies', 'ipAssignmentMode', 'useVlanTagging', 'concentratorNetworkId', 'vlanId', 'defaultVlanId', 'apTagsAndVlanIds', 'walledGardenEnabled', 'walledGardenRanges', 'radiusOverride', 'radiusGuestVlanEnabled', 'radiusGuestVlanId', 'minBitrate', 'bandSelection', 'perClientBandwidthLimitUp', 'perClientBandwidthLimitDown', 'perSsidBandwidthLimitUp', 'perSsidBandwidthLimitDown', 'lanIsolationEnabled', 'visible', 'availableOnAllAps', 'availabilityTags', 'mandatoryDhcpEnabled', ]
11391140
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
11401141

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

meraki/api/networks.py

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,76 @@ def __init__(self, session):
33
super(Networks, self).__init__()
44
self._session = session
55

6+
def getNetworkClientsApplicationUsage(self, networkID: str, clients: str, total_pages=1, direction='next', **kwargs):
7+
"""
8+
**Return the application usage data for clients**
9+
https://developer.cisco.com/meraki/api-v1/#!get-network-clients-application-usage
10+
11+
- networkID (string): (required)
12+
- clients (string): A list of client keys, MACs or IPs separated by comma.
13+
- total_pages (integer or string): use with perPage to get total results up to total_pages*perPage; -1 or "all" for all pages
14+
- direction (string): direction to paginate, either "next" (default) or "prev" page
15+
- ssidNumber (integer): An SSID number to include. If not specified, eveusage histories application usagents for all SSIDs will be returned.
16+
- perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000.
17+
- 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.
18+
- 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.
19+
- t0 (string): The beginning of the timespan for the data. The maximum lookback period is 31 days from today.
20+
- t1 (string): The end of the timespan for the data. t1 can be a maximum of 31 days after t0.
21+
- 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 31 days. The default is 1 day.
22+
"""
23+
24+
kwargs.update(locals())
25+
26+
if 'ssidNumber' in kwargs:
27+
options = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
28+
assert kwargs['ssidNumber'] in options, f'''"ssidNumber" cannot be "{kwargs['ssidNumber']}", & must be set to one of: {options}'''
29+
30+
metadata = {
31+
'tags': ['networks', 'monitor', 'clients', 'applicationUsage'],
32+
'operation': 'getNetworkClientsApplicationUsage'
33+
}
34+
resource = f'/networks/{networkID}/clients/applicationUsage'
35+
36+
query_params = ['clients', 'ssidNumber', 'perPage', 'startingAfter', 'endingBefore', 't0', 't1', 'timespan', ]
37+
params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params}
38+
39+
return self._session.get_pages(metadata, resource, params, total_pages, direction)
40+
41+
def getNetworkClientsUsageHistories(self, networkID: str, clients: str, total_pages=1, direction='next', **kwargs):
42+
"""
43+
**Return the usage histories for clients**
44+
https://developer.cisco.com/meraki/api-v1/#!get-network-clients-usage-histories
45+
46+
- networkID (string): (required)
47+
- clients (string): A list of client keys, MACs or IPs separated by comma.
48+
- total_pages (integer or string): use with perPage to get total results up to total_pages*perPage; -1 or "all" for all pages
49+
- direction (string): direction to paginate, either "next" (default) or "prev" page
50+
- ssidNumber (integer): An SSID number to include. If not specified, events for all SSIDs will be returned.
51+
- perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000.
52+
- 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.
53+
- 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.
54+
- t0 (string): The beginning of the timespan for the data. The maximum lookback period is 31 days from today.
55+
- t1 (string): The end of the timespan for the data. t1 can be a maximum of 31 days after t0.
56+
- 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 31 days. The default is 1 day.
57+
"""
58+
59+
kwargs.update(locals())
60+
61+
if 'ssidNumber' in kwargs:
62+
options = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
63+
assert kwargs['ssidNumber'] in options, f'''"ssidNumber" cannot be "{kwargs['ssidNumber']}", & must be set to one of: {options}'''
64+
65+
metadata = {
66+
'tags': ['networks', 'monitor', 'clients', 'usageHistories'],
67+
'operation': 'getNetworkClientsUsageHistories'
68+
}
69+
resource = f'/networks/{networkID}/clients/usageHistories'
70+
71+
query_params = ['clients', 'ssidNumber', 'perPage', 'startingAfter', 'endingBefore', 't0', 't1', 'timespan', ]
72+
params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params}
73+
74+
return self._session.get_pages(metadata, resource, params, total_pages, direction)
75+
676
def getNetwork(self, networkId: str):
777
"""
878
**Return a network**

meraki/api/organizations.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,6 +1442,22 @@ def updateOrganizationSnmp(self, organizationId: str, **kwargs):
14421442

14431443
return self._session.put(metadata, resource, payload)
14441444

1445+
def getOrganizationWebhooksAlertTypes(self, organizationId: str):
1446+
"""
1447+
**Return a list of alert types to be used with managing webhook alerts**
1448+
https://developer.cisco.com/meraki/api-v1/#!get-organization-webhooks-alert-types
1449+
1450+
- organizationId (string): (required)
1451+
"""
1452+
1453+
metadata = {
1454+
'tags': ['organizations', 'monitor', 'webhooks', 'alertTypes'],
1455+
'operation': 'getOrganizationWebhooksAlertTypes'
1456+
}
1457+
resource = f'/organizations/{organizationId}/webhooks/alertTypes'
1458+
1459+
return self._session.get(metadata, resource)
1460+
14451461
def getOrganizationWebhooksLogs(self, organizationId: str, total_pages=1, direction='next', **kwargs):
14461462
"""
14471463
**Return the log of webhook POSTs sent**

0 commit comments

Comments
 (0)