Skip to content

Commit 13dc2fa

Browse files
author
Shiyue Cheng
committed
April 2010 version 0.10 release
1 parent 5cfaeff commit 13dc2fa

11 files changed

Lines changed: 157 additions & 42 deletions

meraki/__init__.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,11 @@
8282
from .api.wireless_settings import WirelessSettings
8383
from .config import (
8484
API_KEY_ENVIRONMENT_VARIABLE, DEFAULT_BASE_URL, SINGLE_REQUEST_TIMEOUT, CERTIFICATE_PATH, WAIT_ON_RATE_LIMIT,
85+
NGINX_429_RETRY_WAIT_TIME, ACTION_BATCH_RETRY_WAIT_TIME, RETRY_4XX_ERROR, RETRY_4XX_ERROR_WAIT_TIME,
8586
MAXIMUM_RETRIES, OUTPUT_LOG, LOG_PATH, LOG_FILE_PREFIX, PRINT_TO_CONSOLE, SIMULATE_API_CALLS
8687
)
8788

88-
__version__ = '0.90.1'
89+
__version__ = '0.100.0'
8990

9091
class DashboardAPI(object):
9192
"""
@@ -96,6 +97,10 @@ class DashboardAPI(object):
9697
- single_request_timeout (integer): maximum number of seconds for each API call
9798
- certificate_path (string): path for TLS/SSL certificate verification if behind local proxy
9899
- wait_on_rate_limit (boolean): retry if 429 rate limit error encountered?
100+
- nginx_429_retry_wait_time (integer): Nginx 429 retry wait time
101+
- action_batch_retry_wait_time (integer): action batch concurrency error retry wait time
102+
- retry_4xx_error (boolean): retry if encountering other 4XX error (besides 429)?
103+
- retry_4xx_error_wait_time (integer): other 4XX error retry wait time
99104
- maximum_retries (integer): retry up to this many times when encountering 429s or other server-side errors
100105
- output_log (boolean): create an output log file?
101106
- log_path (string): path to output log; by default, working directory of script if not specified
@@ -106,6 +111,9 @@ class DashboardAPI(object):
106111

107112
def __init__(self, api_key=None, base_url=DEFAULT_BASE_URL, single_request_timeout=SINGLE_REQUEST_TIMEOUT,
108113
certificate_path=CERTIFICATE_PATH, wait_on_rate_limit=WAIT_ON_RATE_LIMIT,
114+
nginx_429_retry_wait_time=NGINX_429_RETRY_WAIT_TIME,
115+
action_batch_retry_wait_time=ACTION_BATCH_RETRY_WAIT_TIME,
116+
retry_4xx_error=RETRY_4XX_ERROR, retry_4xx_error_wait_time=RETRY_4XX_ERROR_WAIT_TIME,
109117
maximum_retries=MAXIMUM_RETRIES, output_log=OUTPUT_LOG, log_path=LOG_PATH,
110118
log_file_prefix=LOG_FILE_PREFIX, print_console=PRINT_TO_CONSOLE, simulate=SIMULATE_API_CALLS):
111119
# Check API key
@@ -144,6 +152,10 @@ def __init__(self, api_key=None, base_url=DEFAULT_BASE_URL, single_request_timeo
144152
single_request_timeout=single_request_timeout,
145153
certificate_path=certificate_path,
146154
wait_on_rate_limit=wait_on_rate_limit,
155+
nginx_429_retry_wait_time=nginx_429_retry_wait_time,
156+
action_batch_retry_wait_time=action_batch_retry_wait_time,
157+
retry_4xx_error=retry_4xx_error,
158+
retry_4xx_error_wait_time=retry_4xx_error_wait_time,
147159
maximum_retries=maximum_retries,
148160
simulate=simulate,
149161
)

meraki/api/alert_settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def updateNetworkAlertSettings(self, networkId: str, **kwargs):
2525
https://api.meraki.com/api_docs#update-the-alert-configuration-for-this-network
2626
2727
- networkId (string)
28-
- defaultDestinations (object): The network_wide destinations for all alerts on the network.
28+
- defaultDestinations (object): The network-wide destinations for all alerts on the network.
2929
- alerts (array): Alert-specific configuration for each type. Only alerts that pertain to the network can be updated.
3030
"""
3131

meraki/api/cameras.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def updateDeviceCameraQualityAndRetentionSettings(self, serial: str, **kwargs):
3131
- restrictedBandwidthModeEnabled (boolean): Boolean indicating if restricted bandwidth is enabled(true) or disabled(false) on the camera
3232
- quality (string): Quality of the camera. Can be one of 'Standard', 'High' or 'Enhanced'. Not all qualities are supported by every camera model.
3333
- resolution (string): Resolution of the camera. Can be one of '1280x720', '1920x1080', '1080x1080' or '2058x2058'. Not all resolutions are supported by every camera model.
34+
- motionDetectorVersion (integer): The version of the motion detector that will be used by the camera. Only applies to Gen 2 cameras. Defaults to v2.
3435
"""
3536

3637
kwargs.update(locals())
@@ -41,14 +42,17 @@ def updateDeviceCameraQualityAndRetentionSettings(self, serial: str, **kwargs):
4142
if 'resolution' in kwargs:
4243
options = ['1280x720', '1920x1080', '1080x1080', '2058x2058']
4344
assert kwargs['resolution'] in options, f'''"resolution" cannot be "{kwargs['resolution']}", & must be set to one of: {options}'''
45+
if 'motionDetectorVersion' in kwargs:
46+
options = [1, 2]
47+
assert kwargs['motionDetectorVersion'] in options, f'''"motionDetectorVersion" cannot be "{kwargs['motionDetectorVersion']}", & must be set to one of: {options}'''
4448

4549
metadata = {
4650
'tags': ['Cameras'],
4751
'operation': 'updateDeviceCameraQualityAndRetentionSettings',
4852
}
4953
resource = f'/devices/{serial}/camera/qualityAndRetentionSettings'
5054

51-
body_params = ['profileId', 'motionBasedRetentionEnabled', 'audioRecordingEnabled', 'restrictedBandwidthModeEnabled', 'quality', 'resolution']
55+
body_params = ['profileId', 'motionBasedRetentionEnabled', 'audioRecordingEnabled', 'restrictedBandwidthModeEnabled', 'quality', 'resolution', 'motionDetectorVersion']
5256
payload = {k: v for (k, v) in kwargs.items() if k in body_params}
5357

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

meraki/api/networks.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,17 @@ def getNetworkTraffic(self, networkId: str, **kwargs):
194194
- networkId (string)
195195
- t0 (string): The beginning of the timespan for the data. The maximum lookback period is 30 days from today.
196196
- timespan (number): The timespan for which the information will be fetched. If specifying timespan, do not specify parameter t0. The value must be in seconds and be less than or equal to 30 days.
197-
- deviceType (string): Filter the data by device type: combined (default), wireless, switch, appliance.
198-
When using combined, for each rule the data will come from the device type with the most usage.
197+
- deviceType (string): Filter the data by device type: 'combined', 'wireless', 'switch' or 'appliance'. Defaults to 'combined'.
198+
When using 'combined', for each rule the data will come from the device type with the most usage.
199199
200200
"""
201201

202202
kwargs.update(locals())
203203

204+
if 'deviceType' in kwargs:
205+
options = ['combined', 'wireless', 'switch', 'appliance']
206+
assert kwargs['deviceType'] in options, f'''"deviceType" cannot be "{kwargs['deviceType']}", & must be set to one of: {options}'''
207+
204208
metadata = {
205209
'tags': ['Networks'],
206210
'operation': 'getNetworkTraffic',

meraki/api/organizations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def deleteOrganization(self, organizationId: str):
9393

9494
return self._session.delete(metadata, resource)
9595

96-
def claimOrganization(self, organizationId: str, **kwargs):
96+
def claimIntoOrganization(self, organizationId: str, **kwargs):
9797
"""
9898
**Claim a list of devices, licenses, and/or orders into an organization. When claiming by order, all devices and licenses in the order will be claimed; licenses will be added to the organization and devices will be placed in the organization's inventory.**
9999
https://api.meraki.com/api_docs#claim-a-list-of-devices-licenses-and/or-orders-into-an-organization
@@ -108,7 +108,7 @@ def claimOrganization(self, organizationId: str, **kwargs):
108108

109109
metadata = {
110110
'tags': ['Organizations'],
111-
'operation': 'claimOrganization',
111+
'operation': 'claimIntoOrganization',
112112
}
113113
resource = f'/organizations/{organizationId}/claim'
114114

meraki/api/ssids.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,18 @@ def updateNetworkSsid(self, networkId: str, number: str, **kwargs):
6262
- number (string)
6363
- name (string): The name of the SSID
6464
- enabled (boolean): Whether or not the SSID is enabled
65-
- authMode (string): The association control method for the SSID ('open', 'psk', 'open-with-radius', '8021x-meraki' or '8021x-radius')
65+
- authMode (string): The association control method for the SSID ('open', 'psk', 'open-with-radius', '8021x-meraki', '8021x-radius', 'ipsk-with-radius' or 'ipsk-without-radius')
6666
- enterpriseAdminAccess (string): Whether or not an SSID is accessible by 'enterprise' administrators ('access disabled' or 'access enabled')
6767
- encryptionMode (string): The psk encryption mode for the SSID ('wep' or 'wpa'). This param is only valid if the authMode is 'psk'
6868
- psk (string): The passkey for the SSID. This param is only valid if the authMode is 'psk'
6969
- wpaEncryptionMode (string): The types of WPA encryption. ('WPA1 only', 'WPA1 and WPA2', 'WPA2 only', 'WPA3 Transition Mode' or 'WPA3 only')
7070
- 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' or 'Sponsored guest'). This attribute is not supported for template children.
71-
- radiusServers (array): The RADIUS 802.1x servers to be used for authentication. This param is only valid if the authMode is 'open-with-radius' or '8021x-radius'
71+
- 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'
7272
- 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.
7373
- 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')
7474
- 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')
75-
- radiusAccountingEnabled (boolean): Whether or not RADIUS accounting is enabled. This param is only valid if the authMode is 'open-with-radius' or '8021x-radius'
76-
- radiusAccountingServers (array): The RADIUS accounting 802.1x servers to be used for authentication. This param is only valid if the authMode is 'open-with-radius' or '8021x-radius' and radiusAccountingEnabled is 'true'
75+
- radiusAccountingEnabled (boolean): Whether or not RADIUS accounting is enabled. This param is only valid if the authMode is 'open-with-radius', '8021x-radius' or 'ipsk-with-radius'
76+
- radiusAccountingServers (array): The RADIUS accounting 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' and radiusAccountingEnabled is 'true'
7777
- radiusAttributeForGroupPolicies (string): Specify the RADIUS attribute used to look up group policies ('Filter-Id', 'Reply-Message', 'Airespace-ACL-Name' or 'Aruba-User-Role'). Access points must receive this attribute in the RADIUS Access-Accept message
7878
- ipAssignmentMode (string): The client IP assignment mode ('NAT mode', 'Bridge mode', 'Layer 3 roaming', 'Layer 3 roaming with a concentrator' or 'VPN')
7979
- useVlanTagging (boolean): Whether or not traffic should be directed to use specific VLANs. This param is only valid if the ipAssignmentMode is 'Bridge mode' or 'Layer 3 roaming'
@@ -94,7 +94,7 @@ def updateNetworkSsid(self, networkId: str, number: str, **kwargs):
9494
kwargs.update(locals())
9595

9696
if 'authMode' in kwargs:
97-
options = ['open', 'psk', 'open-with-radius', '8021x-meraki', '8021x-radius']
97+
options = ['open', 'psk', 'open-with-radius', '8021x-meraki', '8021x-radius', 'ipsk-with-radius', 'ipsk-without-radius']
9898
assert kwargs['authMode'] in options, f'''"authMode" cannot be "{kwargs['authMode']}", & must be set to one of: {options}'''
9999
if 'enterpriseAdminAccess' in kwargs:
100100
options = ['access disabled', 'access enabled']

meraki/api/vlans.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def getNetworkVlans(self, networkId: str):
1919

2020
return self._session.get(metadata, resource)
2121

22-
def createNetworkVlan(self, networkId: str, id: str, name: str, subnet: str, applianceIp: str):
22+
def createNetworkVlan(self, networkId: str, id: str, name: str, subnet: str, applianceIp: str, **kwargs):
2323
"""
2424
**Add a VLAN**
2525
https://api.meraki.com/api_docs#add-a-vlan
@@ -29,17 +29,18 @@ def createNetworkVlan(self, networkId: str, id: str, name: str, subnet: str, app
2929
- name (string): The name of the new VLAN
3030
- subnet (string): The subnet of the VLAN
3131
- applianceIp (string): The local IP of the appliance on the VLAN
32+
- groupPolicyId (string): The id of the desired group policy to apply to the VLAN
3233
"""
3334

34-
kwargs = locals()
35+
kwargs.update(locals())
3536

3637
metadata = {
3738
'tags': ['VLANs'],
3839
'operation': 'createNetworkVlan',
3940
}
4041
resource = f'/networks/{networkId}/vlans'
4142

42-
body_params = ['id', 'name', 'subnet', 'applianceIp']
43+
body_params = ['id', 'name', 'subnet', 'applianceIp', 'groupPolicyId']
4344
payload = {k: v for (k, v) in kwargs.items() if k in body_params}
4445

4546
return self._session.post(metadata, resource, payload)
@@ -71,6 +72,7 @@ def updateNetworkVlan(self, networkId: str, vlanId: str, **kwargs):
7172
- name (string): The name of the VLAN
7273
- subnet (string): The subnet of the VLAN
7374
- applianceIp (string): The local IP of the appliance on the VLAN
75+
- groupPolicyId (string): The id of the desired group policy to apply to the VLAN
7476
- vpnNatSubnet (string): The translated VPN subnet if VPN and VPN subnet translation are enabled on the VLAN
7577
- dhcpHandling (string): The appliance's handling of DHCP requests on this VLAN. One of: 'Run a DHCP server', 'Relay DHCP to another server' or 'Do not respond to DHCP requests'
7678
- dhcpRelayServerIps (array): The IPs of the DHCP servers that DHCP requests should be relayed to
@@ -99,7 +101,7 @@ def updateNetworkVlan(self, networkId: str, vlanId: str, **kwargs):
99101
}
100102
resource = f'/networks/{networkId}/vlans/{vlanId}'
101103

102-
body_params = ['name', 'subnet', 'applianceIp', 'vpnNatSubnet', 'dhcpHandling', 'dhcpRelayServerIps', 'dhcpLeaseTime', 'dhcpBootOptionsEnabled', 'dhcpBootNextServer', 'dhcpBootFilename', 'fixedIpAssignments', 'reservedIpRanges', 'dnsNameservers', 'dhcpOptions']
104+
body_params = ['name', 'subnet', 'applianceIp', 'groupPolicyId', 'vpnNatSubnet', 'dhcpHandling', 'dhcpRelayServerIps', 'dhcpLeaseTime', 'dhcpBootOptionsEnabled', 'dhcpBootNextServer', 'dhcpBootFilename', 'fixedIpAssignments', 'reservedIpRanges', 'dnsNameservers', 'dhcpOptions']
103105
payload = {k: v for (k, v) in kwargs.items() if k in body_params}
104106

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

0 commit comments

Comments
 (0)